class Parser extends Core

Takes multiple tokens (contained in a Lexer instance) as input and builds a parse tree.

Properties

bool $strict Whether errors should throw exceptions or just be stored. from Core
Exception[] $errors List of errors that occurred during lexing. from Core
static array $STATEMENT_PARSERS Array of classes that are used in parsing the SQL statements.
static array $KEYWORD_PARSERS Array of classes that are used in parsing SQL components.
TokensList $list The list of tokens that are parsed.
Statement[] $statements List of statements parsed.
int $brackets The number of opened brackets.

Methods

error(string $msg, Token $token = null, int $code = 0)

Creates a new error log.

__construct(string|UtfString|TokensList $list = null, bool $strict = false)

Constructor.

parse()

Builds the parse trees.

Details

at line 576
error(string $msg, Token $token = null, int $code = 0)

Creates a new error log.

Parameters

string $msg the error message
Token $token the token that produced the error
int $code the code of the error

Exceptions

ParserException throws the exception, if strict mode is enabled

at line 341
__construct(string|UtfString|TokensList $list = null, bool $strict = false)

Constructor.

Parameters

string|UtfString|TokensList $list the list of tokens to be parsed
bool $strict whether strict mode should be enabled or not

at line 360
parse()

Builds the parse trees.