| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 int d = HexValue(c0_); | 377 int d = HexValue(c0_); |
| 378 if (d < 0) { | 378 if (d < 0) { |
| 379 // According to ECMA-262, 3rd, 7.8.4, page 18, these hex escapes | 379 // According to ECMA-262, 3rd, 7.8.4, page 18, these hex escapes |
| 380 // should be illegal, but other JS VMs just return the | 380 // should be illegal, but other JS VMs just return the |
| 381 // non-escaped version of the original character. | 381 // non-escaped version of the original character. |
| 382 | 382 |
| 383 // Push back digits read, except the last one (in c0_). | 383 // Push back digits read, except the last one (in c0_). |
| 384 for (int j = i-1; j >= 0; j--) { | 384 for (int j = i-1; j >= 0; j--) { |
| 385 PushBack(digits[j]); | 385 PushBack(digits[j]); |
| 386 } | 386 } |
| 387 | 387 // Notice: No handling of error - treat it as "\u"->"u". |
| 388 return c; | 388 return c; |
| 389 } | 389 } |
| 390 x = x * 16 + d; | 390 x = x * 16 + d; |
| 391 Advance(); | 391 Advance(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 return x; | 394 return x; |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 Advance(); // consume '/' | 822 Advance(); // consume '/' |
| 823 | 823 |
| 824 TerminateLiteral(); | 824 TerminateLiteral(); |
| 825 | 825 |
| 826 return true; | 826 return true; |
| 827 } | 827 } |
| 828 | 828 |
| 829 bool Scanner::ScanRegExpFlags() { | 829 bool Scanner::ScanRegExpFlags() { |
| 830 // Scan regular expression flags. | 830 // Scan regular expression flags. |
| 831 StartLiteral(); | 831 StartLiteral(); |
| 832 while (kIsIdentifierPart.get(c0_)) | 832 while (kIsIdentifierPart.get(c0_)) { |
| 833 if (c0_ == '\\') { |
| 834 uc32 c = ScanIdentifierUnicodeEscape(); |
| 835 if (c != static_cast<uc32>(unibrow::Utf8::kBadChar)) { |
| 836 // We allow any escaped character, unlike the restriction on |
| 837 // IdentifierPart when it is used to build an IdentifierName. |
| 838 AddChar(c); |
| 839 continue; |
| 840 } |
| 841 } |
| 833 AddCharAdvance(); | 842 AddCharAdvance(); |
| 843 } |
| 834 TerminateLiteral(); | 844 TerminateLiteral(); |
| 835 | 845 |
| 836 next_.location.end_pos = source_pos() - 1; | 846 next_.location.end_pos = source_pos() - 1; |
| 837 return true; | 847 return true; |
| 838 } | 848 } |
| 839 | 849 |
| 840 } } // namespace v8::internal | 850 } } // namespace v8::internal |
| OLD | NEW |