aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 }