@@ -28,7 +28,8 @@ protocol ParseableEvaluatableExpression {
|
||||
|
||||
extension TypedIdentifier: ParseableEvaluatableExpression {
|
||||
static func parse(
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree, withScopes scopes: LexicalScopes
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree,
|
||||
withScopes scopes: LexicalScopes
|
||||
) -> Result<EvaluatableExpression?> {
|
||||
|
||||
guard
|
||||
@@ -61,7 +62,8 @@ extension TypedIdentifier: ParseableEvaluatableExpression {
|
||||
|
||||
extension P4BooleanValue: ParseableEvaluatableExpression {
|
||||
static func parse(
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree, withScopes scopes: LexicalScopes
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree,
|
||||
withScopes scopes: LexicalScopes
|
||||
) -> Result<EvaluatableExpression?> {
|
||||
|
||||
guard
|
||||
@@ -101,7 +103,8 @@ extension P4BooleanValue: ParseableEvaluatableExpression {
|
||||
|
||||
extension P4IntValue: ParseableEvaluatableExpression {
|
||||
static func parse(
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree, withScopes scopes: LexicalScopes
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree,
|
||||
withScopes scopes: LexicalScopes
|
||||
) -> Result<EvaluatableExpression?> {
|
||||
|
||||
guard
|
||||
@@ -132,7 +135,8 @@ extension P4IntValue: ParseableEvaluatableExpression {
|
||||
|
||||
extension P4StringValue: ParseableEvaluatableExpression {
|
||||
static func parse(
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree, withScopes scopes: LexicalScopes
|
||||
node: SwiftTreeSitter.Node, inTree tree: SwiftTreeSitter.MutableTree,
|
||||
withScopes scopes: LexicalScopes
|
||||
) -> Result<EvaluatableExpression?> {
|
||||
|
||||
guard
|
||||
@@ -202,4 +206,3 @@ extension ExpressionStatement: ParseableStatement {
|
||||
return Result.Ok((.none, scopes))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
import Common
|
||||
|
||||
public typealias LexicalScope = Scope<P4Type>
|
||||
public typealias LexicalScopes = Scopes<P4Type>
|
||||
public typealias LexicalScopes = Scopes<P4Type>
|
||||
|
||||
@@ -70,8 +70,10 @@ extension VariableDeclarationStatement: ParseableStatement {
|
||||
if rvalue.type().eq(rhs: declaration_p4_type) {
|
||||
return Result.Ok(
|
||||
(
|
||||
VariableDeclarationStatement(identifier: Identifier(name: variable_name), withInitializer: rvalue),
|
||||
scopes.declare(identifier: Identifier(name: variable_name), withValue: declaration_p4_type)
|
||||
VariableDeclarationStatement(
|
||||
identifier: Identifier(name: variable_name), withInitializer: rvalue),
|
||||
scopes.declare(
|
||||
identifier: Identifier(name: variable_name), withValue: declaration_p4_type)
|
||||
))
|
||||
|
||||
} else {
|
||||
|
||||
@@ -51,4 +51,4 @@ public struct Types {
|
||||
}
|
||||
return Result.Error(Error(withMessage: "Type name not recognized"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user