source: trunk/tools/cvtasm/cvt.l@ 10367

Last change on this file since 10367 was 10219, checked in by sandervl, 22 years ago

Header parser and assembly wrapper generator

File size: 1.0 KB
Line 
1%{
2#include "cvt.tab.h"
3
4extern int fStartProc;
5%}
6%option noyywrap
7
8ifdef "#ifdef"
9ifndef "#ifndef"
10endif "#endif"
11include "#include"
12define "#define"
13undef "#undef"
14inline "#inline"
15alpha [A-Za-z]
16dig [0-9]
17const "CONST"|"const"
18name ({alpha}|\_)({alpha}|{dig}|\_|\-)*
19
20bracketopen [\(]
21bracketclose [\)]
22endofproc [\;]
23startproc [\{]
24endproc [\}]
25comma [\,]
26pointer [\*]
27array "*[]"
28ws [ \t\n]+
29
30%%
31
32{ws} /* skip blanks and tabs */
33
34{const} return CONST;
35{name} {
36 yylval = (int)strcpy(malloc(strlen(yytext)+1), yytext);
37 return NAME;
38 }
39
40{bracketopen} return BRACKETOPEN;
41{bracketclose} return BRACKETCLOSE;
42{endofproc} return ENDOFPROC;
43{comma} return COMMA;
44{pointer} return POINTER;
45{array} return PPOINTER;
46{inline} return STAT_INLINE;
47
48
49{ifdef} return STAT_IFDEF;
50{ifndef} return STAT_IFNDEF;
51{endif} return STAT_ENDIF;
52{include} return STAT_INCLUDE;
53{define} return STAT_DEFINE;
54{undef} return STAT_UNDEF;
55
56
57%%
Note: See TracBrowser for help on using the repository browser.