X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fparser.lex;h=337da1eaafedd652c58e1a9eb82b0e5bdf5c3e0f;hb=7d4238427eabb6e382e79031a5172d32b849908d;hp=63142034d8bba33f7a51434545e551f0f3f565f0;hpb=e8458c3ccc1168fc2b40fc851284da352c5405dd;p=swftools.git diff --git a/src/parser.lex b/src/parser.lex index 6314203..337da1e 100644 --- a/src/parser.lex +++ b/src/parser.lex @@ -101,6 +101,7 @@ static void unescapeString(string_t * tmp) case 't': p[0] = '\t'; break; case 'x': { int num=0; + char*utf8; while(strchr("0123456789abcdefABCDEF", p[nr])) { num <<= 4; if(p[nr]>='0' && p[nr]<='9') num |= p[nr] - '0'; @@ -108,7 +109,7 @@ static void unescapeString(string_t * tmp) if(p[nr]>='A' && p[nr]<='F') num |= p[nr] - 'A' + 10; nr++; } - char*utf8 = getUTF8(num); + utf8 = getUTF8(num); new = strlen(utf8); memcpy(p, utf8, new); // do not copy the terminating zero @@ -118,12 +119,14 @@ static void unescapeString(string_t * tmp) continue; } tmp->len -= (nr-new); - int t; - char*to=p+new,*from=p+nr; - while(*from) { - *to = *from; - to++; - from++; + { + int t; + char*to=p+new,*from=p+nr; + while(*from) { + *to = *from; + to++; + from++; + } } } } @@ -241,6 +244,7 @@ NUMBER -?[0-9]+(\.[0-9]*)? PERCENT {NUMBER}% STRING (\\.|[^\\"\n])* S [ \n\r\t] +NS [^ \n\r\t] RVALUE \"{STRING}\"|([^ \n\r\t]+) %% @@ -262,7 +266,7 @@ RVALUE \"{STRING}\"|([^ \n\r\t]+) } \.include{S}.*\n {handleInclude(yytext, yyleng);} \.{NAME} {s(COMMAND);c();} -:([^.]|\.[^e]|\.e[^n]|\.en[^d]|[ \n\r\t])*\.end {s(RAWDATA);c();} +:({NS}|{S}[^.]|{S}\.[^e]|{S}\.e[^n]|{S}\.en[^d]|{S}\.end{NS})*{S}\.end {s(RAWDATA);c();} {NAME} {s(IDENTIFIER);c();} "[" {c();BEGIN(BINARY);} {S} {c();}