Configure Syntax Highlighting

Contents  Previous  Next

 

Menu: Configure > Syntax Highlighting

 

Default Shortcut Key: none

 

Macro function: ConfigureSyntaxHighlighting()

 

The Configure Syntax Highlighting command is used to specify the information needed by Boxer to perform on-screen Color Syntax Highlighting and Color Syntax Printing and for its other syntax-related features.  Boxer is supplied with pre-defined syntax information for many popular languages.  The Configure Syntax Highlighting command can be used to edit any of the pre-defined syntax information, or to define the syntax for new languages.

 

The dialog box below is used to define syntax information:

 

 

ConfigureSyntaxHighlighting

 

 

Boxer determines whether to perform Syntax Highlighting on the current file according to three factors.

 

The extension of the current file must be one for which syntax information has been defined
The language must be configured to be 'active' on the Configure Syntax Highlighting form (see the Syntax Highlighting is active for this language checkbox)
Syntax Highlighting must be enabled on the View menu

 

Languages

New Button

Use the New button to create a Syntax Highlighting entry for a new language.  An entry called New Language will be created which can be changed with the Rename button.  Up to 100 different languages can be defined.

 

Rename Button

Use the Rename button to change the name of the selected language.  A pop-up dialog box will appear for entering the new name.  The name used will not appear anywhere other than in the list of languages.

 

Copy Button

Use the Copy button to create a copy of the currently selected language entry.  The name 'Copy of...' will be used and can be changed with the Rename button.  The Copy function can save time when defining a new language which has similar characteristics to an existing language.

 

Import Button

The Import function can be used to import syntax information in the format used by our BOXER/DOS, BOXER/TKO and BOXER/OS2 products.  If you have created custom syntax information with our other editors, that information can be imported directly by Boxer for Windows.  First isolate the syntax information blocks which are to be imported by copying them from the DEFAULT.CFG file into a temporary file.  Then click the Import button and specify that file as the name of the file to be imported.  Boxer will read the named file and automatically convert the syntax information into the new format.  Because the old information format did not contain a name field, you will be prompted during conversion to supply a name for each language as it is imported.

 

The Import function can also be used to import a syntax information block which has been extracted from the Syntax.ini file, in which Boxer stores its syntax information.  This procedure may be useful for passing syntax information from PC to PC or for installing new syntax information files as they become available from Boxer Software.

 

Delete Button

Use the Delete button to delete the currently selected language.  A confirmation is required before the deletion occurs.  If a language is accidentally deleted, you can recover it by using the Cancel button.

 

If you simply wish to disable Syntax Highlighting for a particular language, use the Syntax Highlighting is active for this language checkbox described below.

 

Delete All Button

Use the Delete All button to delete ALL languages.  A confirmation is required before the deletions will occur.  You can recover from an accidental deletion by using the Cancel button.

 

USE THIS COMMAND ONLY IF YOU WISH TO DELETE ALL SYNTAX INFORMATION.

 

If you wish to disable syntax highlighting for all languages, use the Perform Syntax Highlighting option on the Configure | Preferences | Display options page.  That option is non-destructive.

 

Parameters

The Parameters listbox contains all of the parameters which can be defined for a given language.  Each of these parameters is discussed below:

 

File Extension(s)

This parameter is used to designate the file extensions which belong to the language being defined.  The file extensions are named one per line, with a leading period (.).  Be sure to include all file extensions for which highlighting is desired, such as header files, and include files.  If a file type commonly goes by two names, such as .HTM and .HTML, be sure to include both extensions to guarantee that highlighting will be performed on all files desired.

 

bm2To designate that highlighting is to be applied to files without an extension, use a lone period (.) on a line.

 

Reserved Words 1, 2, 3

These parameters are used to list the reserved words (sometimes known as keywords) which are to be highlighted.  Reserved words are entered one word per line.  No care need be taken to preserve an alphabetic sort, since sorting is performed automatically by Boxer.

 

If reserved words are to be considered case-sensitive, they should be entered in the case which is recognized by the language.

 

Boxer permits up to 3 sets of reserved words to be defined, and each set can be distinctly colored (see Configure | Colors).  Reserved Words 1 might be used for language keywords, such as for, if, while, loop, etc.  Reserved Words 2 might be used for preprocessor directives such as #include, #define, #ifdef, etc.  Reserved Words 3 might be used for library functions such as strcpy, strlen, strcat, etc.

 

bm2The wildcard characters '?' and '*' are no longer recognized when defining reserved words as they were in our earlier products.  We found that very few languages need this feature, while some popular languages (such as Perl) need to use '?' and '*' within their reserved words.

 

Reserved Word Symbols

This parameter is used to designate those symbols which are permissible within a reserved word or user variable, so that Boxer does not mistakenly highlight a phrase which happens to begin with a reserved word.  An example will help clarify:

 

If 'read' is a reserved word, and you want to ensure that the first four letters of a variable named 'read_my_data_file' are not mistakenly highlighted as a reserved word, designate the underscore in the Reserved Word Symbols parameter.  This tells Boxer that the underscore is allowed to appear in a reserved word or user variable, and that it is not a valid separator.

 

Alphanumeric characters are automatically permissible within reserved words.  Add any additional characters which require similar treatment, one per line.

 

Symbol Characters

This parameter is used to designate those characters which are to receive Symbol coloration.  Designate one symbol per line.

 

String Delimiters

This parameter is used to designate the character(s) which are used to delimit strings.  These characters vary from language to language, but are typically the double quote and/or single quote characters.  Designate one symbol per line.

 

bm2Boxer does not support the highlighting of strings that extend across more than one line.  If you must highlight such strings, and if the language in question uses opening and closing string delimiters that are unique to one another, then you may wish to define these sequences as though they were Block Comments.  Strings would then be colorized in Comment color, but multi-line strings would then be handled.

 

Literal Characters

This parameter is used to designate the character which is used to remove significance from an opening or closing String Delimiter character while within a string.  Typically this is the backslash (\) character.

 

Open Tag

This parameter is used to designate the character which opens a tag for languages such as HTML, XML and SGML.  These languages differ from conventional programming languages in that all 'code' within the file appears within markup tags, and all text outside of markup tags is considered to be the text of the document.  For all other conventional programming languages, this parameter should be left blank.

 

Close Tag

This parameter is used to designate the character which closes a tag for languages such as HTML, XML and SGML.  These languages differ from conventional programming languages in that all 'code' within the file appears within markup tags, and all text outside of markup tags is considered the text of the document.  For all other conventional programming languages, this parameter should be left blank.

 

Open Block Comment

This parameter is used to designate the sequence (or sequences) which are used to open a multi-line block comment.  Place each sequence on its own line.

 

Close Block Comment

This parameter is used to designate the sequence (or sequences) which are used to close a multi-line block comment.  Place each sequence on its own line.

 

Block Comment Search

In order to properly handle multi-line comment blocks, Boxer must at times search backward in the current file to determine if a multi-line comment remains open from a line which is off-screen. This parameter designates the number of lines which should be searched during this effort. Higher values will result in better display accuracy when large block comments are used, but can slow screen display at other times.

 

End of Line Comment

This parameter is used to the designate the sequence (or sequences) which are used to open an end-of-line comment.  An end-of-line comment persists from the point it is opened until the end-of-line.  Place each End of Line Comment sequence on its own line.

 

bm2For each End of Line Comment defined, a corresponding End of Line Comment Column must also be definedSee the paragraph immediately below for details.

 

bm1If an End of Line Comment sequence includes a Space character, you'll find that comments in your text will not be not be colorized when the View Visible Spaces option is in use.  This occurs because the Space character in the End of Line Comment sequence does not match the value of the visible space character used on screen.  You can remedy this by adding a duplicate sequence that uses the visible space character in place of the Space.  You can find the value of the visible space character on the Configure | Preferences | Display dialog page.  This character must be entered into the edit dialog with a special technique; see the Help topic Inserting Special Character for details.  Finally, remember to add the accompanying End of Line Comment Column parameter to mate with the duplicate End of Line Comment sequence.

 

End of Line Comment Column

This parameter is used to designate the column in which an associated End of Line Comment should be recognized.  Some languages require that an End of Line Comment sequence be recognized only when it appears in a particular column, such as column 1 or column 7.

 

Enter the required column value, or enter 0 (zero) if the End of Line Comment sequence is to be recognized in all column positions.  When multiple End of Line Comment sequences have been defined, each sequence must have a corresponding End of Line Comment Column entry, in the same list position as its mate.

 

Languages such as Clipper, dBase and FoxPro require that the asterisk (*) be recognized as an end of line comment when the symbol appears as the first non-blank character in the line.  In other contexts the asterisk must retain its conventional meaning as the multiply symbol.  This logic can be requested in Boxer (for the asterisk or any other End of Line Comment sequence) by using a value of -1 for the End of Line Comment Column parameter.

 

Tab Stops

Use this parameter to designate tab stop settings for files matching the File Extensions parameter of this language configuration.  See the View | Tab Display Size command for more information about variable width tab stops.

 

Help File

This parameter can be used to designate an associated Windows help file (.HLP or .CHM) for the language being defined.  Once the help file has been defined for a language, context-sensitive help for the word beneath the text cursor can be obtained by issuing the Help command, which is ordinarily assigned to F1.  To obtain Boxer's native Help instead of language-specific help, simply move the text cursor into an open area of text before requesting Help.  The full filepath to the reference document must be supplied.

 

This parameter can also be used to designate an HTML-format reference file, or indeed any type of reference document which the operating system knows how to open based on its file extension.  For example, if you have a Microsoft Word .DOC file or Adobe Acrobat .PDF file that details the syntax of a language, these too can be named in the Help File parameter for that language. 

 

bm2The ability to display context-sensitive help for the word beneath the text cursor is available only when launching WinHelp (.HLP) and HTML Help (.CHM) files, and not when .HTML, .PDF, .DOC and other files are used.

 

Syntax Spell

This parameter is used to control how the Active Spell Checking feature should be applied to files which are syntax highlighted.  A value of 0, 1, 2 or 3 can be used, with the effect being as follows:

 

0: Active Spell Checking will not be performed when editing syntax highlighted files

1: Active Spell Checking will be performed only within comments and quoted strings

2: Active Spell Checking will be performed within comments, quoted strings and 'normal' text

3: Active Spell Checking will be performed only on 'normal' text

 

Reserved Words are case sensitive

Use this option to designate whether the reserved word lists should be treated as case-sensitive.  If this option is checked, a reserved word must match a list entry exactly in order to be highlighted.  If this option is not checked, a reserved word will match a list entry even when its case is different.

 

This option should be selected to correspond to the requirements of the language being defined, so that Boxer can provide accurate visual feedback when a reserved word has been mistyped.

 

Syntax Highlighting is active for this language

Use this option to enable or disable highlighting for the current language.  This option is the simplest way to disable syntax highlighting for a single language.  One reason to disable a language would be to cure a file extension conflict with another language.

 

bm1Use the View | Syntax Highlighting command to quickly disable syntax highlighting for all languages.

 

Notes and Tips

bm2In addition to on-screen Syntax Highlighting, the language information defined with this command is also used for the following commands and features:

 

Color Syntax Printing
Monochrome Syntax Printing
Syntax Spelling
Active Spell Checking
Auto-Complete
Syntax Matching
Comment
Uncomment

 

bm2If you define syntax information for new languages, or if you make additions or corrections to our pre-defined languages, please consider sending your information to us.  This will allow us to keep our information current, and make it available to other Boxer users.  Syntax information can be sent to support@boxersoftware.com. Thank you.

 

bm1Some users have reported using Syntax Highlighting as a teaching aid for young readers.  One customer told of how she had created a syntax definition in which common nouns, verbs and adjectives were assigned to each of Boxer's three reserved word classes.  Then, when a file with the required file extension was displayed, each part of speech would be highlighted in its own color.  Another user reported creating a 'language' definition so that headings within a dense parts list would be highlighted in color.  As you can see, the uses for Syntax Highlighting extend far beyond its utility to programmers.

 

bm2The highlighting of Java and Active Server code poses special problems for Boxer.  These languages can include HTML markup tags as well as sections of conventional procedural style code.  At times the open angle bracket (<) is a less-than symbol, at other times it could open an HTML markup tag.  A rigorous handling of Java code would require that a language parser be used, which is not the method by which Boxer's (general purpose) highlighting is performed.  Therefore, Boxer's default syntax information for Java has been designed to highlight Java program code, but not to highlight any HTML markup tags which might appear therein.