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
@@ -707,6 +707,12 @@ fn is_keyword(kind: &TokenKind) -> bool {
|
||||
| TokenKind::And
|
||||
| TokenKind::Or
|
||||
| TokenKind::Not
|
||||
| TokenKind::If
|
||||
| TokenKind::Else
|
||||
| TokenKind::While
|
||||
| TokenKind::End
|
||||
| TokenKind::Return
|
||||
| TokenKind::Params
|
||||
)
|
||||
}
|
||||
|
||||
@@ -740,6 +746,12 @@ fn describe_token(kind: &TokenKind) -> String {
|
||||
TokenKind::And => "`and`".to_owned(),
|
||||
TokenKind::Or => "`or`".to_owned(),
|
||||
TokenKind::Not => "`not`".to_owned(),
|
||||
TokenKind::If => "`if`".to_owned(),
|
||||
TokenKind::Else => "`else`".to_owned(),
|
||||
TokenKind::While => "`while`".to_owned(),
|
||||
TokenKind::End => "`end`".to_owned(),
|
||||
TokenKind::Return => "`return`".to_owned(),
|
||||
TokenKind::Params => "`params`".to_owned(),
|
||||
TokenKind::LParen => "`(`".to_owned(),
|
||||
TokenKind::RParen => "`)`".to_owned(),
|
||||
TokenKind::LBracket => "`[`".to_owned(),
|
||||
|
||||
Reference in new issue
Block a user