math_spec.where_parser
pyparsing-based parser for where strings — grammar and the unresolved AST.
Parses strings like "p_max > 0 AND NOT is_must_run" into an AST. The
resolved node vocabulary lives in :mod:math_spec.program beside the rest of
what a consumer dispatches on; what stays here is the grammar and the
Unresolved* nodes it emits, which resolution rewrites away.
UnresolvedWhereNode = UnresolvedNameNode | UnresolvedComparisonNode | UnresolvedPositionNode
module-attribute
#
UnresolvedComparisonNode(name, op, value, quoted=False)
dataclass
#
UnresolvedNameNode(name)
dataclass
#
A bare name — unresolved. resolution.py types it.
name
instance-attribute
#
UnresolvedPositionNode(dimension, op, position, by=None)
dataclass
#
position(dim) <op> i before the name is checked.
Kept apart from :class:UnresolvedComparisonNode because its left-hand
side is not a name but an application to one, which no bare name can
carry. resolution.py types it into
:class:~math_spec.program.DimensionPositionNode.
parse_where(text)
#
Parse a where string into an AST.
The connectives and literals are the resolved vocabulary's own, but the
leaves naming declarations come back as Unresolved* nodes — the
annotation is the type the tree has once resolution types every leaf.
| RAISES | DESCRIPTION |
|---|---|
SchemaError
|
If text is not a where string of the language. |