Semicolon Cleanup

1. Semicolons were required in the wrong spot.
2. Make semicolons "invisible" (from the tree-sitter perspective).

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-02-27 08:23:27 -05:00
parent 1495074459
commit cfe78a9b29
13 changed files with 73 additions and 92 deletions
+18
View File
@@ -75,3 +75,21 @@ import TreeSitterP4
let program = try #UseOkResult(Program.Parse(simple_parser_declaration))
#expect(#RequireOkResult(program.find_parser(withName: Identifier(name: "main_parser"))))
}
@Test func test_invalid_transition_expression_keyset_expressions() async throws {
let simple_parser_declaration = """
parser main_parser() {
state start {
transition select (false) {
asdf: reject;
asde: reject;
};
}
};
"""
let compilation_error = try #UseErrorResult(Program.Parse(simple_parser_declaration))
#expect(compilation_error.msg.contains("asde"))
#expect(compilation_error.msg.contains("asdf"))
}
+2 -2
View File
@@ -132,7 +132,7 @@ import TreeSitterP4
if (x) {
x = false;
check = "valid";
};
}
transition select (x) {
false: reject;
true: accept;
@@ -167,7 +167,7 @@ import TreeSitterP4
} else {
x = true;
check = "b";
};
}
transition select (x) {
false: reject;
true: accept;