/* $Id: glue.l,v 1.4 2004/01/15 20:10:41 jmuelmen Exp $ */ %{ #include #include "y.tab.h" void comment (); %} %% "/*" { comment(); } "," { return(','); } "*" { return('*'); } "(" { return('('); } ")" { return(')'); } ";" { return(';'); } "int" { return(INT); } "double" { return(DOUBLE); } "char" { return(CHAR); } "void" { return(VOID); } "const" { return(CONST); } [\_A-Za-z][\_0-9A-Za-z]* { return(IDENTIFIER); } \#.* ; [ \t\v\n\f] ; . ; %% #ifndef yywrap int yywrap () { return 1; } #endif #ifndef yytext_ptr #define yytext_ptr yytext #endif void comment() { char c, c1; loop: while ((c = input()) != '*' && c != 0) putchar(c); if ((c1 = input()) != '/' && c != 0) { unput(c1); goto loop; } if (c != 0) putchar(c1); }