diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-08-02 18:30:18 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-08-02 18:30:18 +0100 |
commit | cf89528fc6668e6d07b6e99db0069c9fe1f6e05d (patch) | |
tree | ba537f31127428c54b70d8cc9a190b3702f0f8b3 /src/webidl-parser.y | |
parent | 6fb336e6587d550bf4a8355e65923efb0bf14cab (diff) | |
download | nsgenbind-cf89528fc6668e6d07b6e99db0069c9fe1f6e05d.tar.gz nsgenbind-cf89528fc6668e6d07b6e99db0069c9fe1f6e05d.tar.bz2 |
Update the webidl parser to cope with specials and overloaded methods
Diffstat (limited to 'src/webidl-parser.y')
-rw-r--r-- | src/webidl-parser.y | 82 |
1 files changed, 62 insertions, 20 deletions
diff --git a/src/webidl-parser.y b/src/webidl-parser.y index a48f3fd..953388e 100644 --- a/src/webidl-parser.y +++ b/src/webidl-parser.y @@ -155,6 +155,9 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str) %type <node> Const %type <node> Operation +%type <node> SpecialOperation +%type <node> Specials +%type <node> Special %type <node> OperationRest %type <node> OptionalIdentifier @@ -723,55 +726,94 @@ ReadOnly: } ; - /* [35] */ + /* SE[47] */ Operation: - Qualifiers OperationRest + ReturnType OperationRest { - /* @todo fix qualifiers */ - $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, $2); + /* put return type on the operation */ + $2 = webidl_node_prepend($1, $2); + + $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, $2); + } + | + SpecialOperation + { + $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, $1); } ; - /* [36] */ -Qualifiers: - TOK_STATIC - | - Specials + /* SE[48] */ +SpecialOperation: + Special Specials ReturnType OperationRest + { + /* put return type on the operation */ + $$ = webidl_node_prepend($4, $3); + + /* specials */ + $$ = webidl_node_prepend($$, $2); + + /* special */ + $$ = webidl_node_prepend($$, $1); + } ; - /* [37] */ + /* SE[49] */ Specials: /* empty */ + { + $$ = NULL; + } | Special Specials + { + $$ = webidl_node_prepend($2, $1); + } ; - /* [38] */ + /* SE[50] */ Special: TOK_GETTER + { + $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, (void *)WEBIDL_TYPE_SPECIAL_GETTER); + } | TOK_SETTER + { + $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, (void *)WEBIDL_TYPE_SPECIAL_SETTER); + } | TOK_CREATOR + { + /* second edition removed this special but teh + specifications still use it! + */ + $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, (void *)WEBIDL_TYPE_SPECIAL_CREATOR); + } | TOK_DELETER + { + $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, (void *)WEBIDL_TYPE_SPECIAL_DELETER); + } | TOK_LEGACYCALLER + { + $$ = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, (void *)WEBIDL_TYPE_SPECIAL_LEGACYCALLER); + } ; - /* [39] */ + /* SE[51] */ OperationRest: - ReturnType OptionalIdentifier '(' ArgumentList ')' ';' + OptionalIdentifier '(' ArgumentList ')' ';' { - struct webidl_node *arglist; - - /* put return type in argument list */ - arglist = webidl_node_prepend($4, $1); - /* argument list */ - $$ = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, arglist); + $$ = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, $3); - $$ = webidl_node_prepend($$, $2); /* identifier */ + $$ = webidl_node_prepend($1, $$); /* identifier */ } ; |