Refactor Parser States

Refactor the class hierarchy for parser states so that
there is a parser state that acts more like a type and
one that acts more like a value (the latter, then, serves
as the base class for the other instantiated parser states).

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-03-30 05:16:48 -04:00
parent fda9858680
commit 7c9ecc2438
21 changed files with 199 additions and 264 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ import P4Lang
#expect(parser.states.count() == 1)
let state = try! #require(parser.states.find(withIdentifier: Identifier(name: "start")))
let state = AsInstantiatedParserState((try! #require(parser.states.find(withIdentifier: Identifier(name: "start")))))
#expect(state.state == Identifier(name: "start"))
#expect(state.statements.count == 1)
}