diff options
author | Pixel <pixel@nobis-crew.org> | 2012-10-28 22:52:35 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-10-28 22:52:35 -0700 |
commit | f37bccb877d23a3094e7b98f2742ed66fcdb00b6 (patch) | |
tree | 7af5329fcb6ff5ce7513df69eeabf7b920aef9e2 /compil.lex | |
parent | 74ffe8d105c70e0e205cccba360f832d83b4abda (diff) |
Adding unknown tag support to the script compiler.
Diffstat (limited to 'compil.lex')
-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); } |