Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: src/lexer/lexer.h

Issue 200323005: Experimental parser: fix generated lexer build after merge (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/lexer/lexer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return next_literal_->is_one_byte(); 166 return next_literal_->is_one_byte();
167 } 167 }
168 168
169 bool is_next_contextual_keyword(Vector<const uint8_t> keyword) { 169 bool is_next_contextual_keyword(Vector<const uint8_t> keyword) {
170 if (!is_next_literal_one_byte()) return false; 170 if (!is_next_literal_one_byte()) return false;
171 Vector<const uint8_t> literal = next_literal_one_byte_string(); 171 Vector<const uint8_t> literal = next_literal_one_byte_string();
172 return literal.length() == keyword.length() && 172 return literal.length() == keyword.length() &&
173 (memcmp(literal.start(), keyword.start(), literal.length()) == 0); 173 (memcmp(literal.start(), keyword.start(), literal.length()) == 0);
174 } 174 }
175 175
176 Handle<String> AllocateNextLiteralString(Isolate* isolate,
177 PretenureFlag tenured);
178 Handle<String> AllocateInternalizedString(Isolate* isolate);
179
180 double DoubleValue();
181 bool UnescapedLiteralMatches(const char* data, int length) {
182 if (is_literal_one_byte() &&
183 literal_length() == length &&
184 !literal_contains_escapes()) {
185 const char* token =
186 reinterpret_cast<const char*>(literal_one_byte_string().start());
187 return !strncmp(token, data, length);
188 }
189 return false;
190 }
191 void IsGetOrSet(bool* is_get, bool* is_set) {
192 if (is_literal_one_byte() &&
193 literal_length() == 3 &&
194 !literal_contains_escapes()) {
195 const char* token =
196 reinterpret_cast<const char*>(literal_one_byte_string().start());
197 *is_get = strncmp(token, "get", 3) == 0;
198 *is_set = !*is_get && strncmp(token, "set", 3) == 0;
199 }
200 }
201
202 int FindNumber(DuplicateFinder* finder, int value);
203 int FindSymbol(DuplicateFinder* finder, int value);
204
205 void LogSymbol(ParserRecorder* log, int position);
206
176 bool HarmonyScoping() const { 207 bool HarmonyScoping() const {
177 return harmony_scoping_; 208 return harmony_scoping_;
178 } 209 }
179 210
180 void SetHarmonyScoping(bool scoping) { 211 void SetHarmonyScoping(bool scoping) {
181 harmony_scoping_ = scoping; 212 harmony_scoping_ = scoping;
182 } 213 }
183 214
184 bool HarmonyModules() const { 215 bool HarmonyModules() const {
185 return harmony_modules_; 216 return harmony_modules_;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 451
421 inline void SetHarmonyNumericLiterals(bool numeric_literals) { 452 inline void SetHarmonyNumericLiterals(bool numeric_literals) {
422 harmony_numeric_literals_ = numeric_literals; 453 harmony_numeric_literals_ = numeric_literals;
423 SyncSettings(); 454 SyncSettings();
424 } 455 }
425 456
426 inline bool HasAnyLineTerminatorBeforeNext() const { 457 inline bool HasAnyLineTerminatorBeforeNext() const {
427 return lexer_->HasAnyLineTerminatorBeforeNext(); 458 return lexer_->HasAnyLineTerminatorBeforeNext();
428 } 459 }
429 460
430 inline Vector<const char> literal_ascii_string() {
431 return Vector<const char>::cast(lexer_->literal_one_byte_string());
432 }
433
434 inline Vector<const uc16> literal_utf16_string() {
435 return lexer_->literal_two_byte_string();
436 }
437
438 inline int literal_length() {
439 return lexer_->literal_length();
440 }
441
442 inline bool is_literal_ascii() {
443 return lexer_->is_literal_one_byte();
444 }
445
446 inline bool is_literal_contextual_keyword( 461 inline bool is_literal_contextual_keyword(
447 Vector<const char>& keyword) { // NOLINT 462 Vector<const char>& keyword) { // NOLINT
448 return lexer_->is_literal_contextual_keyword( 463 return lexer_->is_literal_contextual_keyword(
449 Vector<const uint8_t>::cast(keyword)); 464 Vector<const uint8_t>::cast(keyword));
450 } 465 }
451 466
452 inline bool literal_contains_escapes() const { 467 inline bool literal_contains_escapes() const {
453 return lexer_->literal_contains_escapes(); 468 return lexer_->literal_contains_escapes();
454 } 469 }
455 470
456 inline Vector<const char> next_literal_ascii_string() {
457 return Vector<const char>::cast(lexer_->next_literal_one_byte_string());
458 }
459
460 inline Vector<const uc16> next_literal_utf16_string() {
461 return lexer_->next_literal_two_byte_string();
462 }
463
464 inline int next_literal_length() {
465 return lexer_->next_literal_length();
466 }
467
468 inline bool is_next_literal_ascii() {
469 return lexer_->is_next_literal_one_byte();
470 }
471
472 inline bool is_next_contextual_keyword( 471 inline bool is_next_contextual_keyword(
473 Vector<const char>& keyword) { // NOLINT 472 Vector<const char>& keyword) { // NOLINT
474 return lexer_->is_next_contextual_keyword( 473 return lexer_->is_next_contextual_keyword(
475 Vector<const uint8_t>::cast(keyword)); 474 Vector<const uint8_t>::cast(keyword));
476 } 475 }
477 476
477 inline Handle<String> AllocateNextLiteralString(Isolate* isolate,
478 PretenureFlag tenured) {
479 return lexer_->AllocateNextLiteralString(isolate, tenured);
480 }
481 inline Handle<String> AllocateInternalizedString(Isolate* isolate) {
482 return lexer_->AllocateInternalizedString(isolate);
483 }
484
485 inline double DoubleValue() { return lexer_->DoubleValue(); }
486 inline bool UnescapedLiteralMatches(const char* data, int length) {
487 return lexer_->UnescapedLiteralMatches(data, length);
488 }
489 inline void IsGetOrSet(bool* is_get, bool* is_set) {
490 lexer_->IsGetOrSet(is_get, is_set);
491 }
492
493 inline int FindNumber(DuplicateFinder* finder, int value) {
494 return lexer_->FindNumber(finder, value);
495 }
496 inline int FindSymbol(DuplicateFinder* finder, int value) {
497 return lexer_->FindSymbol(finder, value);
498 }
499
500 inline void LogSymbol(ParserRecorder* log, int position) {
501 lexer_->LogSymbol(log, position);
502 }
503
478 private: 504 private:
479 void SyncSettings(); 505 void SyncSettings();
480 506
481 UnicodeCache* unicode_cache_; 507 UnicodeCache* unicode_cache_;
482 LexerBase* lexer_; 508 LexerBase* lexer_;
483 bool harmony_numeric_literals_; 509 bool harmony_numeric_literals_;
484 bool harmony_modules_; 510 bool harmony_modules_;
485 bool harmony_scoping_; 511 bool harmony_scoping_;
486 }; 512 };
487 513
488 514
489 #endif 515 #endif
490 516
491 517
492 } } 518 } }
493 519
494 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H 520 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H
OLDNEW
« no previous file with comments | « no previous file | src/lexer/lexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698