Base class to handle the logic and lexing in a descendent recursive parser. More...
Public Member Functions | |
parse ($expr) | |
Start parsing of an expression. | |
Protected Member Functions | |
run () | |
Entry point to start parsing. | |
trimLeft () | |
Trim whitespaces at the current pointer. | |
acceptSym ($tokenlist) | |
Accept a symbol. | |
expectSym ($tokenlist) | |
Excpect a symbol, but fail if not availible. | |
acceptKeyword ($keywordlist=false, $case_insensitive=false, $numeric=false) | |
Accept a keyword, finished by a whitespace. | |
expectKeyword ($keywordlist=false, $case_insensitive=false, $numeric=false) | |
Excpect a keyword. | |
acceptString () | |
Accept a string. | |
expectString () | |
Expect a string. | |
acceptNum () | |
Accept a number, (only digits). | |
expectNum () | |
Except a number. | |
error ($msg) | |
Trigger a parser error, format the current position and throw an exception. | |
Protected Attributes | |
$expr | |
The expression to parse. | |
$ptr | |
The current position during parsing, as an integer. |
Base class to handle the logic and lexing in a descendent recursive parser.
ExpParser::acceptString | ( | ) | [protected] |
Accept a string.
Strings can be quoted by doublequotes, and may have backslash escape sequences
ExpParser::acceptSym | ( | $ | tokenlist | ) | [protected] |
Accept a symbol.
Takes an array of possible symbols, must be ordered from the longest to the shortest.
ExpParser::expectKeyword | ( | $ | keywordlist = false , |
|
$ | case_insensitive = false , |
|||
$ | numeric = false | |||
) | [protected] |
Excpect a keyword.
ExpParser::expectNum | ( | ) | [protected] |
Except a number.
ExpParser::expectString | ( | ) | [protected] |
Expect a string.
ExpParser::expectSym | ( | $ | tokenlist | ) | [protected] |
Excpect a symbol, but fail if not availible.
ExpParser::run | ( | ) | [abstract, protected] |
Entry point to start parsing.
Runned when the state is set up correctly
Reimplemented in ExpParser_SearchFilter.