Skip to main content

Module parser

Module parser 

Source
Expand description

Recursive-descent parser for GoogleSQL (BigQuery) statements, queries and expressions.

Expressions use precedence climbing with BigQuery’s operator precedence. Statements the AST does not model (GRANT, CREATE MODEL, …) parse to Statement::Raw holding their text; a statement the parser does model but cannot read is an error.

Structs§

ParsedScript
Statements with the tokens they were read from.
Parser
The recursive-descent parser over significant tokens.

Enums§

TokenRole
What a significant token turned out to be, as the parser read it. Used by the formatter to change the case of keywords, function names, type names and literals only.

Functions§

parse_data_type
Parse one data type (ARRAY<STRUCT<a INT64>>).
parse_expr
Parse one expression.
parse_query
Parse exactly one query (a trailing semicolon is allowed).
parse_query_extended
Parse exactly one query accepting the constructs of parse_statements_extended.
parse_script
Parse sql keeping its tokens, their roles and each statement’s span.
parse_statement
Parse exactly one statement.
parse_statements
Parse every statement of sql (separated by semicolons; a trailing one is optional).
parse_statements_extended
Parse every statement of sql accepting the Spark/Calcite constructs BigQuery lacks, each desugared to plain BigQuery syntax with the same meaning: