home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 January
/
pcwk_01_1999.iso
/
Top100sh
/
Comm
/
Jterm106
/
_SETUP.1
/
JTermScript.txt
(
.txt
)
< prev
next >
Wrap
LaTeX Document
|
1998-07-21
|
18KB
|
292 lines
#define pt_DEFAULT 0
#define pt_COMMENT_LINE 1
#define pt_IDENTIFIER 2
#define pt_STRING 3
#define pt_NUMBER 4
#define pt_COMMENT 5
#define pt_HEXNUMBER 6
#define pt_RESERVED 7
#define pt_COMMENT_BRACE 8
#define pt_COMMENT_STAR 9
#define pt_SYMBOL 10
#define pt_CHAR_DECIMAL 11
#define pt_CHAR_HEX 12
#define pt_SEMICOLON 20
#define pt_PROPERTY 21
#define pt_DEFAULT_TOKEN 22
#define pt_READ 23
#define pt_WRITE 24
#define pt_STORED 25
#define pt_EXPORTS 26
#define pt_NAME 27
#define pt_INDEX 28
#define pt_RESIDENT 29
#define _non_alpha_ '[^_A-Za-z0-9]'
#define _all_chars_ '[\x00-\xFF]'
#define _dec_digit_ '[0-9]'
#define _hex_digit_ '[a-fA-F0-9]'
#define _no_chars_ '[]'
#define _dont_care_ _all_chars_
#define _DEFAULT_BACKGROUND clWhite
#define _DEFAULT_FOREGROUND clBlack
#define ss_START 0
#define ss_PROPERTY 1
#define ss_EXPORTS 2
//--------------------------------------------------------------------------------------------------------------------
// %%language section
// Header section. Describes the textual name of the language, case sensitivity and options used by the language.
%%language
Name = 'J-Term Pro Script'
Case = __INSENSITIVE
Options = __DEFAULT_OPTIONS
WordWrapColumn = _EDGE
Gutter = _DEFAULT_GUTTER
Anchor = _DEFAULT_START_ANCHOR
ExampleText = 'var a: string;\n\
\ b: integer;\n\
\begin\n\
\ b := 0;\n\
\ a := \'\';\n\
\ while b < 10 do begin\n\
\ a := a + IntoToStr(b);\n\
\ inc(b);\n\
\ end;\n\
\end.\n'
EditableStyles ('Reserved word', pt_RESERVED),
('Comment', pt_COMMENT),
('Identifier', pt_IDENTIFIER),
('String', pt_STRING),
('Number', pt_NUMBER),
('Symbols', pt_SYMBOL),
('Default', pt_DEFAULT)
//--------------------------------------------------------------------------------------------------------------------
// %%words section
// Used to specify simple languge keywords. These are constant value lexemes that always contain the same characters
// and only require the end style to be specified. The words present here will always be tried first. If they fail
// then the entries in the %%tokens section will be allowed to try a match.
// %%words table entries have 3 columns:
// Column 1 Quoted string giving the characters that make up the word
// Column 2 Quoted string that specifies how the word is terminated
// Column 3 Token value returned when word is recognised
%%words
'\/\/' _dont_care_ pt_COMMENT_LINE
'{' _dont_care_ pt_COMMENT_BRACE
'(*' _dont_care_ pt_COMMENT_STAR
':=' _dont_care_ pt_SYMBOL
'+' _dont_care_ pt_SYMBOL
'-' _dont_care_ pt_SYMBOL
'*' _dont_care_ pt_SYMBOL
'\/' _dont_care_ pt_SYMBOL
'=' _dont_care_ pt_SYMBOL
'<>' _dont_care_ pt_SYMBOL
'<' _dont_care_ pt_SYMBOL
'>' _dont_care_ pt_SYMBOL
'<=' _dont_care_ pt_SYMBOL
'>=' _dont_care_ pt_SYMBOL
'(' _dont_care_ pt_SYMBOL
')' _dont_care_ pt_SYMBOL
'[' _dont_care_ pt_SYMBOL
']' _dont_care_ pt_SYMBOL
'.' _dont_care_ pt_SYMBOL
'..' _dont_care_ pt_SYMBOL
'^' _dont_care_ pt_SYMBOL
',' _dont_care_ pt_SYMBOL
';' _dont_care_ pt_SEMICOLON [ss_START ss_PROPERTY]
':' _dont_care_ pt_SYMBOL
'@' _dont_care_ pt_SYMBOL
'#' _dec_digit_ pt_CHAR_DECIMAL
'#$' _hex_digit_ pt_CHAR_HEX
'and' _non_alpha_ pt_RESERVED
'array' _non_alpha_ pt_RESERVED
'begin' _non_alpha_ pt_RESERVED
'case' _non_alpha_ pt_RESERVED
'const' _non_alpha_ pt_RESERVED
'div' _non_alpha_ pt_RESERVED
'do' _non_alpha_ pt_RESERVED
'downto' _non_alpha_ pt_RESERVED
'else' _non_alpha_ pt_RESERVED
'end' _non_alpha_ pt_RESERVED
'false' _non_alpha_ pt_RESERVED
'file' _non_alpha_ pt_RESERVED
'for' _non_alpha_ pt_RESERVED
'forward' _non_alpha_ pt_RESERVED
'function' _non_alpha_ pt_RESERVED
'goto' _non_alpha_ pt_RESERVED
'if' _non_alpha_ pt_RESERVED
'in' _non_alpha_ pt_RESERVED
'label' _non_alpha_ pt_RESERVED
'mod' _non_alpha_ pt_RESERVED
'nil' _non_alpha_ pt_RESERVED
'not' _non_alpha_ pt_RESERVED
'of' _non_alpha_ pt_RESERVED
'or' _non_alpha_ pt_RESERVED
'procedure' _non_alpha_ pt_RESERVED
'program' _non_alpha_ pt_RESERVED
'record' _non_alpha_ pt_RESERVED
'repeat' _non_alpha_ pt_RESERVED
'set' _non_alpha_ pt_RESERVED
'string' _non_alpha_ pt_RESERVED
'then' _non_alpha_ pt_RESERVED
'to' _non_alpha_ pt_RESERVED
'true' _non_alpha_ pt_RESERVED
'type' _non_alpha_ pt_RESERVED
'until' _non_alpha_ pt_RESERVED
'var' _non_alpha_ pt_RESERVED
'while' _non_alpha_ pt_RESERVED
'with' _non_alpha_ pt_RESERVED
'packed' _non_alpha_ pt_RESERVED
'implementation' _non_alpha_ pt_RESERVED
'interface' _non_alpha_ pt_RESERVED
'unit' _non_alpha_ pt_RESERVED
'uses' _non_alpha_ pt_RESERVED
'as' _non_alpha_ pt_RESERVED
'on' _non_alpha_ pt_RESERVED
'asm' _non_alpha_ pt_RESERVED
'class' _non_alpha_ pt_RESERVED
'constructor' _non_alpha_ pt_RESERVED
'destructor' _non_alpha_ pt_RESERVED
'except' _non_alpha_ pt_RESERVED
'exports' _non_alpha_ pt_EXPORTS
'finalization' _non_alpha_ pt_RESERVED
'finally' _non_alpha_ pt_RESERVED
'inherited' _non_alpha_ pt_RESERVED
'initialization' _non_alpha_ pt_RESERVED
'inline' _non_alpha_ pt_RESERVED
'is' _non_alpha_ pt_RESERVED
'library' _non_alpha_ pt_RESERVED
'object' _non_alpha_ pt_RESERVED
'property' _non_alpha_ pt_PROPERTY
'raise' _non_alpha_ pt_RESERVED
'shl' _non_alpha_ pt_RESERVED
'shr' _non_alpha_ pt_RESERVED
'threadvar' _non_alpha_ pt_RESERVED
'try' _non_alpha_ pt_RESERVED
'xor' _non_alpha_ pt_RESERVED
'absolute' _non_alpha_ pt_RESERVED
'abstract' _non_alpha_ pt_RESERVED
'assembler' _non_alpha_ pt_RESERVED
'at' _non_alpha_ pt_RESERVED
'automated' _non_alpha_ pt_RESERVED
'cdecl' _non_alpha_ pt_RESERVED
'default' _non_alpha_ pt_DEFAULT_TOKEN [ss_PROPERTY]
'dispid' _non_alpha_ pt_RESERVED
'dynamic' _non_alpha_ pt_RESERVED
'external' _non_alpha_ pt_RESERVED
'index' _non_alpha_ pt_INDEX [ss_EXPORTS]
'message' _non_alpha_ pt_RESERVED
'name' _non_alpha_ pt_NAME [ss_EXPORTS]
'nodefault' _non_alpha_ pt_RESERVED
'override' _non_alpha_ pt_RESERVED
'pascal' _non_alpha_ pt_RESERVED
'private' _non_alpha_ pt_RESERVED
'protected' _non_alpha_ pt_RESERVED
'public' _non_alpha_ pt_RESERVED
'published' _non_alpha_ pt_RESERVED
'read' _non_alpha_ pt_READ [ss_PROPERTY]
'register' _non_alpha_ pt_RESERVED
'resident' _non_alpha_ pt_RESIDENT [ss_EXPORTS]
'resourcestring' _non_alpha_ pt_RESERVED
'stdcall' _non_alpha_ pt_RESERVED
'stored' _non_alpha_ pt_STORED [ss_PROPERTY]
'virtual' _non_alpha_ pt_RESERVED
'write' _non_alpha_ pt_WRITE [ss_PROPERTY]
//--------------------------------------------------------------------------------------------------------------------
// %%handler section
// The %%handler section gives rules to be applied once an entry in the %%words table has been recognised. Normally
// no further processing is required but sometimes a token starts with a fixed set of characters but may be followed
// by a character class rather than a known sequence.
// %%handler table entries have 4 columns:
// Column 1 Token value to be processed
// Column 2 Character specifier that follows recognised word
// Column 3 Quoted string specifying end sequence
// Column 4 Whether end sequence is part of lexeme
// The <character specifier> is defined as:
// Column 2 A single character specifier or pre-defined system character macro:
// _PASCAL_CHAR Pascal style character specifier
// _C_CHAR C style character specifier
// If the lexeme can optionally have these characters then append '?' to the end
// of the quoted string.
// Column 3 Up to 2 characters may be given as a sequence to terminate the lexeme.
// Characters are specified using a simplified regular expression. If this
// string is empty then the lexeme will never be matched.
%%handler
pt_COMMENT_LINE '[^\n]'? '\n' _discard_
pt_COMMENT_BRACE '[^}]'? '}' _use_
pt_COMMENT_STAR _all_chars_? '*)' _use_
pt_CHAR_DECIMAL _dec_digit_ '[^0-9]' _discard_
pt_CHAR_HEX _hex_digit_ '[^a-fA-F0-9]' _discard_
//--------------------------------------------------------------------------------------------------------------------
// %%tokens section
// Used to specify how to recognise non-fixed lexemes. Non-fixed lexemes are only tried if the table entries in the
// %%words section have failed. The non-fixed lexeme is defiened by 5 columns as below:
// Column 1 Token value
// Column 2 Single start character specifier
// Column 3 Single contains character specifier
// Column 4 End sequence specifier
// Column 5 Whether end sequence is part of lexeme
// Pre-defined token styles are implemented. If used they should be specified in Column 2. The implemented ones
// are:
// __STD_PASCALSTRING Pascal string -- starts with ' ands with ' and uses '' to represent
// ' within a string. Does not extend beywond end of line.
// __STD_IDENTIFIER Standard identifier. Starts with [_a-zA-Z], contains [_a-zA-Z0-9] and ends with
// a non-alpha numeric character that is not part of the lexeme
// __STD_NUMBER_OR_FP Integer or floating point constant of syntax:
// <Digit String> [ '.' <Digit string> ] [ e|E [+-] <Digit string> ]
%%tokens
pt_HEXNUMBER '$' '[0-9a-fA-F]' '[^0-9a-fA-F]' _discard_
pt_STRING __STD_PASCALSTRING
pt_IDENTIFIER __STD_IDENTIFIER
pt_NUMBER __STD_NUMBER_OR_FP
pt_DEFAULT '[\s\t\n]' '[\s\t\n]' '[^\s\t\n]' _discard_
//--------------------------------------------------------------------------------------------------------------------
// %%effects section
// Used to specify the default colors and font styles used for each token
// Column 1 Token value
// Column 2 Font styles
// Column 3 Foreground color
// Column 4 Background color
// Column 5 Optional column specifying whether map entry is a 'hotspot'
// Columns 1-4 must be completed for all rows, Column 5 defaults to non-hotspot.
%%effects
pt_DEFAULT [] _DEFAULT_FOREGROUND _DEFAULT_BACKGROUND
pt_IDENTIFIER [] _DEFAULT_FOREGROUND _DEFAULT_BACKGROUND
pt_STRING [] clMaroon _DEFAULT_BACKGROUND
pt_COMMENT [fsItalic] clPurple _DEFAULT_BACKGROUND
pt_RESERVED [fsBold] clNavy _DEFAULT_BACKGROUND
pt_NUMBER [] clGreen _DEFAULT_BACKGROUND
pt_SYMBOL [] _DEFAULT_FOREGROUND _DEFAULT_BACKGROUND
//--------------------------------------------------------------------------------------------------------------------
// %%map section
// Used to specify which entry in the %%effects table each token value uses. By default all token values map onto
// __DEFAULT_TOKEN which is defined as zero. Table has 2 columns:
// Column 1 Recognised token value
// Column 2 Map table entry (i.e. %%effects table entry)
// Normally the %%map table consists of identical value entries.
%%map
pt_IDENTIFIER pt_IDENTIFIER
pt_STRING pt_STRING
pt_HEXNUMBER pt_NUMBER
pt_NUMBER pt_NUMBER
pt_COMMENT pt_COMMENT
pt_COMMENT_LINE pt_COMMENT
pt_COMMENT_STAR pt_COMMENT
pt_COMMENT_BRACE pt_COMMENT
pt_RESERVED pt_RESERVED
pt_SYMBOL pt_SYMBOL
pt_SEMICOLON pt_SYMBOL
pt_PROPERTY pt_RESERVED
pt_READ pt_RESERVED
pt_WRITE pt_RESERVED
pt_DEFAULT_TOKEN pt_RESERVED
pt_STORED pt_RESERVED
pt_EXPORTS pt_RESERVED
pt_NAME pt_RESERVED
pt_INDEX pt_RESERVED
pt_RESIDENT pt_RESERVED
pt_CHAR_DECIMAL pt_STRING
pt_CHAR_HEX pt_STRING
%%states
pt_PROPERTY (+[ss_PROPERTY] -[ss_START])
pt_SEMICOLON (+[ss_START] -[ss_PROPERTY ss_EXPORTS])
pt_EXPORTS (+[ss_EXPORTS])