aboutsummaryrefslogtreecommitdiff
path: root/src/parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.y')
-rw-r--r--src/parser.y30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/parser.y b/src/parser.y
index 3e0156f..742bc5f 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -29,7 +29,7 @@
%parse-param {void *scanner} {struct parser* parser}
%union {
- struct ast *ast;
+ struct lyn_value ast;
char *str;
long long integer;
double floating;
@@ -128,19 +128,19 @@ static char *strip(const char *s);
%%
arg
- : "(" cmds ")" {$$ = gen_apply($2);}
- | "{" cmds "}" {$$ = gen_list($2);}
+ : "(" cmds ")" {$$ = $2; $$.kind = LYN_APPLY;}
+ | "{" cmds "}" {$$ = $2; $$.kind = LYN_GROUP;}
| ID {$$ = gen_id($1);}
| STRING {$$ = gen_str($1);}
| INT {$$ = gen_int($1);}
| FLOAT {$$ = gen_float($1);}
rev_args
- : rev_args arg {$$ = $2; $$->next = $1;}
- | arg
+ : rev_args arg {$$ = $1; vect_append(struct lyn_value, $$.args, &$2);}
+ | arg {$$ = gen_list(); vect_append(struct lyn_value, $$.args, &$1);}
args
- : rev_args {$$ = reverse_ast_list($1);}
+ : rev_args
sep
: sep ";"
@@ -149,21 +149,21 @@ sep
| NL
cmd
- : args {$$ = gen_cmd($1);}
+ : args {$$ = $1; $$.kind = LYN_CMD;}
rev_cmds
- : rev_cmds sep cmd {$$ = $3; $$->next = $1;}
- | cmd
+ : rev_cmds sep cmd {$$ = $1; vect_append(struct lyn_value, $$.args, &$3);}
+ | cmd {$$ = gen_list(); vect_append(struct lyn_value, $$.args, &$1);}
cmds
- : rev_cmds {$$ = reverse_ast_list($1);}
- | rev_cmds sep {$$ = reverse_ast_list($1);}
- | sep rev_cmds {$$ = reverse_ast_list($2);}
- | sep rev_cmds sep {$$ = reverse_ast_list($2);}
- | {$$ = NULL;}
+ : rev_cmds
+ | rev_cmds sep
+ | sep rev_cmds {$$ = $2;}
+ | sep rev_cmds sep {$$ = $2;}
+ | {$$ = gen_list();}
input
- : cmds {parser->tree = gen_list($1);}
+ : cmds {$1.kind = LYN_GROUP; parser->tree = $1;}
%%