WIP name gather, add fields for struct nodes.

# Conflicts:
#	src/name_analysis/gather.rs
This commit is contained in:
Jesse Brault 2025-10-08 17:23:56 -05:00
parent 6d37545b35
commit 5d41a22899
3 changed files with 62 additions and 18 deletions

View File

@ -228,6 +228,9 @@ fn gather_node(
AstNodeRef::IfElse(_) => {} AstNodeRef::IfElse(_) => {}
AstNodeRef::WhileStatement(_) => {} AstNodeRef::WhileStatement(_) => {}
AstNodeRef::ForStatement(_) => {} AstNodeRef::ForStatement(_) => {}
AstNodeRef::LValue(_) => {},
AstNodeRef::LValueSuffix(_) => {},
AstNodeRef::VariableUse(_) => {},
AstNodeRef::Expression(_) => {} AstNodeRef::Expression(_) => {}
AstNodeRef::TernaryExpression(_) => {} AstNodeRef::TernaryExpression(_) => {}
AstNodeRef::TernaryRhs(_) => {} AstNodeRef::TernaryRhs(_) => {}

View File

@ -1,16 +1,16 @@
# $schema: ./ast.schema.yaml # $schema: ./ast.schema.yaml
# Operators # Operators
Operator: Operator:
struct: struct:
children: children:
- inner: - inner:
member: member:
rule: OperatorInner rule: OperatorInner
- file_id: - file_id:
special: special:
kind: file_id kind: file_id
- range: - range:
special: special:
kind: range kind: range
OperatorInner: OperatorInner:
leaf_enum: leaf_enum:
@ -442,24 +442,24 @@ PlatformFunction:
- parameters - parameters
- return_type - return_type
PlatformOperatorFunction: PlatformOperatorFunction:
struct: struct:
children: children:
- is_public: - is_public:
member: member:
rule: Pub rule: Pub
build: build:
boolean: boolean:
on: rule_present on: rule_present
- platform_kw: - platform_kw:
skip: skip:
rule: Platform rule: Platform
- op_kw: - op_kw:
skip: skip:
rule: Op rule: Op
- generics: - generics:
member: member:
rule: GenericParameters rule: GenericParameters
build: build:
node: node:
or_else_default: true or_else_default: true
- operator - operator
@ -628,12 +628,8 @@ VariableDeclaration:
AssignmentStatement: AssignmentStatement:
struct: struct:
children: children:
- left: - l_value
member: - expression
rule: Expression
- right:
member:
rule: Expression
ExpressionStatement: ExpressionStatement:
struct: struct:
children: children:
@ -715,6 +711,26 @@ ForStatement:
skip: skip:
rule: End rule: End
# LValue
LValue:
struct:
children:
- variable_use
- suffixes:
vec:
rule: LValueSuffix
LValueSuffix:
tree_enum:
rules:
- ObjectProperty
- ObjectIndex
# VariableUse
VariableUse:
struct:
children:
- identifier
# Expressions # Expressions
Expression: Expression:
polymorphic_type: polymorphic_type:
@ -749,6 +765,9 @@ Expression:
- Literal: - Literal:
inner: inner:
kind: Literal kind: Literal
- VariableUse:
inner:
kind: VariableUse
- Fqn: - Fqn:
inner: inner:
kind: FullyQualifiedName kind: FullyQualifiedName
@ -1091,6 +1110,9 @@ PrimaryExpression:
- Literal: - Literal:
inner: inner:
kind: Literal kind: Literal
- VariableUse:
inner:
kind: VariableUse
- Fqn: - Fqn:
inner: inner:
kind: FullyQualifiedName kind: FullyQualifiedName

View File

@ -542,7 +542,7 @@ VariableDeclaration = {
} }
AssignmentStatement = { AssignmentStatement = {
Expression LValue
~ "=" ~ "="
~ Expression ~ Expression
} }
@ -593,6 +593,24 @@ ForStatement = {
~ End ~ End
} }
// LValue
LValue = {
VariableUse
~ LValueSuffix*
}
LValueSuffix = {
ObjectProperty
| ObjectIndex
}
// Variable Use
VariableUse = {
Identifier
}
// Expressions // Expressions
Expression = { Expression = {
@ -741,6 +759,7 @@ ObjectIndex = {
PrimaryExpression = { PrimaryExpression = {
Literal Literal
| VariableUse
| FullyQualifiedName | FullyQualifiedName
| Closure | Closure
| ListExpression | ListExpression