From 4b043613d1a20980b13a6e9b0c8a7ff91c035b2f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 24 Sep 2012 20:29:25 +0100 Subject: add interface function return type --- src/webidl-ast.c | 5 +++-- src/webidl-ast.h | 1 + src/webidl-parser.y | 9 +++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/webidl-ast.c b/src/webidl-ast.c index 53ba7e6..91da839 100644 --- a/src/webidl-ast.c +++ b/src/webidl-ast.c @@ -25,8 +25,9 @@ struct webidl_node { struct webidl_node *l; union { void *value; - struct webidl_node *node; - char *text; + struct webidl_node *node; /* node has a list of nodes */ + char *text; /* node data is text */ + int number; /* node data is an integer */ } r; }; diff --git a/src/webidl-ast.h b/src/webidl-ast.h index 7c32d82..c41149d 100644 --- a/src/webidl-ast.h +++ b/src/webidl-ast.h @@ -39,6 +39,7 @@ enum webidl_type { WEBIDL_TYPE_OBJECT, WEBIDL_TYPE_DATE, WEBIDL_TYPE_USER, + WEBIDL_TYPE_VOID, }; enum webidl_type_modifier { diff --git a/src/webidl-parser.y b/src/webidl-parser.y index c3bb609..69fbef5 100644 --- a/src/webidl-parser.y +++ b/src/webidl-parser.y @@ -151,6 +151,7 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str) %type Ellipsis %type Type +%type ReturnType %type SingleType %type UnionType %type NonAnyType @@ -581,6 +582,8 @@ OperationRest: { struct webidl_node *operation = $4; /* argument list */ + operation = webidl_node_prepend(operation, $1); /* return type */ + operation = webidl_node_prepend(operation, $2); /* identifier */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, operation); @@ -1119,6 +1122,12 @@ ReturnType: Type | TOK_VOID + { + struct webidl_node *type; + type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID); + $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type); + } + ; %% -- cgit v1.2.3