| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 switch (c) { | 555 switch (c) { |
| 556 case '\'': // fall through | 556 case '\'': // fall through |
| 557 case '"' : // fall through | 557 case '"' : // fall through |
| 558 case '\\': break; | 558 case '\\': break; |
| 559 case 'b' : c = '\b'; break; | 559 case 'b' : c = '\b'; break; |
| 560 case 'f' : c = '\f'; break; | 560 case 'f' : c = '\f'; break; |
| 561 case 'n' : c = '\n'; break; | 561 case 'n' : c = '\n'; break; |
| 562 case 'r' : c = '\r'; break; | 562 case 'r' : c = '\r'; break; |
| 563 case 't' : c = '\t'; break; | 563 case 't' : c = '\t'; break; |
| 564 case 'u' : { | 564 case 'u' : { |
| 565 if (end > cursor + 4) return NULL; | 565 ASSERT(cursor + 4 <= end); |
| 566 cursor = ScanHexNumber(cursor, cursor + 4, &c); | 566 cursor = ScanHexNumber(cursor, cursor + 4, &c); |
| 567 if (cursor == NULL) return NULL; | 567 if (cursor == NULL) return NULL; |
| 568 break; | 568 break; |
| 569 } | 569 } |
| 570 case 'v' : c = '\v'; break; | 570 case 'v' : c = '\v'; break; |
| 571 case 'x' : { | 571 case 'x' : { |
| 572 if (end > cursor + 2) return NULL ; | 572 ASSERT(cursor + 2 <= end); |
| 573 cursor = ScanHexNumber(cursor, cursor + 2, &c); | 573 cursor = ScanHexNumber(cursor, cursor + 2, &c); |
| 574 if (cursor == NULL) return NULL; | 574 if (cursor == NULL) return NULL; |
| 575 break; | 575 break; |
| 576 } | 576 } |
| 577 case '0' : // fall through | 577 case '0' : // fall through |
| 578 case '1' : // fall through | 578 case '1' : // fall through |
| 579 case '2' : // fall through | 579 case '2' : // fall through |
| 580 case '3' : // fall through | 580 case '3' : // fall through |
| 581 case '4' : // fall through | 581 case '4' : // fall through |
| 582 case '5' : // fall through | 582 case '5' : // fall through |
| 583 case '6' : // fall through | 583 case '6' : // fall through |
| 584 case '7' : | 584 case '7' : |
| 585 if (end > cursor + 2) end = cursor + 2; | 585 if (end > cursor + 2) end = cursor + 2; |
| 586 cursor = ScanOctalEscape(cursor, end, &c); break; | 586 cursor = ScanOctalEscape(cursor, end, &c); break; |
| 587 } | 587 } |
| 588 | 588 |
| 589 // According to ECMA-262, section 7.8.4, characters not covered by the | 589 // According to ECMA-262, section 7.8.4, characters not covered by the |
| 590 // above cases should be illegal, but they are commonly handled as | 590 // above cases should be illegal, but they are commonly handled as |
| 591 // non-escaped characters by JS VMs. | 591 // non-escaped characters by JS VMs. |
| 592 literal->AddChar(c); | 592 literal->AddChar(c); |
| 593 return cursor; | 593 return cursor; |
| 594 } | 594 } |
| 595 | 595 |
| 596 | 596 |
| 597 } } | 597 } } |
| 598 | 598 |
| 599 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H | 599 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H |
| OLD | NEW |