lawref.query.parser
Рекурсивный спуск LawQL без внешних зависимостей (Ф2/Ф3/Ф5).
Classes
| Name | Description |
|---|---|
Binding | No description. |
Expr | No description. |
InferenceQuery | No description. |
Materialization | No description. |
Parser | No description. |
Query | No description. |
Selection | No description. |
Source | No description. |
Token | No description. |
KEYWORDSattributemodule attribute#
KEYWORDS = {
'from',
'in',
'where',
'select',
'as',
'and',
'or',
'exists',
'not',
'let',
'eval',
'true',
'false',
'null',
'query',
'over'
}TOKEN_REattributemodule attribute#
TOKEN_RE = re.compile(
'(?P<SPACE>[ \\t\\r\\n]+)|(?P<COMMENT>\\#[^\\n]*)|(?P<STRING>\\"(?:\\\\.|[^\\"\\\\])*\\"|\'(?:\\\\.|[^\'\\\\])*\')|(?P<NUMBER>-?[0-9]+(?:\\.[0-9]+)?)|(?P<OP>==|!=|>=|<=|>|<)|(?P<PUNCT>[(),.={}\\[\\]:;])|(?P<IDENT>[A-Za-z_][A-Za-z0-9_-]*)|(?P<BAD>.)'
)Bindingclassdataclass#
class Binding(name: str, source: Source)Exprclassdataclass#
class Expr(kind: str, value: Any = None, left: 'Expr | None' = None, right: 'Expr | None' = None, args: tuple['Expr', ...] = ())argsattributeclass attributeinstance attribute#
args: tuple['Expr', ...] = ()kindattributeinstance attribute#
kind: strleftattributeclass attributeinstance attribute#
left: 'Expr | None' = Nonerightattributeclass attributeinstance attribute#
right: 'Expr | None' = Nonevalueattributeclass attributeinstance attribute#
value: Any = NoneInferenceQueryclassdataclass#
class InferenceQuery(name: str, package: str, body: str, metadata: dict[str, str], source: str)Materializationclassdataclass#
class Materialization(name: str, package: str, case: str)Parserclass#
class Parser(source: str)indexattributeinstance attribute#
index = 0sourceattributeinstance attribute#
source = sourcetokensattributeinstance attribute#
tokens = tokenize(source)acceptmethod#
def accept(kind: str, value: str | None = None) -> Token | Noneand_exprmethod#
def and_expr() -> Exprcomparisonmethod#
def comparison() -> Exprexists_exprmethod#
def exists_expr() -> Exprexpectmethod#
def expect(kind: str, message: str | None = None) -> Tokenexpressionmethod#
def expression() -> Exprfield_namemethod#
def field_name(message: str) -> strinferencemethod#
def inference() -> InferenceQueryor_exprmethod#
def or_expr() -> Exprparsemethod#
def parse() -> Query | InferenceQueryprimarymethod#
def primary() -> Exprselectionmethod#
def selection() -> Selectionsource_exprmethod#
def source_expr() -> Sourcestringmethod#
def string() -> strQueryclassdataclass#
class Query(bindings: list[Binding], where: Expr | None, selections: list[Selection], materializations: list[Materialization] = list(), metadata: dict[str, str] = dict(), source: str = '')bindingsattributeinstance attribute#
bindings: list[Binding]materializationsattributeclass attributeinstance attribute#
materializations: list[Materialization] = field(default_factory=list)metadataattributeclass attributeinstance attribute#
metadata: dict[str, str] = field(default_factory=dict)selectionsattributeinstance attribute#
selections: list[Selection]sourceattributeclass attributeinstance attribute#
source: str = ''whereattributeinstance attribute#
where: Expr | NoneSelectionclassdataclass#
class Selection(expression: Expr, alias: str)Sourceclassdataclass#
class Source(relation: str, package_glob: str = '*', document: str | None = None)Tokenclassdataclass#
class Token(kind: str, value: str, line: int, column: int)Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.