summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2012-09-14 00:37:09 +0100
committerVincent Sanders <vince@kyllikki.org>2012-09-14 00:37:09 +0100
commit6ccbb7e3fe88c9a6ddb232c43f71b9c8cb80a884 (patch)
tree2cc3ae4e1e57816daa1b9886e840b8f77e8b3f31 /src
parent8b775d2a309a72729e08a0529717852605d82fe5 (diff)
downloadnsgenbind-6ccbb7e3fe88c9a6ddb232c43f71b9c8cb80a884.tar.gz
nsgenbind-6ccbb7e3fe88c9a6ddb232c43f71b9c8cb80a884.tar.bz2
fixus interface memer attributes
Diffstat (limited to 'src')
-rw-r--r--src/jsapi-libdom.c2
-rw-r--r--src/webidl-ast.c24
-rw-r--r--src/webidl-ast.h5
-rw-r--r--src/webidl-parser.y26
4 files changed, 43 insertions, 14 deletions
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 0f4ebc4..e7c13d2 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -83,7 +83,7 @@ int jsapi_libdom_output(char *outfilename, struct genbind_node *genbind_ast)
}
if (options->verbose) {
- webidl_ast_dump(webidl_ast);
+ webidl_ast_dump(webidl_ast, 0);
}
/* open output file */
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index be52490..5ae52f0 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -71,7 +71,7 @@ webidl_node_for_each_type(struct webidl_node *node,
char *webidl_node_gettext(struct webidl_node *node)
{
switch(node->type) {
- case WEBIDL_NODE_TYPE_INTERFACE_IDENT:
+ case WEBIDL_NODE_TYPE_IDENT:
case WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE:
return node->r.text;
@@ -87,6 +87,7 @@ struct webidl_node *webidl_node_getnode(struct webidl_node *node)
case WEBIDL_NODE_TYPE_ROOT:
case WEBIDL_NODE_TYPE_INTERFACE:
case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
+ case WEBIDL_NODE_TYPE_ATTRIBUTE:
return node->r.node;
default:
@@ -100,35 +101,40 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_ROOT:
return "root";
- case WEBIDL_NODE_TYPE_INTERFACE_IDENT:
- return "Interface: Ident";
+ case WEBIDL_NODE_TYPE_IDENT:
+ return "Ident";
case WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE:
- return "Interface: Inherit";
+ return "Inherit";
case WEBIDL_NODE_TYPE_INTERFACE:
return "Interface";
case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
- return "Interface: Members";
+ return "Members";
+
+ case WEBIDL_NODE_TYPE_ATTRIBUTE:
+ return "Attribute";
default:
return "Unknown";
}
}
+const char *SPACES=" ";
-int webidl_ast_dump(struct webidl_node *node)
+int webidl_ast_dump(struct webidl_node *node, int indent)
{
char *txt;
while (node != NULL) {
- printf("%s\n", webidl_node_type_to_str(node->type));
+ printf("%.*s%s", indent, SPACES, webidl_node_type_to_str(node->type));
txt = webidl_node_gettext(node);
if (txt == NULL) {
- webidl_ast_dump(webidl_node_getnode(node));
+ printf("\n");
+ webidl_ast_dump(webidl_node_getnode(node), indent + 2);
} else {
- printf(" %s\n", txt);
+ printf(": \"%s\"\n", txt);
}
node = node->l;
}
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index 9a516af..04b49a9 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -11,10 +11,11 @@
enum webidl_node_type {
WEBIDL_NODE_TYPE_ROOT = 0,
+ WEBIDL_NODE_TYPE_IDENT,
WEBIDL_NODE_TYPE_INTERFACE,
- WEBIDL_NODE_TYPE_INTERFACE_IDENT,
WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
+ WEBIDL_NODE_TYPE_ATTRIBUTE,
};
struct webidl_node {
@@ -46,7 +47,7 @@ int webidl_node_for_each_type(struct webidl_node *node,
void *ctx);
/* debug dump */
-int webidl_ast_dump(struct webidl_node *node);
+int webidl_ast_dump(struct webidl_node *node, int indent);
/** parse web idl file */
int webidl_parsefile(char *filename, struct webidl_node **webidl_ast);
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index c899001..c4cfa56 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -130,6 +130,13 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> CallbackRest
%type <node> CallbackRestOrInterface
+%type <node> Attribute
+%type <node> AttributeOrOperation
+%type <node> StringifierAttributeOrOperation
+%type <node> Const
+%type <node> Operation
+%type <node> OperationRest
+
%%
/* default rule to add built AST to passed in one */
@@ -207,7 +214,7 @@ Interface:
members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS, inheritance, $5);
- ident = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_IDENT, members, $2);
+ ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2);
$$ = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, NULL, ident);
}
@@ -245,7 +252,7 @@ InterfaceMembers:
|
InterfaceMembers ExtendedAttributeList InterfaceMember
{
- $$ = webidl_node_link($1, $3);
+ $$ = webidl_node_link($3, $1);
}
;
@@ -373,6 +380,9 @@ ImplementsStatement:
/* [26] */
Const:
TOK_CONST ConstType TOK_IDENTIFIER '=' ConstValue ';'
+ {
+ $$ = NULL;
+ }
;
/* [27] */
@@ -423,12 +433,18 @@ StringifierAttributeOrOperation:
OperationRest
|
';'
+ {
+ $$=NULL;
+ }
;
/* [32] */
Attribute:
Inherit ReadOnly TOK_ATTRIBUTE Type TOK_IDENTIFIER ';'
{
+ struct webidl_node *ident;
+ ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, ident);;
}
;
@@ -449,6 +465,9 @@ ReadOnly:
/* [35] */
Operation:
Qualifiers OperationRest
+ {
+ $$=$2;
+ }
;
/* [36] */
@@ -481,6 +500,9 @@ Special:
/* [39] */
OperationRest:
ReturnType OptionalIdentifier '(' ArgumentList ')' ';'
+ {
+ $$=NULL;
+ }
;
/* [40] */