diff options
-rw-r--r-- | compil.lex | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -20,6 +20,13 @@ int errstate = 0; int got_ptr = 0; + const int max_tagsize = 64; + + char unknown_tag[65]; + char * unknown_tag_ptr; + + int in_unknown_tag = 0; + %% <INITIAL>"<roomscripts>" { @@ -149,6 +156,19 @@ } <I>. { + if (*yytext == '<') { + in_unknown_tag = 1; + unknown_tag_ptr = unknown_tag; + } else if (*yytext == '>') { + *unknown_tag_ptr = 0; + fprintf(stderr, "Got an unknown tag: %s\n", unknown_tag); + in_unknown_tag = 0; + } else if (in_unknown_tag) { + *unknown_tag_ptr++ = *yytext; + if ((unknown_tag_ptr - unknown_tag) == max_tagsize) { + in_unknown_tag = 0; + } + } fputc(*yytext, yyout); } |