Skip to content
Snippets Groups Projects
Commit 53138f4c authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1996-11-22 13:19:06 by simonm]

lex.l still hanging around?
parent d40eb200
No related merge requests found
%{
#define YYSTYPE long
#ifdef __STDC__
#define PROTO(x) x
#else
#define PROTO(x) ()
#endif
# include "syntax.tab.h"
# include <stdio.h>
# include "id.h"
# include "tree.h"
# include "funs.h"
extern YYSTYPE yylval;
extern FILE *fc, *fhs;
#undef ECHO /* partain */
#define ECHO /*fprintf(stderr, "%s", yytext)*/
%}
%%
";" { ECHO; return(SEMICOL); }
":" { ECHO; return(COLON); }
"<" { ECHO; return(STDEF); }
">" { ECHO; return(ENDDEF); }
"type" { ECHO; return(TYPE); }
"end" { ECHO; return(END); }
[A-Za-z][A-Za-z0-9_]* {
ECHO;
yylval = (YYSTYPE) installid(yytext);
return(ID);
}
. ECHO;
"\n" ECHO;
"/*"([^*]|"*"[^/]|\n)*"*/" ECHO;
"%{{"([^%]|"%"[^}]|\n)*"%}}" { /* partain: for Haskell includes */
ECHO;
yytext[yyleng-3] = '\0';
fprintf(fhs, "\n%s", &yytext[3]);
}
"%{"([^%]|"%"[^}]|\n)*"%}" {
ECHO;
yytext[yyleng-2] = '\0';
fprintf(fc, "\n%s", &yytext[2]);
}
%%
int
yywrap()
{
return(1);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment