summaryrefslogtreecommitdiff
path: root/rdns_scan/zmap4rdns/src/lexer.l
diff options
context:
space:
mode:
Diffstat (limited to 'rdns_scan/zmap4rdns/src/lexer.l')
-rw-r--r--rdns_scan/zmap4rdns/src/lexer.l36
1 files changed, 36 insertions, 0 deletions
diff --git a/rdns_scan/zmap4rdns/src/lexer.l b/rdns_scan/zmap4rdns/src/lexer.l
new file mode 100644
index 0000000..48e0ad2
--- /dev/null
+++ b/rdns_scan/zmap4rdns/src/lexer.l
@@ -0,0 +1,36 @@
+/*
+ * ZMap Copyright 2013 Regents of the University of Michigan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+%{
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#pragma GCC diagnostic ignored "-Wmissing-noreturn"
+
+#include <string.h>
+#include "parser.h"
+
+%}
+
+%option noinput
+%option nounput
+%%
+[0-9]+ yylval.int_literal = (uint64_t) atoll(yytext); return T_NUMBER;
+\n /* Ignore end of line */
+[ \t]+ /* Ignore whitespace */
+!= return T_NOT_EQ;
+>= return T_GT_EQ;
+"<=" return T_LT_EQ;
+&& return T_AND;
+"||" return T_OR;
+= return '=';
+">" return '>';
+"<" return '<';
+"(" return '(';
+")" return ')';
+[a-zA-Z][-_a-zA-Z0-9]+ yylval.string_literal = strdup(yytext); return T_FIELD;
+
+%%