OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 State state; | 626 State state; |
627 Token::Value token; | 627 Token::Value token; |
628 }; | 628 }; |
629 | 629 |
630 // Range of possible first characters of a keyword. | 630 // Range of possible first characters of a keyword. |
631 static const unsigned int kFirstCharRangeMin = 'b'; | 631 static const unsigned int kFirstCharRangeMin = 'b'; |
632 static const unsigned int kFirstCharRangeMax = 'y'; | 632 static const unsigned int kFirstCharRangeMax = 'y'; |
633 static const unsigned int kFirstCharRangeLength = | 633 static const unsigned int kFirstCharRangeLength = |
634 kFirstCharRangeMax - kFirstCharRangeMin + 1; | 634 kFirstCharRangeMax - kFirstCharRangeMin + 1; |
635 // State map for first keyword character range. | 635 // State map for first keyword character range. |
636 static FirstState first_states_[kFirstCharRangeLength]; | 636 static const FirstState first_states_[kFirstCharRangeLength]; |
637 | 637 |
638 // If input equals keyword's character at position, continue matching keyword | 638 // If input equals keyword's character at position, continue matching keyword |
639 // from that position. | 639 // from that position. |
640 inline bool MatchKeywordStart(unibrow::uchar input, | 640 inline bool MatchKeywordStart(unibrow::uchar input, |
641 const char* keyword, | 641 const char* keyword, |
642 int position, | 642 int position, |
643 Token::Value token_if_match) { | 643 Token::Value token_if_match) { |
644 if (input != static_cast<unibrow::uchar>(keyword[position])) { | 644 if (input != static_cast<unibrow::uchar>(keyword[position])) { |
645 return false; | 645 return false; |
646 } | 646 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 // keyword with the current prefix). | 683 // keyword with the current prefix). |
684 const char* keyword_; | 684 const char* keyword_; |
685 int counter_; | 685 int counter_; |
686 Token::Value keyword_token_; | 686 Token::Value keyword_token_; |
687 }; | 687 }; |
688 | 688 |
689 | 689 |
690 } } // namespace v8::internal | 690 } } // namespace v8::internal |
691 | 691 |
692 #endif // V8_SCANNER_BASE_H_ | 692 #endif // V8_SCANNER_BASE_H_ |
OLD | NEW |