home *** CD-ROM | disk | FTP | other *** search
Lex Description | 1989-02-06 | 938 b | 46 lines |
- %{
- #ifndef lint
- static char rcsid[] = "$Header: lisp.l,v 0.0 88/06/22 05:22:11 on Rel $";
- #endif
- #include <ctype.h>
- #include "pps.h"
-
- int def;
- %}
- letter [@A-Za-z_\-:\$]
- digit [0-9]
- white [ \t]
- %Start COMMENT STRING1 STRING2 KEYWORD
- %%
- <INITIAL>c[ad]+r { begin(KEYWORD); ECHO; begin(INITIAL); }
- <INITIAL>def { def++; REJECT; }
- <INITIAL>{letter}({letter}|{digit})* { /* BUG */
- int kw = iskw(yytext);
-
- if (kw)
- begin(KEYWORD);
- else if (def) {
- funct(yytext);
- def = 0;
- }
- ECHO;
- if (kw)
- begin(INITIAL);
- }
- <INITIAL>\" { begin(STRING1); ECHO; }
- <INITIAL>\# { begin(COMMENT); ECHO; begin(INITIAL); }
- <INITIAL>; { begin(COMMENT); ECHO; begin(INITIAL); }
- <STRING1>\\. { ECHO; }
- <STRING1>\" { ECHO; begin(INITIAL); }
- [\t\n\f]+ { space(yytext); }
- . { ECHO; }
- %%
- /*
- * Your pet lisp dialect has other built-ins than ours;
- * anyway, the list is too long to ship over the net...
- */
- char *keywords[] = {
- "",
- NULL
- };
-