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
@@ -54,10 +54,12 @@ params_stmt = "params" , "(" , [ parameter_list ] , ")" ;
|
||||
list or block quote. The declaration is compile-time metadata, not a
|
||||
runtime call. *)
|
||||
parameter_list = parameter , { "," , parameter } , [ "," ] ;
|
||||
parameter = identifier , ":" , type_name , [ "=" , expression ] ;
|
||||
parameter = identifier , [ ":" , type_name ] , [ "=" , expression ] ;
|
||||
type_name = identifier ;
|
||||
(* Parameter names are unique; positional parameters precede defaulted ones.
|
||||
Types and default expressions reuse the existing signature rules. *)
|
||||
The type annotation is optional to preserve the existing untyped signature
|
||||
form (`params(n)`); types and default expressions reuse the existing
|
||||
signature rules. *)
|
||||
|
||||
(* Assignment and place writes are unchanged from the previous revision. *)
|
||||
assignment = assign_target , "=" , expression ;
|
||||
|
||||
Reference in new issue
Block a user