Automatic Colorization Files
SPFLite can display source files with keywords and delimiters automatically highlighted in various colors to assist in the readability of source code. To do this, SPFLite requires an Automatic Colorization file, which describes the particular source language (e.g. reserved words, delimiters used, comment indicators, etc.)
When the PROFILE option HILITE AUTO ON is chosen, (See the HILITE command) SPFLIte will look for an Automatic Colorization file to use in the colorization process. If no matching Automatic Colorization file can be found, the file will be displayed as if colorization had not been requested. Automatic Colorization is based on the file extension of the file being edited.
For example, if editing a file MYSOURCE.BAS (a BASIC source program), SPFLIte will look in the \SPFlite\AUTO\ data directory for an Automatic Colorization file called BAS.AUTO to use to control the colorize process. Note the file extension (BAS) is used as the filename appended with the file type of .AUTO. Similarly, for a C++ source program stored with an extension of .cpp, SPFLite would look for the file CPP.AUTO.
Many times, the source for one language is stored in a variety of file types (Header, Include, Macro, etc.) which would normally mean separate AUTO files for each file type, a real maintenance nuisance. The SPFLIte Profile support allows you to 'point' a file type's profile to another already-existing profile. This way, all aspects of customization for a file type can be shared by other file types. This is performed by utilizing the PROFILE command option USING to point at the base, shared profile. Automatic Colorization support also follows the same sharing link and will use the AUTO Colorization file of the common profile.
The SPFLite web site has a down-loadable ZIP file containing a set of sample Colorization files for some of the common types. Note these files are NOT to be considered exact and complete for any of the languages provided. I created these very quickly from some keyword lists located on the web and they have received little or no real testing. The only one I'm fairly sure of is PowerBasic.AUTO since that is my language of choice.
As of Version 10, AUTO files no longer specify the actual colors to be used. The former SCHEME statements are no longer used, and are now simply ignored. Similarly the NORMHI, NORMLO, LINEHI, and LINELO are ignored.
The actual colors used by each SCHEME are now specified in OPTIONS -> SCHEMES - where it is now simpler to specify since it displays the result of your choices immediately.
This means the sample files are simpler to customize to your color preferences.
As well as colorization support, SPFLite can be requested to capitalize all language keywords defined in the .AUTO file. For some computer languages, this can assist readability greatly. Note the uppercasing is done only during screen display, the actual text itself is not altered. Actual text changing can be done, See AUTOCAPS for more information on permanently altering the text itself.
To identify which keywords specified in the AUTO file are to be capitalized (it would be unusual to capitalize every keyword defined in the AUTO file), all that is needed is to change the WORD directive to AUTOCAPS..
For example, if the language keywords were previously controlled by a
WORD 1 FOR
it would now be specified as
AUTOCAPS 1 FOR
- Locate the appropriate sample file for your language, copy it to the SPFLite \AUTO Data folder. If you are unsure of what directory this is, simply enter the OPTION command and at the bottom of the dialog box it will display the location of the SPFLite INI file. The AUTO colorize control files should be placed in the \AUTO folder within this directory. Ensure the base filename equals the normal extension used for the source. For example, if using PowerBasic as I do, you would copy and rename PowerBasic.AUTO to BAS.AUTO.
- Examine the SCHEME numbers used by the sample file and decide how this 'fits' with the SCHEMES you have specified in OPTIONS -> SCHEMES. Then simply alter the Scheme numbers in the WORD statements to your choice in SCHEMEs.
The structure is fairly simple (described below) and it should be easy to create or update these for any language. Should you update any of these, or create new ones for other languages, I encourage you to send them in to me; I will add them to the collection and make them available for all users.
Automatic Colorization files consist of either:
- comments (blank lines, or lines starting with a ; in position 1)
- definition statements
As of Version 10, the following Statement types are obsoleted. If present, they will be ignored:
Note: A sample macro has been made available (AUTOCnvt) to simplify converting Pre-Version 10 AUTO files to the new format. Simply edit the AUTO file, and enter AUTOCnvt on the command line. The macro will not remove any comment lines, so if there are comment lines present describing your old SCHEME usage, you will need to manually review / delete them.
COMMENTn sn start end
EXCLUDE col string
The EXCLUDE statement request that all text lines which match the specified criteria be excluded from further colorization processing. They will be displayed under control of the Normal Text Lo definition.
The col operand specifies a column number in which to look for the string operand; a match will cause the line to be excluded. If the col operand is coded as zero, the string operand will be scanned for anywhere within the text line.
You may code up to 10 EXCLUDE statements.
INCLUDE col string
The INCLUDE statement request that only text lines which match the specified criteria be passed on for further colorization processing. Lines which fail all INCLUDE statement selection will be displayed under control of the Normal Text Lo definition
The col operand specifies a column number in which to look for the string operand; a match will cause the line to be included. If the col operand is coded as zero, the string operand will be scanned for anywhere within the text line.
You may code up to 10 INCLUDE statements.
Note: If both EXCLUDE and INCLUDE statements are present, EXCLUDE processing is performed first, followed by INCLUDE processing.
The sn operand specifies the Scheme number to be used for the display of quoted literal strings.
The sn operand specifies the Scheme number to be used for the display of literal strings which are not identified as a keyword, and contain only numeric characters. Numeric characters are considered to be 0-9, period and comma.
Note if the period or comma are also specified as delimiters in the DELIMS string, the DELIMS specification will take precedence. For example if the comma is a delimiter, the string 123,456 will be treated as a numeric string 123, followed by a comma delimiter, followed by a numeric string 456.
If the NUMERIC statement is not provided, Numeric strings will be displayed under control of the Normal Text Lo definition
MIXEDCASE yes | no
Some computer languages are sensitive to the case of the keywords and can have duplicate keywords that have different meaning depending on their case. (e.g. void and Void in Java) If MIXEDCASE YES is specified, then the keyword search will be sensitive to the case of the words. If the default MIXEDCASE NO is specified, keywords will be searched for regardless of case.
WORD sn string
AUTOCAPS sn string
The WORD / AUTOCAPS statements define the reserved words for the particular language.
The sn operand refers to the Scheme number (defined in Options -> Schemes) used to display the word. Different Scheme numbers may be used to classify reserved words into various categories.
When AUTOCAPS is used instead of WORD, it requests uppercasing of the specified keyword when it is detected.
The string specifies the actual reserved word. No embedded blanks are allowed, use multiple WORDs if needed.
Note: Each character entered in the DELIMS statement should be entered also with a WORD statement.
; SPFLite colorize file for DOS Batch files
COMMENT1 1 REM 0 Either REM
COMMENT2 1 :: 1 or :: indicate comments
WORD 6 (
WORD 6 )
WORD 3 ,
WORD 3 .
WORD 3 :
WORD 3 =
WORD 3 @
WORD 4 aux Reserved words
WORD 4 com1
WORD 4 com2
WORD 4 com3
WORD 4 com4
WORD 4 con
WORD 4 lpt1
WORD 4 lpt2
WORD 4 lpt3
WORD 4 prn
AUTOCAPS 3 call
AUTOCAPS 3 cd
AUTOCAPS 3 defined
AUTOCAPS 3 dir
AUTOCAPS 3 do
AUTOCAPS 3 echo
AUTOCAPS 3 else
AUTOCAPS 3 endlocal
AUTOCAPS 3 equ
AUTOCAPS 3 errorlevel
AUTOCAPS 3 exist
AUTOCAPS 3 exit
AUTOCAPS 3 for
AUTOCAPS 3 geq
AUTOCAPS 3 goto
AUTOCAPS 3 gtr
AUTOCAPS 3 if
AUTOCAPS 3 in
AUTOCAPS 3 leq
AUTOCAPS 3 lss
AUTOCAPS 3 neq
AUTOCAPS 3 not
AUTOCAPS 3 nul
AUTOCAPS 3 pause
AUTOCAPS 3 set
AUTOCAPS 3 setlocal
AUTOCAPS 3 shift
Created with the Personal Edition of HelpNDoc: Generate Kindle eBooks with ease