compiler: Refactor Compiler To Remove Ambiguities
There were significant overlaps in the names of data structures between the compiler and the language that made it necessary to litter the code with P4Lang.xxxx. This refactor removes that requirement in most places (Parser is ambiguous wherever TreeSitter is used -- cannot avoid that!) Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -36,13 +36,13 @@ public struct Runtime<U, T: LibraryCallable<U>>: CustomStringConvertible {
|
||||
|
||||
/// Create a parser runtime from a P4 program
|
||||
public static func create(
|
||||
program: P4Lang.Program
|
||||
program: Program
|
||||
) -> Result<Runtime<InstantiatedParserState, ParserValue>> {
|
||||
return Runtime.create(program: program, withGlobalValues: .none)
|
||||
}
|
||||
|
||||
public static func create(
|
||||
program: P4Lang.Program, withGlobalValues initial: VarValueScopes?
|
||||
program: Program, withGlobalValues initial: VarValueScopes?
|
||||
) -> Result<Runtime<InstantiatedParserState, ParserValue>> {
|
||||
return switch program.starting_parser() {
|
||||
case .Ok(let parser):
|
||||
@@ -55,7 +55,7 @@ public struct Runtime<U, T: LibraryCallable<U>>: CustomStringConvertible {
|
||||
}
|
||||
|
||||
public static func create(
|
||||
control: P4Lang.Control, withGlobalValues initial: VarValueScopes?
|
||||
control: Control, withGlobalValues initial: VarValueScopes?
|
||||
) -> Result<Runtime<P4TableHitMissValue, Control>> {
|
||||
return .Ok(
|
||||
P4Runtime.Runtime<P4TableHitMissValue, Control>(callable: control, withGlobalValues: initial))
|
||||
|
||||
Reference in New Issue
Block a user