|
Last change
on this file since 22016 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 |
|
|---|
| 4 | extern int fStartProc;
|
|---|
| 5 | %}
|
|---|
| 6 | %option noyywrap
|
|---|
| 7 |
|
|---|
| 8 | ifdef "#ifdef"
|
|---|
| 9 | ifndef "#ifndef"
|
|---|
| 10 | endif "#endif"
|
|---|
| 11 | include "#include"
|
|---|
| 12 | define "#define"
|
|---|
| 13 | undef "#undef"
|
|---|
| 14 | inline "#inline"
|
|---|
| 15 | alpha [A-Za-z]
|
|---|
| 16 | dig [0-9]
|
|---|
| 17 | const "CONST"|"const"
|
|---|
| 18 | name ({alpha}|\_)({alpha}|{dig}|\_|\-)*
|
|---|
| 19 |
|
|---|
| 20 | bracketopen [\(]
|
|---|
| 21 | bracketclose [\)]
|
|---|
| 22 | endofproc [\;]
|
|---|
| 23 | startproc [\{]
|
|---|
| 24 | endproc [\}]
|
|---|
| 25 | comma [\,]
|
|---|
| 26 | pointer [\*]
|
|---|
| 27 | array "*[]"
|
|---|
| 28 | ws [ \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.