feat(expression): strict expression and statement grammar for executable payloads
Implement the independent expression parser frozen in spec/expression.ebnf:
- Unicode XID identifiers (Chinese names supported), reserved keywords
true/false/None/and/or/not.
- Arbitrary-precision Int literals, binary64 Float literals (digits required on
both sides, overflow rejected), double-quoted Text with \u{...} escapes.
- List and record literals, calls with positional-then-named arguments and
trailing commas, member access, indexing, chained postfix operators.
- Precedence exactly as specified: right-associative ** with unary minus
binding outside, multiplicative/additive, single non-associative comparison,
short-circuit and/or.
- Assignment only as `identifier = expression` at statement start; no comments,
no second Markdown parser, max nesting depth 128 with structured errors.
- parse_expression/parse_statement/parse_arguments never panic; ParseError has
stable code expr.parse, payload-relative byte spans and Display/Error.
50 unit tests + 2 doctests, cargo fmt/clippy clean.
This commit is contained in:
1 parent
55a2b2d82d
commit
9897ecc37f
6 files changed
+2649
-5
No files matched your search
@@ -11,5 +11,8 @@ authors.workspace = true
|
||||
[dependencies]
|
||||
marqdo-span = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
num-bigint = { workspace = true }
|
||||
unicode-ident = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = { workspace = true }
|
||||
Reference in new issue
Block a user