compiler: Refactor Language Element Tags
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -21,10 +21,10 @@ import TreeSitterExtensions
|
||||
import TreeSitterP4
|
||||
|
||||
extension CST.LocalElements: Parsable {
|
||||
public typealias C = CST.Statement
|
||||
public typealias C = CST.Categories.Statement
|
||||
public static func Parse(
|
||||
node: Node, withContext context: CSTCompilerContext
|
||||
) -> Result<CST.Statement> {
|
||||
) -> Result<CST.Categories.Statement> {
|
||||
let localElementsParsers: [String: ParsableStatement.Type] = [
|
||||
"variableDeclaration": CST.VariableDeclarationStatement.self
|
||||
]
|
||||
@@ -46,10 +46,10 @@ extension CST.LocalElements: Parsable {
|
||||
}
|
||||
|
||||
extension CST.ParserState: Parsable {
|
||||
public typealias C = CST.AnState
|
||||
public typealias C = CST.Categories.State
|
||||
public static func Parse(
|
||||
node: Node, withContext context: CSTCompilerContext
|
||||
) -> Result<CST.AnState> {
|
||||
) -> Result<CST.Categories.State> {
|
||||
var walker = Walker(node: node)
|
||||
|
||||
var current_node: Node? = .none
|
||||
@@ -65,7 +65,7 @@ extension CST.ParserState: Parsable {
|
||||
|
||||
#MustOr(
|
||||
result: current_node, thing: walker.getNext(),
|
||||
or: Result<CST.AnState>.Error(
|
||||
or: Result<CST.Categories.State>.Error(
|
||||
ErrorWithLocation(
|
||||
sourceLocation: node.toSourceLocation(),
|
||||
withError: "Missing elements in parser state declaration")))
|
||||
@@ -83,7 +83,7 @@ extension CST.ParserState: Parsable {
|
||||
walker.next()
|
||||
#MustOr(
|
||||
result: current_node, thing: walker.getNext(),
|
||||
or: Result<CST.AnState>.Error(
|
||||
or: Result<CST.Categories.State>.Error(
|
||||
ErrorWithLocation(
|
||||
sourceLocation: node.toSourceLocation(),
|
||||
withError: "Missing elements in parser state declaration")))
|
||||
@@ -99,7 +99,7 @@ extension CST.ParserState: Parsable {
|
||||
walker.next()
|
||||
#MustOr(
|
||||
result: current_node, thing: walker.getNext(),
|
||||
or: Result<CST.AnState>.Error(
|
||||
or: Result<CST.Categories.State>.Error(
|
||||
ErrorWithLocation(
|
||||
sourceLocation: node.toSourceLocation(), withError: "Missing body of state declaration")
|
||||
))
|
||||
@@ -130,7 +130,7 @@ extension CST.ParserState: Parsable {
|
||||
|
||||
#MustOr(
|
||||
result: current_node, thing: walker.getNext(),
|
||||
or: Result<CST.AnState>.Error(
|
||||
or: Result<CST.Categories.State>.Error(
|
||||
ErrorWithLocation(
|
||||
sourceLocation: node.toSourceLocation(),
|
||||
withError: "Missing transition statement of state declaration")))
|
||||
|
||||
Reference in New Issue
Block a user