Module lexer

Source
Expand description

SQL lexer.

This module lexes SQL according to the rules described in the β€œLexical Structure” section of the PostgreSQL documentation. The description is intentionally not replicated here. Please refer to that chapter as you read the code in this module.

Where the PostgreSQL documentation is unclear, refer to their flex source instead, located in the backend/parser/scan.l file in the PostgreSQL Git repository.

MacrosΒ§

bail πŸ”’

StructsΒ§

LexerError
PosToken

EnumsΒ§

Token

ConstantsΒ§

MAX_IDENTIFIER_LENGTH
Maximum allowed identifier length in bytes.

FunctionsΒ§

lex
Lexes a SQL query.
lex_dollar_string πŸ”’
lex_extended_string πŸ”’
lex_ident πŸ”’
lex_line_comment πŸ”’
lex_multiline_comment πŸ”’
lex_number πŸ”’
lex_op πŸ”’
lex_parameter πŸ”’
lex_quoted_ident πŸ”’
lex_string πŸ”’
lex_to_adjacent_string πŸ”’

Type AliasesΒ§

IdentString
Newtype that limits the length of identifiers.