source: trunk/flex/examples/manual/front.lex@ 3032

Last change on this file since 3032 was 3031, checked in by bird, 18 years ago

flex 2.5.33.

File size: 1.2 KB
Line 
1%{
2#include <stdio.h>
3#include <string.h>
4#include "y.tab.h" /* this comes from bison */
5
6#define TRUE 1
7#define FALSE 0
8
9#define copy_and_return(token_type) { strcpy(yylval.name,yytext); \
10 return(token_type); }
11
12int yylexlinenum = 0; /* so we can count lines */
13%}
14
15%%
16 /* Lexical scanning rules begin from here. */
17
18MEN|WOMEN|STOCKS|TREES copy_and_return(NOUN)
19MISTAKES|GNUS|EMPLOYEES copy_and_return(NOUN)
20LOSERS|USERS|CARS|WINDOWS copy_and_return(NOUN)
21
22DATABASE|NETWORK|FSF|GNU copy_and_return(PROPER_NOUN)
23COMPANY|HOUSE|OFFICE|LPF copy_and_return(PROPER_NOUN)
24
25THE|THIS|THAT|THOSE copy_and_return(DECLARATIVE)
26
27ALL|FIRST|LAST copy_and_return(CONDITIONAL)
28
29FIND|SEARCH|SORT|ERASE|KILL copy_and_return(VERB)
30ADD|REMOVE|DELETE|PRINT copy_and_return(VERB)
31
32QUICKLY|SLOWLY|CAREFULLY copy_and_return(ADVERB)
33
34IN|AT|ON|AROUND|INSIDE|ON copy_and_return(POSITIONAL)
35
36"." return(PERIOD);
37"\n" yylexlinenum++; return(NEWLINE);
38.
39%%
40
Note: See TracBrowser for help on using the repository browser.