fork download
  1. /* html_tags.l
  2.   Build: flex html_tags.l && gcc lex.yy.c -lfl -o htmltags && ./htmltags
  3. */
  4. %{
  5. #include <stdio.h>
  6. %}
  7. %%
  8. "<"[ \t]*"/"[ \t]*[a-zA-Z][a-zA-Z0-9-]*[ \t]*">" { printf("END TAG: %s\n", yytext); }
  9. "<"[ \t]*[a-zA-Z][a-zA-Z0-9-]*[^>]*">" { printf("START TAG: %s\n", yytext); }
  10. [^<\n]+ { /* text */ }
  11. \n { /* newline */ }
  12. . { /* any other */ }
  13. %%
  14. int main(){ yylex(); return 0; }
  15.  
Success #stdin #stdout #stderr 0.03s 6916KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/nc9FzO/prog:5:1: Syntax error: Operator expected
ERROR: /home/nc9FzO/prog:14:32: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit