summaryrefslogtreecommitdiff
path: root/src/genbind-parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/genbind-parser.y')
-rw-r--r--src/genbind-parser.y62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/genbind-parser.y b/src/genbind-parser.y
new file mode 100644
index 0000000..309f01e
--- /dev/null
+++ b/src/genbind-parser.y
@@ -0,0 +1,62 @@
+/*
+ * This is a bison parser for genbind
+ *
+ */
+
+%{
+
+#include <stdio.h>
+#include <string.h>
+
+#include "genbind-parser.h"
+#include "genbind-lexer.h"
+
+ extern int loadwebidl(char *filename);
+
+void genbind_error(const char *str)
+{
+ fprintf(stderr,"error: %s\n",str);
+}
+
+
+int genbind_wrap()
+{
+ return 1;
+}
+
+
+
+%}
+
+%output "genbind-parser.c"
+%defines "genbind-parser.h"
+
+%define api.pure
+%name-prefix "genbind_"
+
+%union
+{
+ char* text;
+}
+
+%token TOK_IDLFILE
+
+%token <text> TOK_STRING_LITERAL
+
+%%
+
+ /* [1] start with instructions */
+Instructions:
+ /* empty */
+ |
+ IdlFile
+ ;
+
+IdlFile:
+ TOK_IDLFILE TOK_STRING_LITERAL
+ {
+ loadwebidl($2);
+ }
+ ;
+
+%%