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

Side by Side Diff: src/scanner.h

Issue 615813004: Allow escape sequences in Constructor/Prototype tokens in PreParserTraits::GetSymbol() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Escape backslash in string literals to make msvs happy Created 6 years, 1 month 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 | « src/preparser.cc ('k') | test/cctest/test-parsing.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #ifndef V8_SCANNER_H_ 7 #ifndef V8_SCANNER_H_
8 #define V8_SCANNER_H_ 8 #define V8_SCANNER_H_
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 387 }
388 bool is_next_contextual_keyword(Vector<const char> keyword) { 388 bool is_next_contextual_keyword(Vector<const char> keyword) {
389 DCHECK_NOT_NULL(next_.literal_chars); 389 DCHECK_NOT_NULL(next_.literal_chars);
390 return next_.literal_chars->is_contextual_keyword(keyword); 390 return next_.literal_chars->is_contextual_keyword(keyword);
391 } 391 }
392 392
393 const AstRawString* CurrentSymbol(AstValueFactory* ast_value_factory); 393 const AstRawString* CurrentSymbol(AstValueFactory* ast_value_factory);
394 const AstRawString* NextSymbol(AstValueFactory* ast_value_factory); 394 const AstRawString* NextSymbol(AstValueFactory* ast_value_factory);
395 395
396 double DoubleValue(); 396 double DoubleValue();
397 bool UnescapedLiteralMatches(const char* data, int length) { 397 bool LiteralMatches(const char* data, int length, bool allow_escapes = true) {
398 if (is_literal_one_byte() && 398 if (is_literal_one_byte() &&
399 literal_length() == length && 399 literal_length() == length &&
400 !literal_contains_escapes()) { 400 (allow_escapes || !literal_contains_escapes())) {
401 const char* token = 401 const char* token =
402 reinterpret_cast<const char*>(literal_one_byte_string().start()); 402 reinterpret_cast<const char*>(literal_one_byte_string().start());
403 return !strncmp(token, data, length); 403 return !strncmp(token, data, length);
404 } 404 }
405 return false; 405 return false;
406 } 406 }
407 inline bool UnescapedLiteralMatches(const char* data, int length) {
408 return LiteralMatches(data, length, false);
409 }
410
407 void IsGetOrSet(bool* is_get, bool* is_set) { 411 void IsGetOrSet(bool* is_get, bool* is_set) {
408 if (is_literal_one_byte() && 412 if (is_literal_one_byte() &&
409 literal_length() == 3 && 413 literal_length() == 3 &&
410 !literal_contains_escapes()) { 414 !literal_contains_escapes()) {
411 const char* token = 415 const char* token =
412 reinterpret_cast<const char*>(literal_one_byte_string().start()); 416 reinterpret_cast<const char*>(literal_one_byte_string().start());
413 *is_get = strncmp(token, "get", 3) == 0; 417 *is_get = strncmp(token, "get", 3) == 0;
414 *is_set = !*is_get && strncmp(token, "set", 3) == 0; 418 *is_set = !*is_get && strncmp(token, "set", 3) == 0;
415 } 419 }
416 } 420 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 bool harmony_modules_; 683 bool harmony_modules_;
680 // Whether we scan 0o777 and 0b111 as numbers. 684 // Whether we scan 0o777 and 0b111 as numbers.
681 bool harmony_numeric_literals_; 685 bool harmony_numeric_literals_;
682 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. 686 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords.
683 bool harmony_classes_; 687 bool harmony_classes_;
684 }; 688 };
685 689
686 } } // namespace v8::internal 690 } } // namespace v8::internal
687 691
688 #endif // V8_SCANNER_H_ 692 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698