peephole.l 598 B

123456789101112131415161718192021222324
  1. %{
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "y.tab.h"
  5. extern int lineno;
  6. %}
  7. %option noyywrap
  8. word [a-zA-Z0-9$_.]+
  9. int [0-9]+
  10. %%
  11. \n { lineno++; printf("ikmatchhemwel!"); return NEWLINE; }
  12. : { return COLON; }
  13. , { return COMMA; }
  14. #.* { yylval.sval = strdup(yytext); return COMMENT; }
  15. \..* { yylval.sval = strdup(yytext); return DIRECTIVE; }
  16. {word} { yylval.sval = strdup(yytext); return WORD; }
  17. {int}(\({word}\))? { yylval.sval = strdup(yytext); return WORD; }
  18. [ \t]+ ;