home *** CD-ROM | disk | FTP | other *** search
/ ftp.sunet.sepub/pictures / 2014.11.ftp.sunet.se-pictures.tar / ftp.sunet.se / pub / pictures / ACiD-artpacks / programs / unix / editors / gimp-plugins-unstable-0_99_23_tar.gz / gimp-plugins-unstable-0_99_23_tar / gimp-plugins-unstable-0.99.23 / mathmap / scanner.fl < prev    next >
Text File  |  1998-02-19  |  1KB  |  59 lines

  1. %{
  2. #include <string.h>
  3.  
  4. #include "exprtree.h"
  5. #include "builtins.h"
  6. #include "parser.h"
  7. %}
  8.  
  9. %option noyywrap
  10.  
  11. %%
  12.  
  13. if                          return T_IF;
  14. then                        return T_THEN;
  15. else                        return T_ELSE;
  16. end                         return T_END;
  17. while                       return T_WHILE;
  18. do                          return T_DO;
  19. [a-zA-Z_][a-zA-Z0-9_]*      {
  20.                 builtin *theBuiltin = builtin_with_name(yytext);
  21.  
  22.                 if (theBuiltin != 0)
  23.                 {
  24.                    yylval.builtin = theBuiltin;
  25.                    return T_BUILTIN;
  26.                 }
  27.                 else
  28.                 {
  29.                     strncpy(yylval.ident, yytext, MAX_IDENT_LENGTH);
  30.                     yylval.ident[MAX_IDENT_LENGTH] = 0;
  31.                     return T_IDENT;
  32.                 }
  33.                         }
  34. [0-9]+                      { yylval.exprtree = make_number(atof(yytext)); return T_NUMBER; }
  35. [0-9]*\.[0-9]+              { yylval.exprtree = make_number(atof(yytext)); return T_NUMBER; }
  36. "=="                        return T_EQUAL;
  37. "<="                        return T_LESSEQUAL;
  38. ">="                        return T_GREATEREQUAL;
  39. "!="                        return T_NOTEQUAL;
  40. "||"                        return T_OR;
  41. "&&"                        return T_AND;
  42. [-<>!,()+*/%=;]             return yytext[0];
  43. #.*                         ;
  44. [ \t\n]                     ;
  45.  
  46. %%
  47.  
  48. void
  49. scanFromString (char *string)
  50. {
  51.     yy_scan_string(string);
  52. }
  53.  
  54. void
  55. endScanningFromString (void)
  56. {
  57.     yy_delete_buffer(YY_CURRENT_BUFFER);
  58. }
  59.