class Parser (View source)

Defines the parser of the library.

This is one of the most important components, along with the lexer.

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

Constants

STATEMENT_PARSERS

Array of classes that are used in parsing the SQL statements.

KEYWORD_PARSERS

Array of classes that are used in parsing SQL components.

Properties

Exception[] $errors

List of errors that occurred during lexing.

TokensList|null $list

The list of tokens that are parsed.

Statement[] $statements

List of statements parsed.

int $brackets

The number of opened brackets.

Methods

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

No description

void
parse()

Builds the parse trees.

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

Creates a new error log.

Details

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

No description

Parameters

TokensList|null $list

the list of tokens to be parsed

bool $strict

whether strict mode should be enabled or not

void parse()

Builds the parse trees.

Return Value

void

Exceptions

ParserException

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

Creates a new error log.

Parameters

string $msg

the error message

Token|null $token

the token that produced the error

int $code

the code of the error

Return Value

void

Exceptions

ParserException