summaryrefslogtreecommitdiff
path: root/g.peg
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-06-26 22:45:16 +0100
committerubq323 <ubq323@ubq323.website>2024-06-26 22:45:16 +0100
commita559125a2d7af771784614b7a2092cc7fb707345 (patch)
tree4e4f31197d28a41b5c62fdd19086295cf0acad84 /g.peg
parent2e62b41072738142dea9f0b5dd5d2d22455c7616 (diff)
array literals
Diffstat (limited to 'g.peg')
-rw-r--r--g.peg6
1 files changed, 6 insertions, 0 deletions
diff --git a/g.peg b/g.peg
index dccf361..056ca7a 100644
--- a/g.peg
+++ b/g.peg
@@ -29,12 +29,18 @@ expr <-
/ n:number { $$ = n; }
/ i:ident { $$ = i; }
/ t:string { $$ = t; }
+ / a:array { $$ = a; }
list <- { $$ = astnode_new_list(); }
'('
( e:expr { astnode_append(&$$, e); }
)*
')' _
+array <- { $$ = astnode_new_arr(); }
+ '['
+ ( e:expr { astnode_append(&$$, e); }
+ )*
+ ']' _
number <- < [0-9]+ > (! ident_char) _ { $$ = astnode_new_num(atoi($1)); }
ident <- < ident_char+ > _ { $$ = astnode_new_ident($1); }