summaryrefslogtreecommitdiffstats
path: root/moon-abe/pbc-0.5.14/pbc/parser.lex
diff options
context:
space:
mode:
authorRuan HE <ruan.he@orange.com>2015-09-04 07:35:06 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-09-04 07:35:06 +0000
commitca6aa8198d2335f8c326c3dd4d26bf5899064214 (patch)
tree6274a2d971fc0cac0896efe8583927d0190e3d20 /moon-abe/pbc-0.5.14/pbc/parser.lex
parent92fd2dbfb672d7b2b1cdfd5dd5cf89f7716b3e12 (diff)
parent3baeb11a8fbcfcdbc31976d421f17b85503b3ecd (diff)
Merge "init attribute-based encryption"
Diffstat (limited to 'moon-abe/pbc-0.5.14/pbc/parser.lex')
-rw-r--r--moon-abe/pbc-0.5.14/pbc/parser.lex56
1 files changed, 56 insertions, 0 deletions
diff --git a/moon-abe/pbc-0.5.14/pbc/parser.lex b/moon-abe/pbc-0.5.14/pbc/parser.lex
new file mode 100644
index 00000000..1d0b9f23
--- /dev/null
+++ b/moon-abe/pbc-0.5.14/pbc/parser.lex
@@ -0,0 +1,56 @@
+%{
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdint.h> // for intptr_t
+#include <gmp.h>
+#include "pbc_utils.h"
+#include "pbc_field.h"
+
+#include "pbc_tree.h"
+#define YYSTYPE tree_ptr
+#include "parser.tab.h"
+
+extern int option_easy;
+
+%}
+
+%option nounput noinput
+
+%x COMMENT
+%%
+\/\* BEGIN(COMMENT); // Open C-style comment.
+<COMMENT>\*\/ BEGIN(0); // Close C-style comment.
+<COMMENT>. // Within a C-style comment.
+<COMMENT>\n // Within a C-style comment.
+#.*$ // Comment.
+[ \t\r]* // Whitespace.
+
+define return DEFINE;
+[0-9]+ yylval = tree_new_z(yytext); return NUM;
+[a-zA-Z_][a-zA-Z0-9_]* yylval = tree_new_id(yytext); return ID;
+:= return ASSIGN;
+== return EQ;
+!= return NE;
+\< return LT;
+\> return T_GT;
+\<= return LE;
+\>= return GE;
+\+ return PLUS;
+- return MINUS;
+\/ return DIVIDE;
+\* return TIMES;
+\^ return POW;
+; return TERMINATOR;
+\, return COMMA;
+\? return QUESTION;
+: return COLON;
+\( return LPAR;
+\) return RPAR;
+\[ return LSQU;
+\] return RSQU;
+\{ return LBRACE;
+\} return RBRACE;
+\n if (option_easy) return TERMINATOR;
+= return option_easy ? ASSIGN : UNKNOWN;
+. return UNKNOWN;
+%%