summaryrefslogtreecommitdiff
path: root/as/as.l
diff options
context:
space:
mode:
Diffstat (limited to 'as/as.l')
-rw-r--r--as/as.l25
1 files changed, 25 insertions, 0 deletions
diff --git a/as/as.l b/as/as.l
new file mode 100644
index 0000000..059b7c3
--- /dev/null
+++ b/as/as.l
@@ -0,0 +1,25 @@
+%{
+#include <inttypes.h>
+#include "as.tab.h"
+%}
+
+NONDIGIT [_a-zA-Z]
+DIGIT [0-9]
+IDENTIFIERS [_a-zA-Z0-9]
+
+%x COMMENT
+
+%%
+
+{DIGIT}+ { yylval.n = strtoumax(yytext, NULL, 10); return NUMBER; }
+
+{NONDIGIT}{IDENTIFIERS}* { yylval.s = yytext; return TOKEN; }
+
+:|,|\. { return yytext[0]; }
+\n { return NEWLINE; }
+
+; { BEGIN COMMENT; }
+<COMMENT>. ;
+<COMMENT>\n { BEGIN INITIAL; return NEWLINE; }
+
+. ;