Initial Work on Compiling Function Declarations

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-04-02 02:49:04 -04:00
parent fc0276ad42
commit 443b21b890
3 changed files with 228 additions and 18 deletions
+20
View File
@@ -146,3 +146,23 @@ import TreeSitterP4
let (state_result, _) = try! #UseOkResult(runtime.run())
#expect(AsInstantiatedParserState(state_result) == P4Lang.reject)
}
@Test func test_function_declaration() async throws {
let simple_parser_declaration = """
bool functionb() {
int count;
};
"""
#expect(#RequireOkResult(Program.Compile(simple_parser_declaration)))
}
@Test func test_function_declaration_with_parameters() async throws {
let simple_parser_declaration = """
bool functionb(bool x) {
x = true;
};
"""
#expect(#RequireOkResult(Program.Compile(simple_parser_declaration)))
}