PHP Class SqlParser\Parser

Mostra file Open project: phpmyadmin/sql-parser Class Usage Examples

Public Properties

Property Type Description
$KEYWORD_PARSERS array Array of classes that are used in parsing SQL components.
$STATEMENT_PARSERS array Array of classes that are used in parsing the SQL statements.
$brackets integer The number of opened brackets.
$errors SqlParser\Exceptions\ParserException[] Usually, the parsing does not stop once an error occurred because that error might be a false positive or a partial result (even a bad one) might be needed.
$list TokensList The list of tokens that are parsed.
$statements Statement[] List of statements parsed.
$strict boolean Whether errors should throw exceptions or just be stored.

Public Methods

Method Description
__construct ( string | UtfString | TokensList $list = null, boolean $strict = false ) Constructor.
error ( string $msg = '', Token $token = null, integer $code ) : void Creates a new error log.
parse ( ) : void Builds the parse trees.

Method Details

__construct() public method

Constructor.
public __construct ( string | UtfString | TokensList $list = null, boolean $strict = false )
$list string | UtfString | TokensList The list of tokens to be parsed.
$strict boolean Whether strict mode should be enabled or not.

error() public method

Creates a new error log.
public error ( string $msg = '', Token $token = null, integer $code ) : void
$msg string The error message.
$token Token The token that produced the error.
$code integer The code of the error.
return void

parse() public method

Builds the parse trees.
public parse ( ) : void
return void

Property Details

$KEYWORD_PARSERS public_oe static_oe property

Array of classes that are used in parsing SQL components.
public static array $KEYWORD_PARSERS
return array

$STATEMENT_PARSERS public_oe static_oe property

Array of classes that are used in parsing the SQL statements.
public static array $STATEMENT_PARSERS
return array

$brackets public_oe property

The number of opened brackets.
public int $brackets
return integer

$errors public_oe property

Usually, the parsing does not stop once an error occurred because that error might be a false positive or a partial result (even a bad one) might be needed.
See also: Parser::error()
public ParserException[],SqlParser\Exceptions $errors
return SqlParser\Exceptions\ParserException[]

$list public_oe property

The list of tokens that are parsed.
public TokensList,sqlparser $list
return TokensList

$statements public_oe property

List of statements parsed.
public Statement[],sqlparser $statements
return Statement[]

$strict public_oe property

Whether errors should throw exceptions or just be stored.
See also: static::$errors
public bool $strict
return boolean