Start Moving Away From Queries

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-02-27 06:16:14 -05:00
parent 2c7f71dbd4
commit 2c5bfc3e1c
7 changed files with 171 additions and 117 deletions
+25 -1
View File
@@ -51,7 +51,7 @@ extension TypedIdentifier: ParseableEvaluatableExpression {
let value_capture = result.captures(named: "identifier")
guard
case Result.Ok(let type) = scopes.lookup(
identifier: Identifier(name: value_capture[0].node.text!))
identifier: Common.Identifier(name: value_capture[0].node.text!))
else {
return .Error(Error(withMessage: "Cannot find \(result.captures[0].node.text!) in scope"))
}
@@ -178,3 +178,27 @@ struct Expression {
return Result.Error(Error(withMessage: "Could not parse into expression."))
}
}
struct LValue {
public static func Parse(
node: Node, inTree: MutableTree, withScopes scopes: LexicalScopes
) -> Result<Common.Identifier> {
return if let node_text_value = node.text {
.Ok(Common.Identifier(name: node_text_value))
} else {
.Error(Error(withMessage: "Could not parse an identifier for an LValue"))
}
}
}
struct Identifier {
public static func Parse(
node: Node, inTree: MutableTree, withScopes scopes: LexicalScopes
) -> Result<Common.Identifier> {
return if let node_text_value = node.text {
.Ok(Common.Identifier(name: node_text_value))
} else {
.Error(Error(withMessage: "Could not parse an identifier from \(node)"))
}
}
}