(Created page with "right|thumb|alt=UltraEdit wordfile|A wordfile used for syntax highlighting in UltraEdit") |
|||
Line 1: | Line 1: | ||
[[File:Ultraedit wordfile.png|right|thumb|alt=UltraEdit wordfile|A wordfile used for syntax highlighting in UltraEdit]] | [[File:Ultraedit wordfile.png|right|thumb|alt=UltraEdit wordfile|A wordfile used for syntax highlighting in UltraEdit]] | ||
+ | |||
+ | As discussed in the [[Syntax highlighting]] topic, UltraEdit applies syntax highlighting from definitions and configurations in wordfiles. Wordfiles must be in plain text, ANSI format with DOS style line endings and a .uew file extension. The wordfiles are loaded on startup, or when modified via the '''[[Add syntax highlighting languages|Add another language...]]''' dialog. Wordfiles are loaded from the folder shown in the [[Editor display:Syntax highlighting|Editor Display » Syntax Highlighting]] section of Settings (subfolders are ignored). | ||
+ | |||
+ | The '''easiest''' way to create your own wordfile is to take one of the existing wordfiles and modify it as desired, saving it into the wordfiles directory with a unique name and .uew file extension. You will need to restart UltraEdit in order to initialize the new wordfile, but once initialized, any changes you make to it should be reflected in real-time. | ||
+ | |||
+ | This topic exhaustively documents all possible options and sections of the wordfile. | ||
+ | |||
+ | == Language definition == | ||
+ | The first step to creating a valid wordfile is defining the language it will apply highlighting for. This is done on the '''first line''' of the wordfile via the following syntax: | ||
+ | |||
+ | <code>/L#"Language Name"</code> | ||
+ | |||
+ | ...where "#" is a number (no longer used for sorting purposes but still required) and "Language Name" is the name as it will appear in the list of available syntax highlighting languages. | ||
+ | |||
+ | == Language options == | ||
+ | |||
+ | There are several keywords available for specifying syntax highlighting behavior options in the wordfile. These options are set by simply including the keyword in the wordfile. These are typically added immediately after the language definition on line 1 of the wordfile, but can be listed on their own line if you desire. Note: If the option is on its own line in the wordfile, it must be preceded by a forward slash, e.g.: | ||
+ | |||
+ | <code>/DisableMLS</code> | ||
+ | F | ||
+ | {| | ||
+ | !Option name | ||
+ | !Behavior | ||
+ | |- | ||
+ | |<code>Nocase</code> | ||
+ | |Disables case sensitivity for syntax highlighting. By default, syntax highlighting ''is'' case sensitive. | ||
+ | |- | ||
+ | |<code>Noquote</code> | ||
+ | |Disables string highlighting for the language completely. | ||
+ | |- | ||
+ | |<code>EnableMLS</code> | ||
+ | |Enables multi-line string support (an unclosed string may span multiple lines) for the language. | ||
+ | |- | ||
+ | |<code>DisableMLS</code> | ||
+ | |Disables multi-line string support (an unclosed string will not be highlighted past the first line) for the language. | ||
+ | |- | ||
+ | |<code>NestBlockComments</code> | ||
+ | |Enables the matching/pairing of nested block comment highlighting if the coding language supports these. (HTML, for example, does not.) | ||
+ | |- | ||
+ | |<code>EnableCFByIndent</code> | ||
+ | |Overrides any code folding string and applies code folding based upon the code's indentation level (for languages like Python). | ||
+ | |- | ||
+ | |<code>EnableSpellasYouType</code> | ||
+ | |Enables spell-as-you-type inline spell checking for the language (if set in the [[Spell checker:Miscellaneous|Spell checker » Miscellaneous]] section of Settings). | ||
+ | |} | ||
+ | |||
+ | == Special "_LANG" language flags == | ||
+ | In order to apply correct syntax highlighting and other wordfile-based functionality, for several languages, special internal handling is required. These languages are determined via special flags in the wordfile. There are a fixed number of special language flags, and more may be added in the future. The available flags are described in detail below. | ||
+ | |||
+ | The language flag must exist on the line 1 of the wordfile somewhere after the language definition. | ||
+ | |||
+ | '''Important note: each language flag may exist only once in a single wordfile. Adding a language flag to multiple wordfiles will result in unexpected / incorrect highlighting for the associated language(s).''' | ||
+ | |||
+ | <code>AASM_LANG</code> | ||
+ | Language flag for: '''AT&T Assembly''' | ||
+ | |||
+ | <code>ASP_LANG</code> | ||
+ | Language flag for: '''ASP''' | ||
+ | |||
+ | Note: the .asp(x) file extension (and all variants) should be listed in the HTML wordfile to support multi-language embedded ASP highlighting. This will not adversely affect standalone ASP files. | ||
+ | |||
+ | <code>COBOL_LANG</code> | ||
+ | Language flag for: '''COBOL''' | ||
+ | |||
+ | <code>CSHARP_LANG</code> | ||
+ | Language flag for: '''C#''' | ||
+ | |||
+ | <code>CSS_LANG</code> | ||
+ | Language flag for: '''CSS''' | ||
+ | |||
+ | <code>C_LANG</code> | ||
+ | Language flag for: '''C/C++''' | ||
+ | |||
+ | <code>ECMA_LANG</code> | ||
+ | Language flag for: '''EcmaScript''' | ||
+ | |||
+ | <code>FORTRAN_LANG</code> | ||
+ | Language flag for: '''FORTRAN''' | ||
+ | |||
+ | <code>HTML_LANG</code> | ||
+ | Language flag for: '''HTML''' | ||
+ | |||
+ | HTML is considerably different from other coding languages. With the HTML_LANG keyword, in the wordfile itself, the special characters "<" and optionally "/" can be prepended to any keyword in the wordfile without having to sort lines as is normally required for wordfile color groups. For example, all keywords beginning with "<a" or "</a" should be on the same line as other words beginning with "a". In the same way, all words beginning with "<b" or "</b" should be on the same line as other words beginning with "b", but on a different line from those starting with "<a", "</a", or "a". | ||
+ | |||
+ | |||
+ | This flag also sets which language type to allow multi-language web-based highlighting; for example, CSS, JavaScript, or PHP embedded in a .html file. | ||
+ | |||
+ | <code>JAVA_LANG</code> | ||
+ | Language flag for: '''Java''' | ||
+ | |||
+ | <code>JSCRIPT_LANG</code> | ||
+ | Language flag for: '''JavaScript''' | ||
+ | |||
+ | <code>LATEX_LANG</code> | ||
+ | Language flag for: '''LaTeX''' | ||
+ | |||
+ | With the LaTeX language flag, UltraEdit applies special highlighting to allow words to be appropriately handled and highlighted with the "\", and with consecutive words. | ||
+ | |||
+ | This also allows the keywords to be sorted in the wordfile color group without all of them being on the same line. If the keyword begins with "\" then the second character is used to determine which line the word should be on. For example, all words beginning with "\a" should be on the same line as other words beginning with "\a" or "a". In the same way, all words beginning with "\b" should be on the same line as other words beginning with "\b" or "b" but on a different line from those starting with "\a". | ||
+ | |||
+ | <code>MASM_LANG</code> | ||
+ | Language flag for: '''Microsoft Assembly''' | ||
+ | |||
+ | <code>MATLAB_LANG</code> | ||
+ | Language flag for: '''MATLAB''' | ||
+ | |||
+ | <code>NASM_LANG</code> | ||
+ | Language flag for: '''Netwide Assembly''' | ||
+ | |||
+ | <code>PASCAL_LANG</code> | ||
+ | Language flag for: '''Pascal''' | ||
+ | |||
+ | <code>PERL_LANG</code> | ||
+ | Language flag for: '''Perl''' | ||
+ | |||
+ | <code>PHP_LANG</code> | ||
+ | Language flag for: '''PHP''' | ||
+ | |||
+ | Note: the .php file extension should be listed in the HTML wordfile to support multi-language embedded PHP highlighting. This will not adversely affect standalone PHP files. | ||
+ | |||
+ | <code>PLB_LANG</code> | ||
+ | Language flag for: '''PLB''' | ||
+ | |||
+ | <code>PUREBASIC_LANG</code> | ||
+ | Language flag for: '''PureBasic''' | ||
+ | |||
+ | <code>PYTHON_LANG</code> | ||
+ | Language flag for: '''Python''' | ||
+ | |||
+ | <code>RUBY_LANG</code> | ||
+ | Language flag for: '''Ruby''' | ||
+ | |||
+ | <code>SQL_LANG</code> | ||
+ | Language flag for: '''SQL''' | ||
+ | |||
+ | <code>VBSCRIPT_LANG</code> | ||
+ | Language flag for: '''VBScript''' | ||
+ | |||
+ | <code>VB_LANG</code> | ||
+ | Language flag for: '''Visual Basic''' | ||
+ | |||
+ | <code>XML_LANG</code> | ||
+ | Language flag for: '''XML''' | ||
+ | |||
+ | <code>XSL_LANG</code> | ||
+ | Language flag for: '''XSL''' | ||
+ | |||
+ | == Comments == | ||
+ | |||
+ | === Line comments === | ||
+ | Line comments can be defined with the following syntax, typically placed on line 1 of the wordfile: | ||
+ | |||
+ | <code>Line Comment = #</code><br> | ||
+ | <code>/Line Comment = #</code> (if on its own line in wordfile) | ||
+ | |||
+ | The above would cause all text following a "#" character to be colored as a comment until the end of the line. | ||
+ | |||
+ | Line comments must be 5 characters or less. If less than 5 characters and on the first line of the wordfile, the characters must be followed by a space. | ||
+ | |||
+ | You can define a second set of line comments with the following syntax: | ||
+ | |||
+ | <code>Line Comment Alt = //</code><br> | ||
+ | <code>/Line Comment Alt = //</code> (if on its own line in wordfile) | ||
+ | |||
+ | The above would cause all text following "//" to be colored as a comment until the end of the line. | ||
+ | |||
+ | Some languages may require a space follow the line comment character. To facilitate this, the following syntax is available: | ||
+ | |||
+ | <code>Line Comment Num = xCC </code> | ||
+ | |||
+ | ...where x specifies the number of characters (1 to 5) and '''immediately''' following are the characters to be used as line comments. In the example above, x would be 3 since the line comment would be "CC " (note the space after "CC"). | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === Block comments === | ||
+ | |||
+ | == Strings == | ||
+ | |||
+ | (string literals here) | ||
+ | |||
+ | == Escape characters == | ||
+ | |||
+ | == File extension / names == | ||
+ | |||
+ | == Shebang parsing == | ||
+ | |||
+ | == Function list strings == | ||
+ | |||
+ | == Delimiters == | ||
+ | |||
+ | == Indent / unindent strings == | ||
+ | |||
+ | == Code folding strings == | ||
+ | |||
+ | == Marker characters == | ||
+ | |||
+ | == Keyword color groups== |
As discussed in the Syntax highlighting topic, UltraEdit applies syntax highlighting from definitions and configurations in wordfiles. Wordfiles must be in plain text, ANSI format with DOS style line endings and a .uew file extension. The wordfiles are loaded on startup, or when modified via the Add another language... dialog. Wordfiles are loaded from the folder shown in the Editor Display » Syntax Highlighting section of Settings (subfolders are ignored).
The easiest way to create your own wordfile is to take one of the existing wordfiles and modify it as desired, saving it into the wordfiles directory with a unique name and .uew file extension. You will need to restart UltraEdit in order to initialize the new wordfile, but once initialized, any changes you make to it should be reflected in real-time.
This topic exhaustively documents all possible options and sections of the wordfile.
The first step to creating a valid wordfile is defining the language it will apply highlighting for. This is done on the first line of the wordfile via the following syntax:
/L#"Language Name"
...where "#" is a number (no longer used for sorting purposes but still required) and "Language Name" is the name as it will appear in the list of available syntax highlighting languages.
There are several keywords available for specifying syntax highlighting behavior options in the wordfile. These options are set by simply including the keyword in the wordfile. These are typically added immediately after the language definition on line 1 of the wordfile, but can be listed on their own line if you desire. Note: If the option is on its own line in the wordfile, it must be preceded by a forward slash, e.g.:
/DisableMLS
F
Option name | Behavior |
---|---|
Nocase
|
Disables case sensitivity for syntax highlighting. By default, syntax highlighting is case sensitive. |
Noquote
|
Disables string highlighting for the language completely. |
EnableMLS
|
Enables multi-line string support (an unclosed string may span multiple lines) for the language. |
DisableMLS
|
Disables multi-line string support (an unclosed string will not be highlighted past the first line) for the language. |
NestBlockComments
|
Enables the matching/pairing of nested block comment highlighting if the coding language supports these. (HTML, for example, does not.) |
EnableCFByIndent
|
Overrides any code folding string and applies code folding based upon the code's indentation level (for languages like Python). |
EnableSpellasYouType
|
Enables spell-as-you-type inline spell checking for the language (if set in the Spell checker » Miscellaneous section of Settings). |
In order to apply correct syntax highlighting and other wordfile-based functionality, for several languages, special internal handling is required. These languages are determined via special flags in the wordfile. There are a fixed number of special language flags, and more may be added in the future. The available flags are described in detail below.
The language flag must exist on the line 1 of the wordfile somewhere after the language definition.
Important note: each language flag may exist only once in a single wordfile. Adding a language flag to multiple wordfiles will result in unexpected / incorrect highlighting for the associated language(s).
AASM_LANG
Language flag for: AT&T Assembly
ASP_LANG
Language flag for: ASP
Note: the .asp(x) file extension (and all variants) should be listed in the HTML wordfile to support multi-language embedded ASP highlighting. This will not adversely affect standalone ASP files.
COBOL_LANG
Language flag for: COBOL
CSHARP_LANG
Language flag for: C#
CSS_LANG
Language flag for: CSS
C_LANG
Language flag for: C/C++
ECMA_LANG
Language flag for: EcmaScript
FORTRAN_LANG
Language flag for: FORTRAN
HTML_LANG
Language flag for: HTML
HTML is considerably different from other coding languages. With the HTML_LANG keyword, in the wordfile itself, the special characters "<" and optionally "/" can be prepended to any keyword in the wordfile without having to sort lines as is normally required for wordfile color groups. For example, all keywords beginning with "<a" or "</a" should be on the same line as other words beginning with "a". In the same way, all words beginning with "<b" or "</b" should be on the same line as other words beginning with "b", but on a different line from those starting with "<a", "</a", or "a".
This flag also sets which language type to allow multi-language web-based highlighting; for example, CSS, JavaScript, or PHP embedded in a .html file.
JAVA_LANG
Language flag for: Java
JSCRIPT_LANG
Language flag for: JavaScript
LATEX_LANG
Language flag for: LaTeX
With the LaTeX language flag, UltraEdit applies special highlighting to allow words to be appropriately handled and highlighted with the "\", and with consecutive words.
This also allows the keywords to be sorted in the wordfile color group without all of them being on the same line. If the keyword begins with "\" then the second character is used to determine which line the word should be on. For example, all words beginning with "\a" should be on the same line as other words beginning with "\a" or "a". In the same way, all words beginning with "\b" should be on the same line as other words beginning with "\b" or "b" but on a different line from those starting with "\a".
MASM_LANG
Language flag for: Microsoft Assembly
MATLAB_LANG
Language flag for: MATLAB
NASM_LANG
Language flag for: Netwide Assembly
PASCAL_LANG
Language flag for: Pascal
PERL_LANG
Language flag for: Perl
PHP_LANG
Language flag for: PHP
Note: the .php file extension should be listed in the HTML wordfile to support multi-language embedded PHP highlighting. This will not adversely affect standalone PHP files.
PLB_LANG
Language flag for: PLB
PUREBASIC_LANG
Language flag for: PureBasic
PYTHON_LANG
Language flag for: Python
RUBY_LANG
Language flag for: Ruby
SQL_LANG
Language flag for: SQL
VBSCRIPT_LANG
Language flag for: VBScript
VB_LANG
Language flag for: Visual Basic
XML_LANG
Language flag for: XML
XSL_LANG
Language flag for: XSL
Line comments can be defined with the following syntax, typically placed on line 1 of the wordfile:
Line Comment = #
/Line Comment = #
(if on its own line in wordfile)
The above would cause all text following a "#" character to be colored as a comment until the end of the line.
Line comments must be 5 characters or less. If less than 5 characters and on the first line of the wordfile, the characters must be followed by a space.
You can define a second set of line comments with the following syntax:
Line Comment Alt = //
/Line Comment Alt = //
(if on its own line in wordfile)
The above would cause all text following "//" to be colored as a comment until the end of the line.
Some languages may require a space follow the line comment character. To facilitate this, the following syntax is available:
Line Comment Num = xCC
...where x specifies the number of characters (1 to 5) and immediately following are the characters to be used as line comments. In the example above, x would be 3 since the line comment would be "CC " (note the space after "CC").
(string literals here)