Refactor Parsing/Runtime

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-02-24 00:28:41 -05:00
parent f9353c683e
commit 64a0fe4255
29 changed files with 1269 additions and 974 deletions
+4 -4
View File
@@ -24,7 +24,7 @@ import Testing
import TreeSitter
import TreeSitterP4
@testable import Parser
@testable import P4Parser
@Test func test_simple_parser_syntax_error() async throws {
let simple_parser_declaration = """
@@ -37,7 +37,7 @@ import TreeSitterP4
#expect(
#RequireErrorResult(
Error(withMessage: "Could not compile the P4 program"),
Parser.Program(simple_parser_declaration)))
Program.Parse(simple_parser_declaration)))
}
@Test func test_simple_parser_with_statement() async throws {
@@ -50,7 +50,7 @@ import TreeSitterP4
};
"""
let program = try #UseOkResult(Parser.Program(simple_parser_declaration))
let program = try #UseOkResult(Program.Parse(simple_parser_declaration))
let parser = try #UseOkResult(program.find_parser(withName: Identifier(name: "main_parser")))
#expect(parser.states.count() == 1)
@@ -72,6 +72,6 @@ import TreeSitterP4
bool() main;
"""
let program = try #UseOkResult(Parser.Program(simple_parser_declaration))
let program = try #UseOkResult(Program.Parse(simple_parser_declaration))
#expect(#RequireOkResult(program.find_parser(withName: Identifier(name: "main_parser"))))
}