home *** CD-ROM | disk | FTP | other *** search
Lex Description | 1996-07-08 | 1.2 KB | 54 lines | [TEXT/MPS ] |
- %{
-
- /* File fixit.l Copyright (C) 1996 by John R. Montbriand. All Rights Reserved. */
-
- /* File fixit.l
-
- Copyright (C) 1996 by John Montbriand. All Rights Reserved.
-
- Distribute freely in areas where the laws of copyright apply.
-
- Use at your own risk.
-
- Do not distribute modified copies.
-
- These various fixmath routines and libraries are for free!
-
- See the file fixit.txt for details.
-
- */
-
- #include "y.tab.h"
- #include "StdLib.h"
- #include "FixMath.h"
- #include "ToolUtils.h"
-
- int yywrap(void);
- extern int yylval;
-
- %}
-
- %%
-
- sqrt yylval = (long) yytext; return SQUARE_ROOT;
- sqr yylval = (long) yytext; return SQUARE;
- cos yylval = (long) yytext; return COSINE;
- sin yylval = (long) yytext; return SINE;
- tan yylval = (long) yytext; return TANGENT;
- \*\* yylval = (long) yytext; return EXPONENT;
- [a-z_][0-9_a-z]* yylval = (long) yytext; return IDENTIFIER;
- [0-9]+ yylval = (long) FixRatio(atoi(yytext), 1); return NUMBER;
- [0-9]+\.[0-9]+ yylval = (long) X2Fix(atof(yytext)); return NUMBER;
- [()+*/\-] yylval = (long) *yytext; return *yytext;
- [ \t]+|#.* /* eat up whitespace */
- . printf( "Unrecognized character: '%s'\n", yytext );
-
-
- %%
-
- int yywrap(void) {
- return 1;
- }
-
- /* end of file fixit.l */
-