Add list expressions to grammar/ast.

This commit is contained in:
Jesse Brault 2025-09-19 12:57:53 -05:00
parent 49a96eba85
commit e795664a09
2 changed files with 19 additions and 0 deletions

View File

@ -291,6 +291,9 @@ Class:
- class_level_declarations:
rule: ClassLevelDeclaration
vec: true
- end_kw:
rule: End
skip: true
# Function constructs
Function:
@ -604,6 +607,9 @@ Expression:
- Closure:
inner:
kind: Closure
- List:
inner:
kind: ListExpression
build:
kind: TernaryExpression
TernaryExpression:
@ -888,9 +894,15 @@ PrimaryExpression:
- Closure:
wrap:
enum_variant: Closure
- ListExpression:
wrap:
enum_variant: List
- ParenthesizedExpression:
return_build:
kind: Expression
ListExpression:
children:
- expression_list
ParenthesizedExpression:
children:
- expression

View File

@ -726,9 +726,16 @@ PrimaryExpression = {
Literal
| FullyQualifiedName
| Closure
| ListExpression
| ParenthesizedExpression
}
ListExpression = {
"["
~ ExpressionList?
~ "]"
}
ParenthesizedExpression = {
"("
~ Expression