| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 cursor = ScanOctalEscape(cursor, end, &c); break; | 622 cursor = ScanOctalEscape(cursor, end, &c); break; |
| 623 } | 623 } |
| 624 | 624 |
| 625 // According to ECMA-262, section 7.8.4, characters not covered by the | 625 // According to ECMA-262, section 7.8.4, characters not covered by the |
| 626 // above cases should be illegal, but they are commonly handled as | 626 // above cases should be illegal, but they are commonly handled as |
| 627 // non-escaped characters by JS VMs. | 627 // non-escaped characters by JS VMs. |
| 628 literal->AddChar(c); | 628 literal->AddChar(c); |
| 629 return cursor; | 629 return cursor; |
| 630 } | 630 } |
| 631 | 631 |
| 632 |
| 632 template<typename Char> | 633 template<typename Char> |
| 633 ScannerBase::Location ExperimentalScanner<Char>::octal_position() const { | 634 ScannerBase::Location ExperimentalScanner<Char>::octal_position() const { |
| 634 if (!last_octal_end_) | 635 if (!last_octal_end_) |
| 635 return Location::invalid(); | 636 return Location::invalid(); |
| 636 // The last octal might be an octal escape or an octal number. Whichever it | 637 // The last octal might be an octal escape or an octal number. Whichever it |
| 637 // is, we'll find the start by just scanning back until we hit a non-octal | 638 // is, we'll find the start by just scanning back until we hit a non-octal |
| 638 // character. | 639 // character. |
| 639 const Char* temp_cursor = last_octal_end_ - 1; | 640 const Char* temp_cursor = last_octal_end_ - 1; |
| 640 while (temp_cursor >= buffer_ && *temp_cursor >= '0' && *temp_cursor <= '7') | 641 while (temp_cursor >= buffer_ && *temp_cursor >= '0' && *temp_cursor <= '7') |
| 641 --temp_cursor; | 642 --temp_cursor; |
| 642 return Location(temp_cursor - buffer_ + 1, last_octal_end_ - buffer_); | 643 return Location(temp_cursor - buffer_ + 1, last_octal_end_ - buffer_); |
| 643 } | 644 } |
| 644 | 645 |
| 645 } } | 646 } } |
| 646 | 647 |
| 647 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H | 648 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H |
| OLD | NEW |