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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 IMP, | 611 IMP, |
612 IN, | 612 IN, |
613 N, | 613 N, |
614 P, | 614 P, |
615 PR, | 615 PR, |
616 S, | 616 S, |
617 T, | 617 T, |
618 TH, | 618 TH, |
619 TR, | 619 TR, |
620 V, | 620 V, |
621 W | 621 W, |
| 622 LAST_STATE = W |
622 }; | 623 }; |
623 | 624 |
| 625 |
| 626 STATIC_ASSERT(LAST_STATE <= 0xFF); |
| 627 STATIC_ASSERT(Token::NUM_TOKENS <= 0x100); |
624 struct FirstState { | 628 struct FirstState { |
625 const char* keyword; | 629 const char* keyword; |
626 State state; | 630 State state : 8; |
627 Token::Value token; | 631 Token::Value token : 8; |
628 }; | 632 }; |
629 | 633 |
630 // Range of possible first characters of a keyword. | 634 // Range of possible first characters of a keyword. |
631 static const unsigned int kFirstCharRangeMin = 'b'; | 635 static const unsigned int kFirstCharRangeMin = 'b'; |
632 static const unsigned int kFirstCharRangeMax = 'y'; | 636 static const unsigned int kFirstCharRangeMax = 'y'; |
633 static const unsigned int kFirstCharRangeLength = | 637 static const unsigned int kFirstCharRangeLength = |
634 kFirstCharRangeMax - kFirstCharRangeMin + 1; | 638 kFirstCharRangeMax - kFirstCharRangeMin + 1; |
635 // State map for first keyword character range. | 639 // State map for first keyword character range. |
636 static const FirstState first_states_[kFirstCharRangeLength]; | 640 static const FirstState first_states_[kFirstCharRangeLength]; |
637 | 641 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 // keyword with the current prefix). | 687 // keyword with the current prefix). |
684 const char* keyword_; | 688 const char* keyword_; |
685 int counter_; | 689 int counter_; |
686 Token::Value keyword_token_; | 690 Token::Value keyword_token_; |
687 }; | 691 }; |
688 | 692 |
689 | 693 |
690 } } // namespace v8::internal | 694 } } // namespace v8::internal |
691 | 695 |
692 #endif // V8_SCANNER_BASE_H_ | 696 #endif // V8_SCANNER_BASE_H_ |
OLD | NEW |