ignore unknown escape sequences
[swftools.git] / lib / as3 / tokenizer.lex
index f253b1b..e103b25 100644 (file)
@@ -156,7 +156,7 @@ void handleInclude(char*text, int len, char quotes)
         filename = strdup(&text[i1]);
     }
     
-    char*fullfilename = find_file(filename);
+    char*fullfilename = find_file(filename, 1);
     enter_file2(filename, fullfilename, YY_CURRENT_BUFFER);
     yyin = fopen(fullfilename, "rb");
     if (!yyin) {
@@ -259,8 +259,15 @@ static int do_unescape(const char*s, const char*end, char*n)
                 }
                break;
            }
-            default:
-                syntaxerror("unknown escape sequence: \"\\%c\"", *s);
+            default: {
+               if(o) {
+                    o[len+0] = '\\';
+                    o[len+1] = *s;
+                }
+                s++;
+                len+=2;
+                break;
+            }
         }
     }
     if(o) o[len]=0;
@@ -638,7 +645,7 @@ switch                       {c();BEGIN(INITIAL);a3_lval.id="";return T_SWITCH;}
 \.\.                         {c();BEGIN(REGEXPOK);return m(T_DOTDOT);}
 \.                           {c();BEGIN(REGEXPOK);return m('.');}
 ::                           {c();BEGIN(REGEXPOK);return m(T_COLONCOLON);}
-:                            {c();BEGIN(INITIAL);return m(':');}
+:                            {c();BEGIN(REGEXPOK);return m(':');}
 instanceof                   {c();BEGIN(REGEXPOK);return m(KW_INSTANCEOF);}
 implements                   {c();BEGIN(REGEXPOK);return m(KW_IMPLEMENTS);}
 interface                    {c();BEGIN(INITIAL);return m(KW_INTERFACE);}
@@ -687,7 +694,7 @@ is                           {c();BEGIN(REGEXPOK);return m(KW_IS) ;}
 in                           {c();BEGIN(REGEXPOK);return m(KW_IN) ;}
 if                           {c();BEGIN(INITIAL);return m(KW_IF) ;}
 as                           {c();BEGIN(REGEXPOK);return m(KW_AS);}
-{NAME}                       {c();BEGIN(INITIAL);return handleIdentifier();}
+$?{NAME}                       {c();BEGIN(INITIAL);return handleIdentifier();}
 
 [\]\}*]                       {c();BEGIN(INITIAL);return m(yytext[0]);}
 [+-\/^~@$!%&\(=\[|?:;,<>]   {c();BEGIN(REGEXPOK);return m(yytext[0]);}