diff options
author | ubq323 <ubq323@ubq323.website> | 2024-06-26 22:45:16 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-06-26 22:45:16 +0100 |
commit | a559125a2d7af771784614b7a2092cc7fb707345 (patch) | |
tree | 4e4f31197d28a41b5c62fdd19086295cf0acad84 /g.peg | |
parent | 2e62b41072738142dea9f0b5dd5d2d22455c7616 (diff) |
array literals
Diffstat (limited to 'g.peg')
-rw-r--r-- | g.peg | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); } |