summaryrefslogtreecommitdiff
path: root/src/webidl-ast.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-07-22 22:12:05 +0100
committerVincent Sanders <vince@kyllikki.org>2015-07-22 22:12:05 +0100
commitd36c21c4f53270f9ba8137bb1e84a7de45fea0f3 (patch)
tree4adbd1bc49738ae348009b1be6ec54c43d038d8f /src/webidl-ast.h
parent8bc392a91daf4cc1a27a8e6777af1a29ed24e3c4 (diff)
downloadnsgenbind-d36c21c4f53270f9ba8137bb1e84a7de45fea0f3.tar.gz
nsgenbind-d36c21c4f53270f9ba8137bb1e84a7de45fea0f3.tar.bz2
Load the WebIDL files specified in the binding
This loads the WebIDL specified in the bindings into an Abstract Syntax Tree (AST) and performs the mixin operations for implements. Additionally the specs now use a slightly extended IDL syntax. Instead of wholesale implementing the second edition of the IDL spec the parser has been updated to cope with iterator and Promise keywords as those are the only changes used in the dom and html specifications. A bug was also fixed in the lexer where negative int literals were not recognised.
Diffstat (limited to 'src/webidl-ast.h')
-rw-r--r--src/webidl-ast.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index a494f4e..5d0cbc0 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -90,17 +90,25 @@ int webidl_node_getint(struct webidl_node *node);
enum webidl_node_type webidl_node_gettype(struct webidl_node *node);
/* node searches */
+
+/**
+ * Iterate nodes children matching their type.
+ *
+ * For each child node where the type is matched the callback function is
+ * called with a context value.
+ */
int webidl_node_for_each_type(struct webidl_node *node,
- enum webidl_node_type type,
- webidl_callback_t *cb,
+ enum webidl_node_type type,
+ webidl_callback_t *cb,
void *ctx);
-int webidl_node_enumerate_type(struct webidl_node *node, enum webidl_node_type type);
+int webidl_node_enumerate_type(struct webidl_node *node,
+ enum webidl_node_type type);
struct webidl_node *
webidl_node_find(struct webidl_node *node,
- struct webidl_node *prev,
- webidl_callback_t *cb,
+ struct webidl_node *prev,
+ webidl_callback_t *cb,
void *ctx);
struct webidl_node *
@@ -114,13 +122,26 @@ webidl_node_find_type_ident(struct webidl_node *root_node,
const char *ident);
-/* debug dump */
-int webidl_ast_dump(struct webidl_node *node, int indent);
-/** parse web idl file */
+/**
+ * parse web idl file into Abstract Syntax Tree
+ */
int webidl_parsefile(char *filename, struct webidl_node **webidl_ast);
-/** perform replacement of implements elements with copies of ast data */
+/**
+ * dump AST to file
+ */
+int webidl_dump_ast(struct webidl_node *node);
+
+/**
+ * perform replacement of implements elements with copies of ast data
+ */
int webidl_intercalate_implements(struct webidl_node *node);
+/**
+ * formatted printf to allow webidl trace data to be written to file.
+ */
+int webidl_fprintf(FILE *stream, const char *format, ...);
+
+
#endif