aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-03-23 18:41:26 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-03-23 18:41:26 +0100
commitb15f6509f419abdebd50d7c525031948e59a0158 (patch)
treeb432c3b5e187d3fe6fb55b2ba12ee64477998cd7
parent0e1c3677c825def2000cd3f0382b2434f18d4838 (diff)
Some kind of vector
-rw-r--r--parser.y18
1 files changed, 12 insertions, 6 deletions
diff --git a/parser.y b/parser.y
index 2d08c73..8b7482a 100644
--- a/parser.y
+++ b/parser.y
@@ -5,11 +5,12 @@ import "fmt"
%}
%union {
- sval S
- ival I
- fval F
- cval C
- any interface{}
+ sval S
+ ival I
+ fval F
+ cval C
+ any interface{}
+ vector []interface{}
}
%token <sval> STRING QUOTED
@@ -27,12 +28,17 @@ import "fmt"
%token ENCLOSE DISCLOSE DECODE ENCODE MAGNITUDE SCAN REDUCE
%type <any> value
+%type <vector> vector
%%
line
: /* empty */
- | value { fmt.Println($1) }
+ | vector { fmt.Println($1) }
+
+vector
+ : value { $$ = append($$, $1) }
+ | vector value { $$ = append($1, $2) }
value
: STRING { $$ = $1 }