Simple Pascal tokenizer.
TOKEN_TYPE_NAMES: array[TTokenType] of string =
( 'whitespace', 'comment ((**)-style)', 'comment ({}-style)',
'comment (///-style)',
'comment (//-style)', 'identifier', 'number', 'string', 'symbol',
'directive', 'reserved word', 'AT&T assembler register name'); |
TokenCommentTypes: set of TTokenType =
[ TOK_COMMENT_PAS, TOK_COMMENT_EXT,
TOK_COMMENT_HELPINSIGHT,
TOK_COMMENT_CSTYLE ]; |
SymbolNames: array[TSymbolType] of string =
( '+', '-', '*', '/', '=', '<', '<=', '>', '>=', '[', ']', ',',
'(', ')', ':', ';', 'ˆ', '.', '@', '$', ':=', '..', '**', '\' ); |
KeyWordArray: array[Low(TKeyword)..High(TKeyword)] of string =
('x',
'AND', 'ARRAY', 'AS', 'ASM', 'BEGIN', 'CASE', 'CLASS', 'CONST',
'CONSTRUCTOR', 'DESTRUCTOR', 'DISPINTERFACE', 'DIV', 'DO', 'DOWNTO',
'ELSE', 'END', 'EXCEPT', 'EXPORTS', 'FILE', 'FINALIZATION',
'FINALLY', 'FOR', 'FUNCTION', 'GOTO', 'IF', 'IMPLEMENTATION',
'IN', 'INHERITED', 'INITIALIZATION', 'INLINE', 'INTERFACE',
'IS', 'LABEL', 'LIBRARY', 'MOD', 'NIL', 'NOT', 'OBJECT', 'OF',
'ON', 'OR', 'PACKED', 'PROCEDURE', 'PROGRAM', 'PROPERTY',
'RAISE', 'RECORD', 'REPEAT', 'RESOURCESTRING', 'SET', 'SHL',
'SHR', 'STRING', 'THEN', 'THREADVAR', 'TO', 'TRY', 'TYPE',
'UNIT', 'UNTIL', 'USES', 'VAR', 'WHILE', 'WITH', 'XOR'); |
StandardDirectiveArray:
array[Low(TStandardDirective)..High(TStandardDirective)] of PChar =
('x',
'ABSOLUTE', 'ABSTRACT', 'APIENTRY', 'ASSEMBLER', 'AUTOMATED',
'CDECL', 'CVAR', 'DEFAULT', 'DISPID', 'DYNAMIC', 'EXPERIMENTAL', 'EXPORT', 'EXTERNAL',
'FAR', 'FORWARD', 'GENERIC', 'HELPER', 'INDEX', 'INLINE', 'MESSAGE', 'NAME', 'NEAR',
'NODEFAULT', 'OPERATOR', 'OUT', 'OVERLOAD', 'OVERRIDE', 'PASCAL', 'PRIVATE',
'PROTECTED', 'PUBLIC', 'PUBLISHED', 'READ', 'REFERENCE', 'REGISTER',
'REINTRODUCE', 'RESIDENT', 'SEALED', 'SPECIALIZE', 'STATIC',
'STDCALL', 'STORED', 'STRICT', 'VIRTUAL',
'WRITE', 'DEPRECATED', 'SAFECALL', 'PLATFORM', 'VARARGS', 'FINAL'); |
SymbolNames: array[TSymbolType] of string =
( '+', '-', '*', '/', '=', '<', '<=', '>', '>=', '[', ']', ',',
'(', ')', ':', ';', 'ˆ', '.', '@', '$', ':=', '..', '**', '\' ); |
Symbols as strings. They can be useful to have some mapping TSymbolType -> string, but remember that actually some symbols in tokenizer have multiple possible representations, e.g. "right bracket" is usually given as "]" but can also be written as ".)".
|
KeyWordArray: array[Low(TKeyword)..High(TKeyword)] of string =
('x',
'AND', 'ARRAY', 'AS', 'ASM', 'BEGIN', 'CASE', 'CLASS', 'CONST',
'CONSTRUCTOR', 'DESTRUCTOR', 'DISPINTERFACE', 'DIV', 'DO', 'DOWNTO',
'ELSE', 'END', 'EXCEPT', 'EXPORTS', 'FILE', 'FINALIZATION',
'FINALLY', 'FOR', 'FUNCTION', 'GOTO', 'IF', 'IMPLEMENTATION',
'IN', 'INHERITED', 'INITIALIZATION', 'INLINE', 'INTERFACE',
'IS', 'LABEL', 'LIBRARY', 'MOD', 'NIL', 'NOT', 'OBJECT', 'OF',
'ON', 'OR', 'PACKED', 'PROCEDURE', 'PROGRAM', 'PROPERTY',
'RAISE', 'RECORD', 'REPEAT', 'RESOURCESTRING', 'SET', 'SHL',
'SHR', 'STRING', 'THEN', 'THREADVAR', 'TO', 'TRY', 'TYPE',
'UNIT', 'UNTIL', 'USES', 'VAR', 'WHILE', 'WITH', 'XOR'); |
all Object Pascal keywords
|
StandardDirectiveArray:
array[Low(TStandardDirective)..High(TStandardDirective)] of PChar =
('x',
'ABSOLUTE', 'ABSTRACT', 'APIENTRY', 'ASSEMBLER', 'AUTOMATED',
'CDECL', 'CVAR', 'DEFAULT', 'DISPID', 'DYNAMIC', 'EXPERIMENTAL', 'EXPORT', 'EXTERNAL',
'FAR', 'FORWARD', 'GENERIC', 'HELPER', 'INDEX', 'INLINE', 'MESSAGE', 'NAME', 'NEAR',
'NODEFAULT', 'OPERATOR', 'OUT', 'OVERLOAD', 'OVERRIDE', 'PASCAL', 'PRIVATE',
'PROTECTED', 'PUBLIC', 'PUBLISHED', 'READ', 'REFERENCE', 'REGISTER',
'REINTRODUCE', 'RESIDENT', 'SEALED', 'SPECIALIZE', 'STATIC',
'STDCALL', 'STORED', 'STRICT', 'VIRTUAL',
'WRITE', 'DEPRECATED', 'SAFECALL', 'PLATFORM', 'VARARGS', 'FINAL'); |
Object Pascal directives
|