commit 389d0bbd3c9586137b780c61cc2ea30029fc9f58
parent 9d6209961c2e5e64626cda76e42abc57683816d0
Author: Tomas Hlavaty <tom@logand.com>
Date: Thu, 8 Dec 2011 00:00:49 +0100
parser fixes
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/parse.y b/parse.y
@@ -38,7 +38,7 @@ Any ast;
%token OUT INOUT ONEWAY GET SET PUBLISHED ELLIPSIS
%token REMOVABLE
-%token METHOD CONSTRUCTOR RELATIVE ABSOLUTE TEMPLATE EXP
+%token METHOD CONSTRUCTOR RELATIVE ABSOLUTE TEMPLATE EXP DEFTEMPLATE
%%
@@ -62,7 +62,8 @@ struct_members: struct_member {$$ = list1($1);}
| struct_member struct_members {$$ = cons($1, $2);};
struct_member: type identifier SEMICOLON {$$ = list2($2, $1);};
deftemplate: published STRUCT identifier struct_params
- LCURLY template_members RCURLY SEMICOLON {$$ = cons5($2, $3, $1, $4, $6);};
+ LCURLY template_members RCURLY SEMICOLON
+ {$$ = cons5(mk(DEFTEMPLATE, "deftemplate"), $3, $1, $4, $6);};
struct_params: LT identifiers GT {$$ = $2;};
identifiers: identifier {$$ = list1($1);}
| identifier COMMA identifiers {$$ = cons($1, $3)};
@@ -148,10 +149,13 @@ interface_singleton: published SINGLETON identifier COLON name SEMICOLON
service_singleton: published SINGLETON identifier
LCURLY SERVICE name SEMICOLON RCURLY SEMICOLON
{$$ = list5($2, $3, $1, $6, T);};
-type: simple_type {$$ = list1($1);} | sequence_type | template_type | name;
-simple_type: VOID | BOOLEAN | BYTE | SHORT | UNSIGNED SHORT | LONG
- | UNSIGNED LONG | HYPER | UNSIGNED HYPER | FLOAT | DOUBLE | CHAR
- | STRING | TYPE | ANY;
+type: simple_type {$$ = list1($1);} | unsigned_type | sequence_type
+ | template_type | name;
+simple_type: VOID | BOOLEAN | BYTE | SHORT | LONG | HYPER | FLOAT | DOUBLE
+ | CHAR | STRING | TYPE | ANY;
+unsigned_type: UNSIGNED SHORT {$$ = list2($1, $2);}
+ | UNSIGNED LONG {$$ = list2($1, $2);}
+ | UNSIGNED HYPER {$$ = list2($1, $2);};
sequence_type: SEQUENCE LT type GT {$$ = list2($1, $3);};
template_type: name LT type types GT
{$$ = list3(mk(TEMPLATE, "template"), $1, cons($3, $4));};