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
@@ -189,10 +189,18 @@ pub fn execute(
|
||||
let function_name = function.unwrap_or("main").to_string();
|
||||
let entry_module = &project.program.modules[&project.entry];
|
||||
if entry_module.function(&function_name).is_none() {
|
||||
eprintln!(
|
||||
"error: no function named `{function_name}` in {}",
|
||||
project.entry_file().path.display()
|
||||
);
|
||||
if function.is_none() {
|
||||
eprintln!(
|
||||
"error[sem.no_entry_function]: {} has no callable `main`; declare an Exec H2 \
|
||||
(`## @exec main`) or pass an explicit function name",
|
||||
project.entry_file().path.display()
|
||||
);
|
||||
} else {
|
||||
eprintln!(
|
||||
"error: no function named `{function_name}` in {}",
|
||||
project.entry_file().path.display()
|
||||
);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
let runtime_args: Vec<EvaluatedArg> = named_args
|
||||
|
||||
Reference in new issue
Block a user