✓
Passing This code compiles and runs correctly.
Code
// Test 052: Lenient parsing with multiple errors
// Parser should continue past errors and create parse-error nodes
~event valid-before {
x: i32
}
// This event has an unclosed brace - should create parse-error node
~event broken-event {
value: i32
// This event is valid - should still be parsed
~event valid-after {
y: i32
}
// Another broken event - unclosed annotation
~[unclosed annotation event another_broken {
z: i32
}
// One more valid event to verify recovery
~event final-valid {
data: []const u8
}
Must fail at frontend compile:
Parsing or type-checking must reject the program.
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "std/compiler",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 3,
"col": 0
}
},
{
"type": "event_decl",
"name": "valid-before",
"path": [
"valid-before"
],
"module": "input",
"input": {
"fields": [
{
"name": "x",
"type": "i32",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
},
"branches": [],
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 8,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 9,
"col": 0
}
},
{
"type": "parse_error",
"code": "PARSE004",
"message": "unmatched '{' in event shape",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 9,
"col": 1
},
"raw_text": "~event broken-event {\n value: i32\n\n// This event is valid - should still be parsed\n"
},
{
"type": "event_decl",
"name": "valid-after",
"path": [
"valid-after"
],
"module": "input",
"input": {
"fields": [
{
"name": "y",
"type": "i32",
"is_source": false,
"is_file": false,
"is_embed_file": false,
"is_expression": false,
"is_invocation_meta": false,
"phantom": null
}
]
},
"branches": [],
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 17,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 18,
"col": 0
}
},
{
"type": "flow",
"invocation": {
"event": [
"const u8"
],
"args": [],
"variant": null
},
"continuations": [],
"pre_label": null,
"post_label": null,
"impl_of": null,
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 25,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/200_COMPILER_FEATURES/210_PARSER/052_lenient_multiple_errors/input.kz",
"line": 26,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST