Improve Parsing of P4 Parsers And Continue Runtime Implementation
1. Parsing of P4 Parsers was broken: Multiple local elements and statements were not allowed. 2. Support more functionality on scopes. 3. Refactor variable/identifier. 4. Add more tests. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -41,14 +41,12 @@ public class ParserRuntime: CustomStringConvertible {
|
||||
return Result.Ok(P4.ParserRuntime(execution: P4.ParserExecution(start_state)))
|
||||
}
|
||||
|
||||
public func run(input: P4.Packet) -> Result<Nothing> {
|
||||
public func run(input: P4.Packet) -> Result<ParserExecution> {
|
||||
execution.scopes.enter()
|
||||
print("Execution: \(execution)")
|
||||
while execution.state != P4.accept && execution.state != P4.reject {
|
||||
execution = execution.state.evaluate(execution: execution)
|
||||
print("Execution: \(execution)")
|
||||
}
|
||||
return .Ok(Nothing())
|
||||
return .Ok(execution)
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
|
||||
Reference in New Issue
Block a user