Declaration¶
Source position: fpexprpars.pp line 61
type
TFPExpressionScanner = class(TObject)
FSource: AnsiString;
LSource: Integer;
FPos: Integer;
FChar: PAnsiChar;
FToken: AnsiString;
FTokenType: TTokenType = (ttPlus,ttMinus,ttLessThan,ttLargerThan,ttEqual,ttDiv,
ttMod,ttMul,ttLeft,ttRight,ttLessThanEqual,
ttLargerThanEqual,ttunequal,ttNumber,ttString,
ttIdentifier,ttComma,ttAnd,ttOr,ttXor,ttTrue,ttFalse,
ttNot,ttif,ttCase,ttPower,ttEOF);
public
constructor Create;
function GetToken : TTokenType;
property Token: AnsiString; {r}
property TokenType: TTokenType; {r}
property Source: AnsiString; {rw}
property Pos: Integer; {r}
property CurrentChar: AnsiChar; {r}
end;
Inheritance¶
Description¶
The TFPExpressionScanner class performs lexical analysis on expression strings, breaking them into tokens that can be consumed by the expression parser. It handles the low-level details of character recognition, string parsing, and token classification.
The scanner recognizes all token types defined in TTokenType including operators, literals, identifiers, keywords, and delimiters.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| CurrentChar read only | public | The current character being processed |
| Pos read only | public | Current position in the source string |
| Source | public | The source expression string to scan |
| Token read only | public | The text of the current token |
| TokenType read only | public | The type of the current token |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Create | public | Create a new expression scanner |
| GetToken | public | Get the next token from the source expression |
Fieldss¶
| Member | Visibility | Description |
|---|---|---|
| FChar | default | |
| FPos | default | |
| FSource | default | |
| FToken | default | |
| FTokenType | default | |
| LSource | default |