TextPad Syntax Definition Files Syntax definition files contain the information TextPad uses to highlight keywords in different colors. A standard set is provided for common programming languages, and contributed files are available from the TextPad web site. If you want to implement syntax highlighting for a document class that has not been catered for, you must create a file of keywords that you want to be colored, as described below, and save it as "myfile.SYN" in the Syntax folder. Note that double byte character sets cannot be used in syntax definition files. The first line of the file must be one of the following:    TEXT=1 means that only URLs will be highlighted. All sections of the syntax definition file are ignored, so do not use this type. C=1 means that full syntax highlighting is available for languages which broadly conform to C syntax. All keywords are in a single namespace, so duplicates are not allowed. HTML=1 means that full syntax highlighting is available for languages which broadly conform to HTML syntax. Keywords are in two namespaces, with tags in one and their attributes in the other. The [i]Namespace1[/i] parameter controls how many of the six [i][Keyword][/i] sections are in the first namespace. Having two namespaces allows keywords such as TITLE, which can be both a tag and an attribute, to be colored according to context. PERL=1 is a variant of C=1, to take account of some peculiarities of Perl syntax. LaTeX=1 is a variant of C=1, to take account of some peculiarities of LaTeX syntax.   We will introduce other grammars as and when necessary. The rest looks like an .INI file, with the following sections:         [Syntax] [Keywords 1] [Keywords 2] [Keywords 3] [Keywords 4] [Keywords 5] [Keywords 6] [Preprocessor keywords] The [Syntax] section must be first, followed by [Keywords 1]. The other sections are optional. The [Preprocessor keywords] section can only be used when a single character (such as "#") is used to start a statement that is handled by a pre-processor. Keywords are entered one per line. The split between the keyword sections is arbitrary. You only need to use Keywords 2-6, if you want some keywords in different colors. They are all in the same namespace, unless "HTML=1" is used, when "Namespace1 = n" specifies how many of the keyword sections are in the first namespace, with the remainder in another. This means that the same name can appear in both namespaces when "HTML=1". The pre-processor keywords are always in their own namespace. You can select the newly created .SYN file using the Preferences command on the Configure menu. It should be displayed in the drop-down list box for Syntax settings, for the new document class you created. The [Syntax] section must contain the following lines:  Namespace1 = a number in the range 1 to 6, which specifies how many of the keyword sections are in the first namespace. There is only one namespace when "C=1" or "LaTeX=1", so this value must be 6. There are two namespaces when "HTML=1", so this value can be between 1 and 5, and defaults to 1. Change it to 2, say, if you want to be able to display HTML tags in two colors, and split the tag keywords between the [Keywords 1] and [Keywords 2] sections, depending on which color you want them in. IgnoreCase = "Yes" if keywords are not case sensitive, otherwise "No". KeyWordLength = the number of characters in each keyword. If this entry is omitted, or set to 0, keywords can be of variable length. It is only required for fixed length keywords that run together, without any delimiters. BracketChars = characters that can be used for brackets. OperatorChars = characters that can be used for operators. PreprocStart = the character used to start a pre-processor statement. HexPrefix = the characters that prefix hexadecimal numbers. If this entry is omitted, it defaults to "0x". SyntaxStart = a string of characters that switch on keyword recognition (e.g. ""), or leave blank. CommentStart = a string of characters that start a multiple line comment, or leave blank. CommentEnd = a string of characters that end a multiple line comment, or leave blank. CommentStartAlt = an alternative string of characters that start a multiple line comment. CommentEndAlt = an alternative string of characters that end a multiple line comment. SingleComment = a string of characters that start a single line comment (e.g. "//" or "REM"), or leave blank. SingleCommentCol = If a single line comment must start in a specific column, assign the number here. If it must start in the first non-blank column, assign "Leading" here. SingleCommentAlt = an alternative string of characters that start a single line comment (e.g. "//" or "REM"), or leave blank. SingleCommentColAlt = If the alternative single line comment must start in a specific column, assign the number here. If it must start in the first non-blank column, assign "Leading" here. SingleCommentEsc = The character that is used to escape either of the SingleComment strings. StringsSpanLines = "Yes" if strings can continue over line boundaries, otherwise "No". This can be used in conjunction with StringEsc, if the string can only be continued when the new line is escaped with that character. StringStart = The character that indicates the start of a string (e.g. double quote). StringEnd = The character that indicates the end of a string (e.g. double quote). StringAlt = An alternative character that can be used to delimit strings, if the string contains the StringEnd character. StringEsc = The character that is used to escape the StringEnd character, if it is part of a string (e.g. "\"). CharStart = The character that is used to start a character literal (e.g. single quote).                          CharEnd = The character that is used to end a character literal (e.g. single quote). CharEsc = The character that is used to escape the CharEnd character, if it is part of a character literal (e.g. "\").
Please download to view
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
...

TextPad Syntax Definition Files

by joshmolina

on

Report

Category:

Documents

Download: 0

Comment: 0

104

views

Comments

Description

Download TextPad Syntax Definition Files

Transcript

TextPad Syntax Definition Files Syntax definition files contain the information TextPad uses to highlight keywords in different colors. A standard set is provided for common programming languages, and contributed files are available from the TextPad web site. If you want to implement syntax highlighting for a document class that has not been catered for, you must create a file of keywords that you want to be colored, as described below, and save it as "myfile.SYN" in the Syntax folder. Note that double byte character sets cannot be used in syntax definition files. The first line of the file must be one of the following:    TEXT=1 means that only URLs will be highlighted. All sections of the syntax definition file are ignored, so do not use this type. C=1 means that full syntax highlighting is available for languages which broadly conform to C syntax. All keywords are in a single namespace, so duplicates are not allowed. HTML=1 means that full syntax highlighting is available for languages which broadly conform to HTML syntax. Keywords are in two namespaces, with tags in one and their attributes in the other. The [i]Namespace1[/i] parameter controls how many of the six [i][Keyword][/i] sections are in the first namespace. Having two namespaces allows keywords such as TITLE, which can be both a tag and an attribute, to be colored according to context. PERL=1 is a variant of C=1, to take account of some peculiarities of Perl syntax. LaTeX=1 is a variant of C=1, to take account of some peculiarities of LaTeX syntax.   We will introduce other grammars as and when necessary. The rest looks like an .INI file, with the following sections:         [Syntax] [Keywords 1] [Keywords 2] [Keywords 3] [Keywords 4] [Keywords 5] [Keywords 6] [Preprocessor keywords] The [Syntax] section must be first, followed by [Keywords 1]. The other sections are optional. The [Preprocessor keywords] section can only be used when a single character (such as "#") is used to start a statement that is handled by a pre-processor. Keywords are entered one per line. The split between the keyword sections is arbitrary. You only need to use Keywords 2-6, if you want some keywords in different colors. They are all in the same namespace, unless "HTML=1" is used, when "Namespace1 = n" specifies how many of the keyword sections are in the first namespace, with the remainder in another. This means that the same name can appear in both namespaces when "HTML=1". The pre-processor keywords are always in their own namespace. You can select the newly created .SYN file using the Preferences command on the Configure menu. It should be displayed in the drop-down list box for Syntax settings, for the new document class you created. The [Syntax] section must contain the following lines:  Namespace1 = a number in the range 1 to 6, which specifies how many of the keyword sections are in the first namespace. There is only one namespace when "C=1" or "LaTeX=1", so this value must be 6. There are two namespaces when "HTML=1", so this value can be between 1 and 5, and defaults to 1. Change it to 2, say, if you want to be able to display HTML tags in two colors, and split the tag keywords between the [Keywords 1] and [Keywords 2] sections, depending on which color you want them in. IgnoreCase = "Yes" if keywords are not case sensitive, otherwise "No". KeyWordLength = the number of characters in each keyword. If this entry is omitted, or set to 0, keywords can be of variable length. It is only required for fixed length keywords that run together, without any delimiters. BracketChars = characters that can be used for brackets. OperatorChars = characters that can be used for operators. PreprocStart = the character used to start a pre-processor statement. HexPrefix = the characters that prefix hexadecimal numbers. If this entry is omitted, it defaults to "0x". SyntaxStart = a string of characters that switch on keyword recognition (e.g. ""), or leave blank. CommentStart = a string of characters that start a multiple line comment, or leave blank. CommentEnd = a string of characters that end a multiple line comment, or leave blank. CommentStartAlt = an alternative string of characters that start a multiple line comment. CommentEndAlt = an alternative string of characters that end a multiple line comment. SingleComment = a string of characters that start a single line comment (e.g. "//" or "REM"), or leave blank. SingleCommentCol = If a single line comment must start in a specific column, assign the number here. If it must start in the first non-blank column, assign "Leading" here. SingleCommentAlt = an alternative string of characters that start a single line comment (e.g. "//" or "REM"), or leave blank. SingleCommentColAlt = If the alternative single line comment must start in a specific column, assign the number here. If it must start in the first non-blank column, assign "Leading" here. SingleCommentEsc = The character that is used to escape either of the SingleComment strings. StringsSpanLines = "Yes" if strings can continue over line boundaries, otherwise "No". This can be used in conjunction with StringEsc, if the string can only be continued when the new line is escaped with that character. StringStart = The character that indicates the start of a string (e.g. double quote). StringEnd = The character that indicates the end of a string (e.g. double quote). StringAlt = An alternative character that can be used to delimit strings, if the string contains the StringEnd character. StringEsc = The character that is used to escape the StringEnd character, if it is part of a string (e.g. "\"). CharStart = The character that is used to start a character literal (e.g. single quote).                          CharEnd = The character that is used to end a character literal (e.g. single quote). CharEsc = The character that is used to escape the CharEnd character, if it is part of a character literal (e.g. "\").
Fly UP