diff options
Diffstat (limited to 'src/genjsbind-parser.y')
-rw-r--r-- | src/genjsbind-parser.y | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/genjsbind-parser.y b/src/genjsbind-parser.y new file mode 100644 index 0000000..08b8926 --- /dev/null +++ b/src/genjsbind-parser.y @@ -0,0 +1,60 @@ +/* + * This is a bison parser for genbind + * + */ + +%{ + +#include <stdio.h> +#include <string.h> + +#include "genjsbind-parser.h" +#include "genjsbind-lexer.h" +#include "genjsbind.h" + +static void genjsbind_error(const char *str) +{ + fprintf(stderr,"error: %s\n",str); +} + + +int genjsbind_wrap() +{ + return 1; +} + + + +%} + +%define api.pure + +%union +{ + char* text; +} + +%token TOK_IDLFILE + +%token <text> TOK_STRING_LITERAL + +%% + + /* [1] start with Statements */ +Statements: + /* empty */ + | + IdlFile + ; + + /* [2] load a web IDL file */ +IdlFile: + TOK_IDLFILE TOK_STRING_LITERAL ';' + { + if (loadwebidl($2) != 0) { + YYABORT; + } + } + ; + +%% |