| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 UNMATCHABLE, | 557 UNMATCHABLE, |
| 558 INITIAL, | 558 INITIAL, |
| 559 KEYWORD_PREFIX, | 559 KEYWORD_PREFIX, |
| 560 KEYWORD_MATCHED, | 560 KEYWORD_MATCHED, |
| 561 C, | 561 C, |
| 562 CA, | 562 CA, |
| 563 CO, | 563 CO, |
| 564 CON, | 564 CON, |
| 565 D, | 565 D, |
| 566 DE, | 566 DE, |
| 567 E, |
| 568 EX, |
| 567 F, | 569 F, |
| 568 I, | 570 I, |
| 571 IM, |
| 572 IMP, |
| 569 IN, | 573 IN, |
| 570 N, | 574 N, |
| 575 P, |
| 576 PR, |
| 577 S, |
| 571 T, | 578 T, |
| 572 TH, | 579 TH, |
| 573 TR, | 580 TR, |
| 574 V, | 581 V, |
| 575 W | 582 W |
| 576 }; | 583 }; |
| 577 | 584 |
| 578 struct FirstState { | 585 struct FirstState { |
| 579 const char* keyword; | 586 const char* keyword; |
| 580 State state; | 587 State state; |
| 581 Token::Value token; | 588 Token::Value token; |
| 582 }; | 589 }; |
| 583 | 590 |
| 584 // Range of possible first characters of a keyword. | 591 // Range of possible first characters of a keyword. |
| 585 static const unsigned int kFirstCharRangeMin = 'b'; | 592 static const unsigned int kFirstCharRangeMin = 'b'; |
| 586 static const unsigned int kFirstCharRangeMax = 'w'; | 593 static const unsigned int kFirstCharRangeMax = 'y'; |
| 587 static const unsigned int kFirstCharRangeLength = | 594 static const unsigned int kFirstCharRangeLength = |
| 588 kFirstCharRangeMax - kFirstCharRangeMin + 1; | 595 kFirstCharRangeMax - kFirstCharRangeMin + 1; |
| 589 // State map for first keyword character range. | 596 // State map for first keyword character range. |
| 590 static FirstState first_states_[kFirstCharRangeLength]; | 597 static FirstState first_states_[kFirstCharRangeLength]; |
| 591 | 598 |
| 592 // If input equals keyword's character at position, continue matching keyword | 599 // If input equals keyword's character at position, continue matching keyword |
| 593 // from that position. | 600 // from that position. |
| 594 inline bool MatchKeywordStart(unibrow::uchar input, | 601 inline bool MatchKeywordStart(unibrow::uchar input, |
| 595 const char* keyword, | 602 const char* keyword, |
| 596 int position, | 603 int position, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 // keyword with the current prefix). | 644 // keyword with the current prefix). |
| 638 const char* keyword_; | 645 const char* keyword_; |
| 639 int counter_; | 646 int counter_; |
| 640 Token::Value keyword_token_; | 647 Token::Value keyword_token_; |
| 641 }; | 648 }; |
| 642 | 649 |
| 643 | 650 |
| 644 } } // namespace v8::internal | 651 } } // namespace v8::internal |
| 645 | 652 |
| 646 #endif // V8_SCANNER_BASE_H_ | 653 #endif // V8_SCANNER_BASE_H_ |
| OLD | NEW |