summaryrefslogtreecommitdiff
path: root/src/genbind-lexer.l
diff options
context:
space:
mode:
authorVincent Sanders <vincent.sanders@collabora.co.uk>2012-09-04 16:36:01 +0100
committerVincent Sanders <vincent.sanders@collabora.co.uk>2012-09-04 16:36:01 +0100
commitdc672aedbafa7bf24cd24430abcae2d57528cf41 (patch)
tree269e737cb8adb48def5955bb5b4db6833ffd60e1 /src/genbind-lexer.l
downloadnsgenbind-dc672aedbafa7bf24cd24430abcae2d57528cf41.tar.gz
nsgenbind-dc672aedbafa7bf24cd24430abcae2d57528cf41.tar.bz2
Initial version of netsurf webidl javascript binding geenrator tool
Diffstat (limited to 'src/genbind-lexer.l')
-rw-r--r--src/genbind-lexer.l55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/genbind-lexer.l b/src/genbind-lexer.l
new file mode 100644
index 0000000..010a384
--- /dev/null
+++ b/src/genbind-lexer.l
@@ -0,0 +1,55 @@
+/*
+ * binding generator lexer
+ */
+
+/* lexer options */
+%option outfile="genbind-lexer.c"
+%option header-file="genbind-lexer.h"
+%option never-interactive
+%option bison-bridge
+%option nodefault
+%option warn
+%option debug
+%option prefix="genbind_"
+%option nounput
+
+/* header block */
+%{
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "genbind-parser.h"
+
+%}
+
+ /* other Unicode “space separator” */
+USP (\xe1\x9a\x80)|(\xe1\xa0\x8e)|(\xe2\x80[\x80-\x8a])|(\xe2\x80\xaf)|(\xe2\x81\x9f)|(\xe3\x80\x80)
+
+/* non breaking space \u00A0 */
+NBSP (\xc2\xa0)
+
+whitespace ([ \t\v\f\n]|{NBSP}|{USP})
+
+multicomment \/\*(([^*])|(\*[^/]))*\*\/
+
+quotedstring [^\"\\\n\r]
+
+other [^\t\n\r 0-9A-Z_a-z]
+
+%%
+
+{whitespace} /* nothing */
+
+webidlfile return TOK_IDLFILE;
+
+\"{quotedstring}*\" yylval->text = strndup(yytext + 1,strlen(yytext+1) - 1 ); return TOK_STRING_LITERAL;
+
+{multicomment} /* nothing */
+
+{other} return (int) yytext[0];
+
+. /* nothing */
+
+%% \ No newline at end of file