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:
@@ -41,7 +41,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -60,7 +60,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -79,7 +79,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -98,7 +98,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -117,7 +117,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -136,7 +136,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -155,7 +155,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -174,7 +174,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -193,7 +193,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -212,7 +212,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -60,7 +60,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -79,7 +79,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -98,7 +98,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -117,7 +117,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -136,7 +136,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -155,7 +155,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -174,7 +174,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -193,7 +193,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -212,7 +212,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -231,7 +231,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -250,7 +250,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -269,7 +269,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -288,7 +288,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -60,7 +60,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -79,7 +79,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -98,7 +98,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -117,7 +117,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -136,7 +136,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -155,7 +155,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -174,7 +174,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -193,7 +193,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -212,7 +212,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -231,7 +231,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -250,7 +250,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -269,7 +269,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -288,7 +288,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -310,7 +310,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -335,7 +335,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 12}: Could not parse transition select expression selector expression: Mathematical operation on operands with non-int type is not allowed"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
@Test func test_simple_parser_binary_operator_add_non_integer2() async throws {
|
||||
@@ -356,7 +356,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 9}: Could not parse transition select expression selector expression: Types of values used with binary expression are not the same"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
// Subtract Integers
|
||||
@@ -373,7 +373,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -398,7 +398,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 12}: Could not parse transition select expression selector expression: Mathematical operation on operands with non-int type is not allowed"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
@Test func test_simple_parser_binary_operator_subtract_non_integer2() async throws {
|
||||
@@ -419,7 +419,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 9}: Could not parse transition select expression selector expression: Types of values used with binary expression are not the same"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
// Multiply Integers
|
||||
@@ -436,7 +436,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -461,7 +461,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 12}: Could not parse transition select expression selector expression: Mathematical operation on operands with non-int type is not allowed"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
@Test func test_simple_parser_binary_operator_multiply_non_integer2() async throws {
|
||||
@@ -482,7 +482,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 9}: Could not parse transition select expression selector expression: Types of values used with binary expression are not the same"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
// Divide Integers
|
||||
@@ -499,7 +499,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -524,7 +524,7 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 12}: Could not parse transition select expression selector expression: Mathematical operation on operands with non-int type is not allowed"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
@Test func test_simple_parser_binary_operator_divide_non_integer2() async throws {
|
||||
@@ -545,5 +545,5 @@ import TreeSitterP4
|
||||
withMessage:
|
||||
"{72, 9}: Could not parse transition select expression selector expression: Types of values used with binary expression are not the same"
|
||||
),
|
||||
Program.Compile(simple)))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple)))
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -60,7 +60,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -79,7 +79,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -98,7 +98,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -117,7 +117,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -136,7 +136,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -155,7 +155,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -174,7 +174,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -193,7 +193,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
@@ -212,7 +212,7 @@ import TreeSitterP4
|
||||
};
|
||||
"""
|
||||
|
||||
let program = try #UseOkResult(Program.Compile(simple))
|
||||
let program = try #UseOkResult(SpecialCompilers.ProgramCompiler.Compile(simple))
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ import TreeSitterP4
|
||||
test_types = test_types.declare(identifier: Identifier(name: "Testing"), withValue: struct_type)
|
||||
|
||||
let program = try #UseOkResult(
|
||||
Program.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
@@ -81,7 +81,7 @@ import TreeSitterP4
|
||||
test_types = test_types.declare(identifier: Identifier(name: "Testing"), withValue: struct_type)
|
||||
|
||||
let program = try #UseOkResult(
|
||||
Program.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
@@ -114,7 +114,7 @@ import TreeSitterP4
|
||||
test_types = test_types.declare(identifier: Identifier(name: "Testing"), withValue: struct_type)
|
||||
|
||||
let program = try #UseOkResult(
|
||||
Program.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
@@ -150,7 +150,7 @@ import TreeSitterP4
|
||||
test_types = test_types.declare(identifier: Identifier(name: "Testing"), withValue: struct_type)
|
||||
|
||||
let program = try #UseOkResult(
|
||||
Program.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
@@ -186,7 +186,7 @@ import TreeSitterP4
|
||||
test_types = test_types.declare(identifier: Identifier(name: "Testing"), withValue: struct_type)
|
||||
|
||||
let program = try #UseOkResult(
|
||||
Program.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
SpecialCompilers.ProgramCompiler.Compile(simple_parser_declaration, withGlobalInstances: .none, withGlobalTypes: test_types))
|
||||
|
||||
let runtime = try #UseOkResult(P4Runtime.Runtime<InstantiatedParserState, P4Lang.ParserValue>.create(program: program))
|
||||
let (state_result, _) = try! #UseOkResult(runtime.run())
|
||||
|
||||
Reference in New Issue
Block a user