refactor(expression): own the v2 payload statement grammar
Move keyword recognition out of the Markdown mapper and into the single expression/statement parser: - add parse_payload_statement + PayloadStatement for if/else/while/end/ return/params/ordinary; keyword matching uses complete tokens, requires whitespace before a control expression, rejects trailing tokens/colons and reserves the statement words in expression positions - keep expression spans payload-relative so the frontend can rewrite them onto the file; malformed params(...) interiors stay owned by the signature parser (one sem.syntax diagnostic, not a duplicate) - simplify the frontend mapper to control-stack lowering and mapped semantic diagnostics only - emit sem.no_entry_function from run when no Exec H2 main exists - add else-under-while, params-in-quote, Knowledge-inertness and no-entry tests; update the corpus counts - make the EBNF parameter type annotation optional (params(n) is valid) Verified: cargo fmt --check, cargo clippy -D warnings and cargo test --workspace --locked: 501 passed, 0 failed, 2 ignored.
This commit is contained in:
1 parent
e029853e32
commit
ffd1cc9862
14 files changed
+334
-145
No files matched your search
@@ -79,6 +79,7 @@
|
||||
pub mod ast;
|
||||
pub mod lexer;
|
||||
mod parser;
|
||||
pub mod statement;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
@@ -89,6 +90,7 @@ pub use ast::{
|
||||
};
|
||||
pub use marqdo_span::Span;
|
||||
pub use parser::MAX_NESTING_DEPTH;
|
||||
pub use statement::{parse_payload_statement, PayloadStatement};
|
||||
|
||||
/// Stable diagnostic code for every expression parse failure.
|
||||
pub const EXPR_PARSE: &str = "expr.parse";
|
||||
|
||||
Reference in new issue
Block a user