Skip to main content

Module token

Module token 

Source
Expand description

GoogleSQL (BigQuery) lexer.

tokenize returns the significant tokens; tokenize_with_trivia also returns whitespace and comments so a formatter can lay the text out again without losing anything. Every token keeps its byte Span in the source and its exact source text.

Structs§

Span
A byte range start..end in the source text.
Token
One token with its exact source text and span.

Enums§

CommentKind
The kind of comment.
Punct
Punctuation and operators.
QuoteStyle
Which quotes delimit a string, bytes literal or quoted name.
TokenKind
What a token is.

Constants§

RESERVED_KEYWORDS
GoogleSQL reserved keywords: never an unquoted identifier (except after a .).

Functions§

comments
The comments of sql, in order.
escape_identifier
Escape value for a backtick-quoted identifier.
escape_string
Escape value for a non-raw GoogleSQL string with quote.
is_reserved_keyword
Whether word is a GoogleSQL reserved keyword (case-insensitive).
tokenize
The significant tokens of sql (no whitespace or comments).
tokenize_extended
Like tokenize, with $ allowed inside identifiers (EXPR$0) and at the start of a name ($f1).
tokenize_with_trivia
Every token of sql, whitespace and comments included, in order. Concatenating their texts gives sql.