Skip to main content

Module parser

Module parser 

Source
Expand description

QAIL Schema Parser

Parses .qail text format into Schema AST.

§Grammar

schema = { table_def | index_def | migration_hint }*

table_def = "table" IDENT "{" column_def* "}"
column_def = IDENT TYPE constraint*
constraint = "primary_key" | "not_null" | "nullable" | "unique" | "default" VALUE

index_def = ["unique"] "index" IDENT "on" IDENT "(" IDENT+ ")"

migration_hint = "rename" PATH "->" PATH
               | "transform" EXPR "->" PATH
               | "drop" PATH ["confirm"]

Functions§

parse_check_expr_fragment
Parse a QAIL check expression string into a CheckExpr. Supports: “col >= 0” → GreaterOrEqual “col > 0” → GreaterThan “col <= 100” → LessOrEqual “col < 100” → LessThan “col between 0 200” → Between “col >= 0 and col <= 200” → And(GreaterOrEqual, LessOrEqual)
parse_qail
Parse a .qail file into a Schema.
parse_qail_file
Parse schema from a file or modular schema directory.