summaryrefslogtreecommitdiff
path: root/examples/manual/front.lex
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-05-21 17:42:36 +0900
committerKim Kibum <kb0929.kim@samsung.com>2012-05-21 17:42:36 +0900
commit2ae147a745432eb1f8d2c72b4dc22351e3534b5c (patch)
treecfbde0d1f4e0d05d6b92eb8e71485f6d36a2145a /examples/manual/front.lex
parentc22a3ed09b982b93feb23655eba7b55fa27885cb (diff)
downloadflex-2ae147a745432eb1f8d2c72b4dc22351e3534b5c.tar.gz
flex-2ae147a745432eb1f8d2c72b4dc22351e3534b5c.tar.bz2
flex-2ae147a745432eb1f8d2c72b4dc22351e3534b5c.zip
Upload Tizen:Base source
Diffstat (limited to 'examples/manual/front.lex')
-rw-r--r--examples/manual/front.lex40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/manual/front.lex b/examples/manual/front.lex
new file mode 100644
index 0000000..449cb00
--- /dev/null
+++ b/examples/manual/front.lex
@@ -0,0 +1,40 @@
+%{
+#include <stdio.h>
+#include <string.h>
+#include "y.tab.h" /* this comes from bison */
+
+#define TRUE 1
+#define FALSE 0
+
+#define copy_and_return(token_type) { strcpy(yylval.name,yytext); \
+ return(token_type); }
+
+int yylexlinenum = 0; /* so we can count lines */
+%}
+
+%%
+ /* Lexical scanning rules begin from here. */
+
+MEN|WOMEN|STOCKS|TREES copy_and_return(NOUN)
+MISTAKES|GNUS|EMPLOYEES copy_and_return(NOUN)
+LOSERS|USERS|CARS|WINDOWS copy_and_return(NOUN)
+
+DATABASE|NETWORK|FSF|GNU copy_and_return(PROPER_NOUN)
+COMPANY|HOUSE|OFFICE|LPF copy_and_return(PROPER_NOUN)
+
+THE|THIS|THAT|THOSE copy_and_return(DECLARATIVE)
+
+ALL|FIRST|LAST copy_and_return(CONDITIONAL)
+
+FIND|SEARCH|SORT|ERASE|KILL copy_and_return(VERB)
+ADD|REMOVE|DELETE|PRINT copy_and_return(VERB)
+
+QUICKLY|SLOWLY|CAREFULLY copy_and_return(ADVERB)
+
+IN|AT|ON|AROUND|INSIDE|ON copy_and_return(POSITIONAL)
+
+"." return(PERIOD);
+"\n" yylexlinenum++; return(NEWLINE);
+.
+%%
+