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

Side by Side Diff: src/scanner-base.h

Issue 7677012: Make scanner handle invalid unicode escapes in identifiers correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Fixed bug, updated sputnik expectations. Created 9 years, 4 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/scanner-base.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 // 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 inline Token::Value Select(uc32 next, Token::Value then, Token::Value else_) { 412 inline Token::Value Select(uc32 next, Token::Value then, Token::Value else_) {
413 Advance(); 413 Advance();
414 if (c0_ == next) { 414 if (c0_ == next) {
415 Advance(); 415 Advance();
416 return then; 416 return then;
417 } else { 417 } else {
418 return else_; 418 return else_;
419 } 419 }
420 } 420 }
421 421
422 uc32 ScanHexEscape(uc32 c, int length); 422 uc32 ScanHexNumber(int expected_length);
423 423
424 // Return the current source position. 424 // Return the current source position.
425 int source_pos() { 425 int source_pos() {
426 return source_->pos() - kCharacterLookaheadBufferSize; 426 return source_->pos() - kCharacterLookaheadBufferSize;
427 } 427 }
428 428
429 UnicodeCache* unicode_cache_; 429 UnicodeCache* unicode_cache_;
430 430
431 // Buffers collecting literal strings, numbers, etc. 431 // Buffers collecting literal strings, numbers, etc.
432 LiteralBuffer literal_buffer1_; 432 LiteralBuffer literal_buffer1_;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 void ScanEscape(); 531 void ScanEscape();
532 Token::Value ScanString(); 532 Token::Value ScanString();
533 533
534 // Scans a possible HTML comment -- begins with '<!'. 534 // Scans a possible HTML comment -- begins with '<!'.
535 Token::Value ScanHtmlComment(); 535 Token::Value ScanHtmlComment();
536 536
537 // Decodes a unicode escape-sequence which is part of an identifier. 537 // Decodes a unicode escape-sequence which is part of an identifier.
538 // If the escape sequence cannot be decoded the result is kBadChar. 538 // If the escape sequence cannot be decoded the result is kBadChar.
539 uc32 ScanIdentifierUnicodeEscape(); 539 uc32 ScanIdentifierUnicodeEscape();
540 // Recognizes a uniocde escape-sequence and adds its characters,
541 // uninterpreted, to the current literal. Used for parsing RegExp
542 // flags.
543 bool ScanLiteralUnicodeEscape();
540 544
541 // Start position of the octal literal last scanned. 545 // Start position of the octal literal last scanned.
542 Location octal_pos_; 546 Location octal_pos_;
543 547
544 // Whether there is a line terminator whitespace character after 548 // Whether there is a line terminator whitespace character after
545 // the current token, and before the next. Does not count newlines 549 // the current token, and before the next. Does not count newlines
546 // inside multiline comments. 550 // inside multiline comments.
547 bool has_line_terminator_before_next_; 551 bool has_line_terminator_before_next_;
548 // Whether there is a multi-line comment that contains a 552 // Whether there is a multi-line comment that contains a
549 // line-terminator after the current token, and before the next. 553 // line-terminator after the current token, and before the next.
550 bool has_multiline_comment_before_next_; 554 bool has_multiline_comment_before_next_;
551 // Whether we scan 'let' as a keyword for harmony block scoped 555 // Whether we scan 'let' as a keyword for harmony block scoped
552 // let bindings. 556 // let bindings.
553 bool harmony_block_scoping_; 557 bool harmony_block_scoping_;
554 }; 558 };
555 559
556 } } // namespace v8::internal 560 } } // namespace v8::internal
557 561
558 #endif // V8_SCANNER_BASE_H_ 562 #endif // V8_SCANNER_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | src/scanner-base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698