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:
@@ -46,7 +46,7 @@ import TreeSitterP4
|
||||
let runtime = try #UseOkResult(P4Runtime.ParserRuntime.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
#expect(state_result == P4Lang.reject)
|
||||
#expect(AsInstantiatedParserState(state_result) == P4Lang.reject)
|
||||
}
|
||||
|
||||
@Test func test_simple_scope() async throws {
|
||||
@@ -72,7 +72,7 @@ import TreeSitterP4
|
||||
let runtime = try #UseOkResult(P4Runtime.ParserRuntime.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
#expect(state_result == P4Lang.accept)
|
||||
#expect(AsInstantiatedParserState(state_result) == P4Lang.accept)
|
||||
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ import TreeSitterP4
|
||||
let runtime = try #UseOkResult(P4Runtime.ParserRuntime.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
#expect(state_result == P4Lang.reject)
|
||||
#expect(AsInstantiatedParserState(state_result) == P4Lang.reject)
|
||||
}
|
||||
|
||||
@Test func test_simple_assignment() async throws {
|
||||
@@ -124,7 +124,7 @@ import TreeSitterP4
|
||||
let runtime = try #UseOkResult(P4Runtime.ParserRuntime.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
#expect(state_result == P4Lang.reject)
|
||||
#expect(AsInstantiatedParserState(state_result) == P4Lang.reject)
|
||||
|
||||
}
|
||||
|
||||
@@ -155,5 +155,5 @@ import TreeSitterP4
|
||||
let runtime = try #UseOkResult(P4Runtime.ParserRuntime.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
#expect(state_result == P4Lang.reject)
|
||||
#expect(AsInstantiatedParserState(state_result) == P4Lang.reject)
|
||||
}
|
||||
Reference in New Issue
Block a user