Skip to content

Latest commit

 

History

History
1413 lines (889 loc) · 54.3 KB

File metadata and controls

1413 lines (889 loc) · 54.3 KB

src/minisql/sql/parser.ml

Home · Files

Provides minisql sql parser facilities for this project.

Package: minisql.sql.parser

Reachable from entry: yes

Imports

Declarations

advance

function advance(state)

Advances advance using the supplied inputs. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

atEnd

function atEnd(state)

Implements at end for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

checkKeyword

function checkKeyword(state, keyword)

Checks keyword using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
keyword dynamic keyword value consumed by this operation.

View source

checkKind

function checkKind(state, kind)

Checks kind using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
kind dynamic kind value consumed by this operation.

View source

componentName

function componentName()

Performs the componentName operation for the minisql sql parser module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

current

function current(state)

Implements current for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

expectKeyword

function expectKeyword(state, keyword)

Implements expect keyword for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
keyword dynamic keyword value consumed by this operation.

View source

expectKind

function expectKind(state, kind, description)

Implements expect kind for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
kind dynamic kind value consumed by this operation.
description dynamic description value consumed by this operation.

View source

fail

function fail(state, message)

Performs the fail operation for the minisql sql parser module. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
message dynamic Human-readable message associated with the operation.

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

Defines the invalid argument constant used by the minisql sql parser module.

View source

isFunctionNameToken

function isFunctionNameToken(value)

Returns whether the supplied value satisfies the function name token condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isIdentifierToken

function isIdentifierToken(value)

Returns whether the supplied value satisfies the identifier token condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isImplemented

function isImplemented()

Returns whether implemented satisfies the condition required by the minisql sql parser module. Returns the computed value or operation status. Does not modify its inputs.

View source

isTriggerRowQualifierToken

function isTriggerRowQualifierToken(value)

OLD and NEW are reserved pseudo-row qualifiers, not general identifiers. The parser accepts them only in the qualified form OLD.column / NEW.column. Trigger execution replaces those qualified column expressions with typed row literals before the body is bound and executed. Returns whether the supplied value satisfies the trigger row qualifier token condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

matchKeyword

function matchKeyword(state, keyword)

Implements match keyword for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
keyword dynamic keyword value consumed by this operation.

View source

matchKind

function matchKind(state, kind)

Implements match kind for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
kind dynamic kind value consumed by this operation.

View source

nextIsKeyword

function nextIsKeyword(state, keyword)

Implements next is keyword for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
keyword dynamic keyword value consumed by this operation.

View source

nextIsKind

function nextIsKind(state, kind)

Implements next is kind for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
kind dynamic kind value consumed by this operation.

View source

operatorPrecedence

function operatorPrecedence(value)

Maps binary operators to increasing binding strength; zero means non-operator. The table makes OR weakest and multiplicative operators strongest.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

operatorText

function operatorText(value)

Implements operator text for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

parseAlter

function parseAlter(state)

Parses alter using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseAlterTable

function parseAlterTable(state)

Parses alter table using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseAssignments

function parseAssignments(state)

Parses assignments using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseBegin

function parseBegin(state)

Parses begin using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCall

function parseCall(state)

Parses CALL with positional constant argument expressions.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCaseExpression

function parseCaseExpression(state)

Parses case expression using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCastExpression

function parseCastExpression(state)

Parses cast expression using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseColumnDefinition

function parseColumnDefinition(state)

Parses column definition using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCreate

function parseCreate(state)

Parses create using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCreateIndex

function parseCreateIndex(state, unique)

Parses create index using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
unique dynamic unique value consumed by this operation.

View source

parseCreatePrincipal

function parseCreatePrincipal(state, principalKind)

Parses create principal using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
principalKind dynamic principalKind value consumed by this operation.

View source

parseCreateProcedure

function parseCreateProcedure(state, replace)

Parses a stored procedure with typed positional inputs and one DML body statement.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
replace dynamic replace value consumed by this operation.

View source

parseCreateSchema

function parseCreateSchema(state)

Parses CREATE SCHEMA with optional idempotent creation semantics.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCreateSequence

function parseCreateSequence(state)

Parses create sequence using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCreateTable

function parseCreateTable(state)

Parses create table using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCreateTrigger

function parseCreateTrigger(state)

Parses create trigger using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseCreateView

function parseCreateView(state, replace)

Parses create view using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
replace dynamic replace value consumed by this operation.

View source

parseDeallocate

function parseDeallocate(state)

Parses deallocate using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseDelete

function parseDelete(state)

Parses delete using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseDescribe

function parseDescribe(state)

Parses describe using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseDrop

function parseDrop(state)

Parses drop using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseExecutePrepared

function parseExecutePrepared(state)

Parses execute prepared using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseExpression

function parseExpression(state, minimumPrecedence)

Parses a binary expression with precedence climbing and left associativity. Unary/predicate parsing supplies the left operand; recursive calls consume only operators stronger than minimumPrecedence. Advances state or returns syntax errors.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
minimumPrecedence dynamic minimumPrecedence value consumed by this operation.

View source

parseExpressionText

function parseExpressionText(source)

Parses expression text using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
source dynamic source value consumed by this operation.

View source

parseGrant

function parseGrant(state)

Parses grant using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseIdentifier

function parseIdentifier(state, description)

Parses identifier using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
description dynamic description value consumed by this operation.

View source

parseIdentifierList

function parseIdentifierList(state)

Parses identifier list using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseIdentifierName

function parseIdentifierName(state, description)

Parses identifier name using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
description dynamic description value consumed by this operation.

View source

parseIndexKeyList

function parseIndexKeyList(state)

Parses the parenthesized expression list used by CREATE INDEX keys.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseInsert

function parseInsert(state)

Parses insert using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseIntegerValue

function parseIntegerValue(state, description)

Parses integer value using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
description dynamic description value consumed by this operation.

View source

parseJoinClause

function parseJoinClause(state)

Parses join clause using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseMerge

function parseMerge(state)

Parses the core SQL MERGE form with table source, matched update/delete, and insert.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseObjectName

function parseObjectName(state, description)

Parses an optionally schema-qualified SQL object name into its canonical dotted form.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
description dynamic description value consumed by this operation.

View source

parseOrderItem

function parseOrderItem(state)

Parses order item using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parsePasswordLiteral

function parsePasswordLiteral(state)

Parses password literal using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parsePredicateTail

function parsePredicateTail(state, expression)

Parses predicate tail using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
expression dynamic expression value consumed by this operation.

View source

parsePrepare

function parsePrepare(state)

Parses prepare using the supplied inputs. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parsePrimary

function parsePrimary(state)

Parses primary using the supplied inputs. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parsePrincipalName

function parsePrincipalName(state, description)

Parses principal name using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
description dynamic description value consumed by this operation.

View source

parsePrivilegeList

function parsePrivilegeList(state)

Parses privilege list using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseReferentialAction

function parseReferentialAction(state)

Parses referential action using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseReturning

function parseReturning(state)

Parses returning using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseRevoke

function parseRevoke(state)

Parses revoke using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseRevokeBehavior

function parseRevokeBehavior(state)

Parses revoke behavior using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseSelect

function parseSelect(state)

Parses select using the supplied inputs. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseSelectCore

function parseSelectCore(state)

Parses select core using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseSelectItem

function parseSelectItem(state)

Parses select item using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseShow

function parseShow(state)

Parses show using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseSql

function parseSql(source)

Parses SQL using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
source dynamic source value consumed by this operation.

View source

parseStatement

function parseStatement(state)

Parses statement using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseTableAlias

function parseTableAlias(state)

Parses table alias using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseTableConstraint

function parseTableConstraint(state)

Parses table constraint using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseTableSource

function parseTableSource(state, description)

Parses either a catalog/CTE name or a parenthesized SELECT source. Derived tables are represented as private CTEs so the existing named-query binder and executor retain one source abstraction; only the user alias is visible.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
description dynamic description value consumed by this operation.

View source

parseTokens

function parseTokens(tokens)

Parses a complete token stream into ordered statement AST nodes. Empty statements between semicolons are ignored; any other trailing token is a syntax error. The input must be a non-empty array ending in EndOfInput.

Parameter Type Default Description
tokens dynamic tokens value consumed by this operation.

View source

parseTruncate

function parseTruncate(state)

Parses truncate using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseTypeName

function parseTypeName(state)

Parses type name using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseUnary

function parseUnary(state)

Parses unary using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseUpdate

function parseUpdate(state)

Parses update using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

parseWithSelect

function parseWithSelect(state)

Parses with select using the supplied inputs. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

preparableStatement

function preparableStatement(statement)

Implements preparable statement for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.

View source

previous

function previous(state)

Implements previous for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

privilegeName

function privilegeName(state)

Implements privilege name for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

SQL_SYNTAX

const SQL_SYNTAX = 9019

Defines the sql syntax constant used by the minisql sql parser module.

View source

startsJoin

function startsJoin(state)

Implements starts join for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

startsTableConstraint

function startsTableConstraint(state)

Implements starts table constraint for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

targetMilestone

function targetMilestone()

Performs the targetMilestone operation for the minisql sql parser module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source