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.
19 lines
475 B
TOML
19 lines
475 B
TOML
[package]
|
|
name = "marqdo-expression"
|
|
description = "Strict expression grammar for executable Markdown payloads"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
authors.workspace = true
|
|
|
|
[dependencies]
|
|
marqdo-span = { workspace = true }
|
|
serde = { workspace = true }
|
|
num-bigint = { workspace = true }
|
|
unicode-ident = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
serde_json = { workspace = true }
|