1.5 KiB
1.5 KiB
AGPascalTokenizer
Tokenizer Library for Delphi/FPC. Based on PyPascalTokenizer work by Artem Gavrilov.
API
TToken struct
TToken is a record type of:
- Text:
stringwith token text. - &begin:
TTokenizerPoswith start position of token. - &end:
TTokenizerPoswith end position of token. - ended:
booleanflag, true if it was the last token.
Has Create constructor with all values.
TTokenizerPos
record, saves position of token if format:
- x:
integerplatform-depend-base (NEXTGEN) character index in line. - y:
integer0-based line index.
Class PasTokenizer
Main class of tokenizer.
- s:
TStringsprivate, use constructor. List of source code strings. - get_next(): function, returns
TToken. Get next token and change end pos - read_next(): function, not implemented, get next token, but don't change end pos.
- is_ended(): function, not implemented, check if text ended.
Has constructor Create with s param.
Class PasTokenizerStack
Not implemented.
Class PasTokenizerParallelStack
Not implemented.
Utils
Helper functions to analyze token text.
- is_name(s:
string):booleanCheck for valid identifier (can be reserved word too). - is_comment(s:
string):booleanCheck for valid comment. - is_string(s:
string):booleanCheck for string constant.