aboutsummaryrefslogtreecommitdiff
path: root/gfsm/gfsm/src/libgfsm/tests/calctest.l
diff options
context:
space:
mode:
Diffstat (limited to 'gfsm/gfsm/src/libgfsm/tests/calctest.l')
-rw-r--r--gfsm/gfsm/src/libgfsm/tests/calctest.l52
1 files changed, 52 insertions, 0 deletions
diff --git a/gfsm/gfsm/src/libgfsm/tests/calctest.l b/gfsm/gfsm/src/libgfsm/tests/calctest.l
new file mode 100644
index 0000000..1a03bc1
--- /dev/null
+++ b/gfsm/gfsm/src/libgfsm/tests/calctest.l
@@ -0,0 +1,52 @@
+/*======================================================================
+ * Flex Options
+ */
+%option outfile="calctest.lex.c"
+%option header-file="calctest.lex.h"
+%option prefix="calctest_yy"
+%option reentrant
+%option 8bit
+
+%option bison-bridge
+
+%{
+/*======================================================================
+ * User C Header
+ */
+
+/* bison stuff */
+#include "calctest.tab.h"
+
+%}
+
+/*======================================================================
+ * Flex Definitions
+ */
+
+
+/*======================================================================
+ * Flex Rules
+ */
+%%
+
+([[:digit:]]*\.?)[[:digit:]]+ { yylval->dbl = strtod(yytext,NULL); return NUMBER;}
+
+\( { return LPAREN; }
+\) { return RPAREN; }
+\+ { return PLUS; }
+\- { return MINUS; }
+\* { return TIMES; }
+\/ { return DIV; }
+
+\n { return NEWLINE; }
+
+. { return OTHER; /* ignore */ }
+
+%%
+
+/*======================================================================
+ * User C Code
+ */
+
+//-- wrapper: don't
+int calctest_yywrap(yyscan_t yyscanner) { return 1; }