abla/sql/parser

Generated from source.

Source module; follow its importing module's re-export links.

Source: abla/sql/parser.ab

AblaSqlToken (class)

compile class AblaSqlToken(val kind: string, val text: string, val begin: int, val end: int)

Compiler-only PostgreSQL subset checker. Tokens retain decoded-template byte spans for diagnostics; the provider owns the Abla source cursor.

AblaSqlCheck (class)

compile class AblaSqlCheck(
    val kinds: array<string>, val positions: array<int>, var message: string = "",
    var begin: int = 0, var end: int = 0
)

Holds the per-hole binding types or the first SQL diagnostic with its byte span.

AblaSqlLexer (class)

compile class AblaSqlLexer(val source: string, val tokens: array<AblaSqlToken>,
    val check: AblaSqlCheck, var position: int = 0)

Tracks the source cursor, emitted tokens and first lexing error.

AblaSqlParser (class)

compile class AblaSqlParser(val tokens: array<AblaSqlToken>, val check: AblaSqlCheck,
    var position: int = 0, var depth: int = 0)

Tracks checked SQL tokens, nesting, parameter bindings and the first parse error.

ablaSqlSpace (compile.fun)

compile fun ablaSqlSpace(b: int): bool

Returns whether the byte is recognized as SQL whitespace.

ablaSqlDigit (compile.fun)

compile fun ablaSqlDigit(b: int): bool

Returns whether the byte is an ASCII decimal digit.

ablaSqlLetter (compile.fun)

compile fun ablaSqlLetter(b: int): bool

Returns whether the byte can begin an unquoted SQL identifier in this checker.

ablaSqlNameByte (compile.fun)

compile fun ablaSqlNameByte(b: int): bool

Returns whether the byte can continue an unquoted SQL identifier.

ablaSqlOneOf (compile.fun)

compile fun ablaSqlOneOf(text: string, choices: array<string>): bool

Returns whether the text equals any choice.

AblaSqlCheck.fail (extension compile.fun)

compile fun AblaSqlCheck.fail(message: string, begin: int, end: int): void

Records the first diagnostic and its byte span.

AblaSqlLexer.add (extension compile.fun)

compile fun AblaSqlLexer.add(kind: string, begin: int): void

Emits a token at the current span or reports that the token limit was exceeded.

AblaSqlLexer.quote (extension compile.fun)

compile fun AblaSqlLexer.quote(quote: int, escaped: bool, begin: int): void

Consumes quoted SQL and reports unsupported escapes, empty identifiers or an unterminated quote.

AblaSqlLexer.number (extension compile.fun)

compile fun AblaSqlLexer.number(begin: int): void

Consumes a numeric token and reports missing exponent digits or a trailing identifier.

AblaSqlLexer.dollar (extension compile.fun)

compile fun AblaSqlLexer.dollar(begin: int): void

Consumes a numbered parameter or dollar-quoted string, recording an error for an invalid delimiter or missing end.

ablaSqlLex (compile.fun)

compile fun ablaSqlLex(source: string, var check: AblaSqlCheck): array<AblaSqlToken>

Tokenizes the decoded SQL with byte spans, recording the first failure in the supplied checker.

AblaSqlParser.token (extension compile.fun)

compile fun AblaSqlParser.token(): AblaSqlToken

Returns a copy of the current token and its byte span.

AblaSqlParser.at (extension compile.fun)

compile fun AblaSqlParser.at(text: string): bool

Returns whether the current token has the supplied text.

AblaSqlParser.nextIs (extension compile.fun)

compile fun AblaSqlParser.nextIs(text: string): bool

Returns whether the next token exists and has the given text.

AblaSqlParser.take (extension compile.fun)

compile fun AblaSqlParser.take(): void

Advances one token unless the cursor is already at the end.

AblaSqlParser.report (extension compile.fun)

compile fun AblaSqlParser.report(message: string): void

Records the first parser error at the current token's byte span.

AblaSqlParser.consume (extension compile.fun)

compile fun AblaSqlParser.consume(text: string): bool

Advances past a matching token and returns whether it was present.

AblaSqlParser.expect (extension compile.fun)

compile fun AblaSqlParser.expect(text: string): void

Consumes the required token or records a missing-token error.

ablaSqlReserved (compile.fun)

compile fun ablaSqlReserved(text: string): bool

Returns whether the SQL checker reserves the supplied lowercase keyword.

AblaSqlParser.name (extension compile.fun)

compile fun AblaSqlParser.name(): bool

Returns whether the current token can be used as a SQL identifier.

AblaSqlParser.identifier (extension compile.fun)

compile fun AblaSqlParser.identifier(): void

Consumes a static SQL identifier or reports that one was required.

AblaSqlParser.qualified (extension compile.fun)

compile fun AblaSqlParser.qualified(): void

Consumes dot-separated SQL identifiers and reports a missing or invalid identifier.

AblaSqlParser.alias (extension compile.fun)

compile fun AblaSqlParser.alias(): void

Consumes an optional alias and reports an error if an explicit AS has no valid identifier.

AblaSqlParser.typeName (extension compile.fun)

compile fun AblaSqlParser.typeName(): string

Returns a SQL cast type name and records invalid type syntax or unsupported array types.

ablaSqlBindKind (compile.fun)

compile fun ablaSqlBindKind(type: string): string

Returns the canonical binding kind for a supported SQL type or an empty string for an unsupported name.

AblaSqlParser.parameter (extension compile.fun)

compile fun AblaSqlParser.parameter(): void

Records the binding kind for a generated hole and rejects manual parameters, missing casts or unsupported types.

AblaSqlParser.arguments (extension compile.fun)

compile fun AblaSqlParser.arguments(): void

Consumes the function arguments and records a syntax error for invalid arguments or delimiters.

AblaSqlParser.caseValue (extension compile.fun)

compile fun AblaSqlParser.caseValue(): void

Checks a CASE expression and records the first invalid branch or delimiter.

AblaSqlParser.prefix (extension compile.fun)

compile fun AblaSqlParser.prefix(star: bool): void

Checks the next prefix or primary expression and records an error for invalid syntax.

ablaSqlPrecedence (compile.fun)

compile fun ablaSqlPrecedence(operator: string): int

Returns the precedence of the SQL operator or the sentinel for an unsupported operator.

AblaSqlParser.expression (extension compile.fun)

compile fun AblaSqlParser.expression(minimum: int, star: bool = false): void

Checks a precedence-bounded SQL expression and records the first unsupported or invalid form.

AblaSqlParser.outputAlias (extension compile.fun)

compile fun AblaSqlParser.outputAlias(): void

Consumes the optional alias of an output expression; a wildcard (* or t.*) takes none (PostgreSQL: syntax error at the name after it).

AblaSqlParser.projection (extension compile.fun)

compile fun AblaSqlParser.projection(): void

Checks the output expression list and any aliases, recording the first syntax error.

AblaSqlParser.relation (extension compile.fun)

compile fun AblaSqlParser.relation(): void

Checks a relation and its optional alias, recording invalid relation syntax.

AblaSqlParser.from (extension compile.fun)

compile fun AblaSqlParser.from(): void

Checks FROM relations and joins, recording the first invalid relation or join clause.

AblaSqlParser.select (extension compile.fun)

compile fun AblaSqlParser.select(): void

Checks a supported SELECT and records the first invalid clause.

AblaSqlParser.assignments (extension compile.fun)

compile fun AblaSqlParser.assignments(): void

Checks comma-separated SQL assignments and records the first syntax error.

AblaSqlParser.insert (extension compile.fun)

compile fun AblaSqlParser.insert(): void

Checks an INSERT statement in the supported subset and reports the first malformed or unsupported clause.

AblaSqlParser.update (extension compile.fun)

compile fun AblaSqlParser.update(): void

Checks an UPDATE statement and records the first invalid target, assignment or condition.

AblaSqlParser.delete (extension compile.fun)

compile fun AblaSqlParser.delete(): void

Checks a DELETE statement and records the first invalid relation, condition or projection.

AblaSqlParser.statement (extension compile.fun)

compile fun AblaSqlParser.statement(): void

Checks one supported statement and reports an unsupported form or excessive nesting.

ablaSqlCheck (compile.fun)

compile fun ablaSqlCheck(source: string, positions: array<int>): AblaSqlCheck

Checks one bounded SQL statement and returns its parameter kinds or a diagnostic with the offending byte span.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.