summaryrefslogtreecommitdiff
path: root/src/webidl-parser.y
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-08-13 23:07:23 +0100
committerVincent Sanders <vince@kyllikki.org>2015-08-13 23:07:23 +0100
commitee69169f841542c6d5d8a8c7d4b011e294d73bd8 (patch)
treeabde7636384cfc792668287545d066d962706bf0 /src/webidl-parser.y
parentb86883a7cce7d982c3f0d0069332dd490331e630 (diff)
downloadnsgenbind-ee69169f841542c6d5d8a8c7d4b011e294d73bd8.tar.gz
nsgenbind-ee69169f841542c6d5d8a8c7d4b011e294d73bd8.tar.bz2
Basic type checking for operation arguments
Arguments passed to basic operations are checked for type if they are strings, bolleans or numbers. Operations that are overloaded, special or have elipsis are not checked.
Diffstat (limited to 'src/webidl-parser.y')
-rw-r--r--src/webidl-parser.y24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index 14385d6..42fed63 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -180,6 +180,8 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> ReturnType
%type <node> SingleType
%type <node> UnionType
+%type <node> UnionMemberType
+%type <node> UnionMemberTypes
%type <node> NonAnyType
%type <node> ConstType
%type <node> PrimitiveType
@@ -1462,7 +1464,9 @@ SingleType:
|
TOK_ANY TypeSuffixStartingWithArray
{
- $$ = NULL; /* todo implement */
+ /* todo deal with TypeSuffixStartingWithArray */
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE,
+ NULL, (void *)WEBIDL_TYPE_ANY);
}
;
@@ -1470,24 +1474,40 @@ SingleType:
UnionType:
'(' UnionMemberType TOK_OR UnionMemberType UnionMemberTypes ')'
{
- $$ = NULL;
+ $$ = webidl_node_prepend($2, webidl_node_prepend($4, $5));
}
;
/* [60] */
UnionMemberType:
NonAnyType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
+ }
|
UnionType TypeSuffix
+ {
+ /* todo handle suffix */
+ $$ = $1;
+ }
|
TOK_ANY '[' ']' TypeSuffix
+ {
+ $$ = NULL;
+ }
;
/* [61] */
UnionMemberTypes:
/* empty */
+ {
+ $$ = NULL;
+ }
|
TOK_OR UnionMemberType UnionMemberTypes
+ {
+ $$ = webidl_node_prepend($2, $3);
+ }
;
/* [62]