| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 Advance(); | 410 Advance(); |
| 411 if (c0_ == next) { | 411 if (c0_ == next) { |
| 412 Advance(); | 412 Advance(); |
| 413 return then; | 413 return then; |
| 414 } else { | 414 } else { |
| 415 return else_; | 415 return else_; |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 | 418 |
| 419 uc32 ScanHexEscape(uc32 c, int length); | 419 uc32 ScanHexEscape(uc32 c, int length); |
| 420 |
| 421 // Scans octal escape sequence. Also accepts "\0" decimal escape sequence. |
| 420 uc32 ScanOctalEscape(uc32 c, int length); | 422 uc32 ScanOctalEscape(uc32 c, int length); |
| 421 | 423 |
| 422 // Return the current source position. | 424 // Return the current source position. |
| 423 int source_pos() { | 425 int source_pos() { |
| 424 return source_->pos() - kCharacterLookaheadBufferSize; | 426 return source_->pos() - kCharacterLookaheadBufferSize; |
| 425 } | 427 } |
| 426 | 428 |
| 427 ScannerConstants* scanner_constants_; | 429 ScannerConstants* scanner_constants_; |
| 428 | 430 |
| 429 // Buffers collecting literal strings, numbers, etc. | 431 // Buffers collecting literal strings, numbers, etc. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 UNMATCHABLE, | 567 UNMATCHABLE, |
| 566 INITIAL, | 568 INITIAL, |
| 567 KEYWORD_PREFIX, | 569 KEYWORD_PREFIX, |
| 568 KEYWORD_MATCHED, | 570 KEYWORD_MATCHED, |
| 569 C, | 571 C, |
| 570 CA, | 572 CA, |
| 571 CO, | 573 CO, |
| 572 CON, | 574 CON, |
| 573 D, | 575 D, |
| 574 DE, | 576 DE, |
| 577 E, |
| 578 EX, |
| 575 F, | 579 F, |
| 576 I, | 580 I, |
| 581 IM, |
| 582 IMP, |
| 577 IN, | 583 IN, |
| 578 N, | 584 N, |
| 585 P, |
| 586 PR, |
| 587 S, |
| 579 T, | 588 T, |
| 580 TH, | 589 TH, |
| 581 TR, | 590 TR, |
| 582 V, | 591 V, |
| 583 W | 592 W |
| 584 }; | 593 }; |
| 585 | 594 |
| 586 struct FirstState { | 595 struct FirstState { |
| 587 const char* keyword; | 596 const char* keyword; |
| 588 State state; | 597 State state; |
| 589 Token::Value token; | 598 Token::Value token; |
| 590 }; | 599 }; |
| 591 | 600 |
| 592 // Range of possible first characters of a keyword. | 601 // Range of possible first characters of a keyword. |
| 593 static const unsigned int kFirstCharRangeMin = 'b'; | 602 static const unsigned int kFirstCharRangeMin = 'b'; |
| 594 static const unsigned int kFirstCharRangeMax = 'w'; | 603 static const unsigned int kFirstCharRangeMax = 'y'; |
| 595 static const unsigned int kFirstCharRangeLength = | 604 static const unsigned int kFirstCharRangeLength = |
| 596 kFirstCharRangeMax - kFirstCharRangeMin + 1; | 605 kFirstCharRangeMax - kFirstCharRangeMin + 1; |
| 597 // State map for first keyword character range. | 606 // State map for first keyword character range. |
| 598 static FirstState first_states_[kFirstCharRangeLength]; | 607 static FirstState first_states_[kFirstCharRangeLength]; |
| 599 | 608 |
| 600 // If input equals keyword's character at position, continue matching keyword | 609 // If input equals keyword's character at position, continue matching keyword |
| 601 // from that position. | 610 // from that position. |
| 602 inline bool MatchKeywordStart(unibrow::uchar input, | 611 inline bool MatchKeywordStart(unibrow::uchar input, |
| 603 const char* keyword, | 612 const char* keyword, |
| 604 int position, | 613 int position, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 // keyword with the current prefix). | 654 // keyword with the current prefix). |
| 646 const char* keyword_; | 655 const char* keyword_; |
| 647 int counter_; | 656 int counter_; |
| 648 Token::Value keyword_token_; | 657 Token::Value keyword_token_; |
| 649 }; | 658 }; |
| 650 | 659 |
| 651 | 660 |
| 652 } } // namespace v8::internal | 661 } } // namespace v8::internal |
| 653 | 662 |
| 654 #endif // V8_SCANNER_BASE_H_ | 663 #endif // V8_SCANNER_BASE_H_ |
| OLD | NEW |