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 downloadable 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.
The sample files also contain a mixed bag of color schemes, depending on who submitted them. Personal color preferences can be beautiful to one person, and ugly as sin to another. Altering the scheme to your preference is fairly simple, only the SCHEME statements of the file need to be altered.
An extension to the colorize support is available which will capitalize all language keywords defined in the .AUTO file. For some computer languages, this can assist readability greatly.
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 add +100 to the SCHEME number.
For example, if the language keywords were previously controlled by a SCHEME like:
SCHEME 1 2 0 Scheme 1 - Green on Black
The statement would be re-coded as:
SCHEME 101 2 0 Scheme 1 - Green on Black (capitalized)
The WORD entries would still be coded with scheme number 1, you do not need to alter each WORD line to 101, SPFLite will properly match a WORD request for scheme 1 with a SCHEME definition of 101.
See AUTOCAPS for more information on turning this support ON and OFF.
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:
SCHEME n fg bg [abg]
You may specify up to 30 different color schemes to use in colorizing different parts of the source program. e.g. one scheme for comments, one for compiler directives, one for delimiters, etc. etc. The first operand of SCHEME ( the n) is the scheme number and should be a number from 0 through 30. Note that the SCHEME 0 is reserved for normal text which is anything other than what can be identified by the other definition statements. The fg and bg operands specify the foreground(text) and background colors for this particular scheme. The last parameter [abg] specifies the alternate background color, if you prefer to use that option. If not provided, the abg operand is assumed equal to the bg value.
The bg value for SCHEME 0 is also used, along with the NORMxx and LINExx values to display the non-text data portions of the screen.
The fg, bg and abg color values may be specified in any of the following forms. Use whatever format is more convenient for you to work in:
Normal Windows color numbers
0 Black 4 Red 8 Gray 12 Light red
1 Blue 5 Magenta 9 Light blue 13 Light magenta
2 Green 6 Brown 10 Light green 14 Yellow
3 Cyan 7 White 11 Light cyan 15 Bright white
BGR (Blue/Green/Red) Hex values
These should be entered as &hbbggrr where bb, gg, and rr are the HEX values respectively for Blue, Green, and Red, or in the new Bxbbggrr format. Example: A shade of dark green is Bx408000.
RGB (Red/Green/Blue) Hex values
These should be entered as Rxrrggbb where rr, gg, and bb are the HEX values respectively for Red, Green, and Blue. Example: A shade of dark green is Rx008040.
BGR (Blue/Green/Red) Decimal values
These should be entered as B=bbb,ggg,rrr where bbb, ggg, and rrr are the DECIMAL values respectively for Blue, Green, and Red. Example: A shade of dark green is B=64,128,0.
RGB (Red/Green/Blue) Decimal values
These should be entered as R=rrr,ggg,bbb where rrr, ggg, and bbb are the DECIMAL values respectively for Red, Green, and Blue. Example: A shade of dark green is R=0,128,64.
COMMENTn sn start end
Up to Nine comment definitions are supported COMMENT1 thru COMMENT9.
The sn operand refers to the SCHEME number used to display the comment. Each COMMENTn statement may reference different scheme's if desired, or the same scheme.
The start operand specifies the character (string) which indicates the beginning of comments.
The end operand can have one of three meanings:
Note: SPFLite does not support multi-line comments.
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 SCHEME 0 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 SCHEME 0 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 SCHEME statements are oriented to the editable text of your file, The NORMHI, NORMLO, LINEHI and LINELO statements control all the other screen data (the Command line, Scroll Amount, Line Numbers, etc.) Set each of these to one of the SCHEME values you have defined, it will use the FG (foreground) value from that SCHEME as the color to be used. NORMxx is used for the Command line, Scroll and COLS line, while LINExx is used for the line numbers. The background value for these settings will use the background specified for SCHEME 0. The sn operand specifies the desired SCHEME number.
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 in the default SCHEME 0.
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
The WORD statement defines the reserved words for the particular language.
The sn operand refers to the SCHEME number used to display the word. Different scheme numbers may be used to classify reserved words into various categories.
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
; You may use the following Basic color numbers
; 0 Black 4 Red 8 Gray 12 Light red
; 1 Blue 5 Magenta 9 Light blue 13 Light magenta
; 2 Green 6 Brown 10 Light green 14 Yellow
; 3 Cyan 7 White 11 Light cyan 15 Bright white
; or specify a Full Color value as &hbbggrr where bb, gg, and rr are the HEX
; values respectively for Blue, Green, and Red.
; e.g the above values are equivalent to:
; 0 &h000000 4 &h0000C4 8 &h808080 12 &h0000FF
; 1 &h800000 5 &h800080 9 &hFF0000 13 &hFF00FF
; 2 &h008000 6 &h004080 10 &h00FF00 14 &h00FFFF
; 3 &h808000, 7 &hC4C4C4 11 &hFFFF00 15 &hFFFFFF
; A good place to choose colors and get the equivalent hex values is:
SCHEME 0 7 0 Default scheme White on Black
SCHEME 1 2 0 Scheme 1 - Green on Black
SCHEME 2 14 0 2 - Yellow on Black
SCHEME 3 15 0 3 - Bright White on Black
SCHEME 4 3 0 4 - Cyan on Black
SCHEME 5 8 0
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 3 call .
WORD 3 cd .
WORD 4 com1 .
WORD 4 com2
WORD 4 com3
WORD 4 com4
WORD 4 con
WORD 3 defined
WORD 3 dir
WORD 3 do
WORD 3 echo
WORD 3 else
WORD 3 endlocal
WORD 3 equ
WORD 3 errorlevel
WORD 3 exist
WORD 3 exit
WORD 3 for
WORD 3 geq
WORD 3 goto
WORD 3 gtr
WORD 3 if
WORD 3 in
WORD 3 leq
WORD 4 lpt1
WORD 4 lpt2
WORD 4 lpt3
WORD 3 lss
WORD 3 neq
WORD 3 not
WORD 3 nul
WORD 3 pause
WORD 4 prn
WORD 3 set
WORD 3 setlocal
WORD 3 shift
Created with the Personal Edition of HelpNDoc: Free PDF documentation generator