From e795664a09de50c9fe3093b4c9b923a135be34d7 Mon Sep 17 00:00:00 2001 From: Jesse Brault Date: Fri, 19 Sep 2025 12:57:53 -0500 Subject: [PATCH] Add list expressions to grammar/ast. --- src/parser/ast.yaml | 12 ++++++++++++ src/parser/deimos.pest | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/src/parser/ast.yaml b/src/parser/ast.yaml index 36d1fb4..792c26a 100644 --- a/src/parser/ast.yaml +++ b/src/parser/ast.yaml @@ -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 diff --git a/src/parser/deimos.pest b/src/parser/deimos.pest index 741cda5..626c911 100644 --- a/src/parser/deimos.pest +++ b/src/parser/deimos.pest @@ -726,9 +726,16 @@ PrimaryExpression = { Literal | FullyQualifiedName | Closure + | ListExpression | ParenthesizedExpression } +ListExpression = { + "[" + ~ ExpressionList? + ~ "]" +} + ParenthesizedExpression = { "(" ~ Expression