home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / pps / lisp.l < prev    next >
Text File  |  1989-02-06  |  938b  |  46 lines

  1. %{
  2. #ifndef lint
  3. static char rcsid[] = "$Header: lisp.l,v 0.0 88/06/22 05:22:11 on Rel $";
  4. #endif
  5. #include <ctype.h>
  6. #include "pps.h"
  7.  
  8. int def;
  9. %}
  10. letter    [@A-Za-z_\-:\$]
  11. digit    [0-9]
  12. white    [ \t]
  13. %Start COMMENT STRING1 STRING2 KEYWORD
  14. %%
  15. <INITIAL>c[ad]+r    { begin(KEYWORD); ECHO; begin(INITIAL); }
  16. <INITIAL>def    { def++; REJECT; }
  17. <INITIAL>{letter}({letter}|{digit})*    {    /* BUG */
  18.             int kw = iskw(yytext);
  19.  
  20.             if (kw)
  21.                 begin(KEYWORD);
  22.             else if (def) {
  23.                 funct(yytext);
  24.                 def = 0;
  25.             }
  26.             ECHO;
  27.             if (kw)
  28.                 begin(INITIAL);
  29.         }
  30. <INITIAL>\"    { begin(STRING1); ECHO; }
  31. <INITIAL>\#    { begin(COMMENT); ECHO; begin(INITIAL); }
  32. <INITIAL>;    { begin(COMMENT); ECHO; begin(INITIAL); }
  33. <STRING1>\\.    { ECHO; }
  34. <STRING1>\"    { ECHO; begin(INITIAL); }
  35. [\t\n\f]+    { space(yytext); }
  36. .        { ECHO; }
  37. %%
  38. /*
  39.  * Your pet lisp dialect has other built-ins than ours;
  40.  * anyway, the list is too long to ship over the net...
  41.  */
  42. char *keywords[] = {
  43.     "",
  44.     NULL
  45. };
  46.