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

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

Issue 6248013: Strict mode octal literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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
OLDNEW
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 Location() : beg_pos(0), end_pos(0) { } 273 Location() : beg_pos(0), end_pos(0) { }
274 int beg_pos; 274 int beg_pos;
275 int end_pos; 275 int end_pos;
276 }; 276 };
277 277
278 // Returns the location information for the current token 278 // Returns the location information for the current token
279 // (the token returned by Next()). 279 // (the token returned by Next()).
280 Location location() const { return current_.location; } 280 Location location() const { return current_.location; }
281 Location peek_location() const { return next_.location; } 281 Location peek_location() const { return next_.location; }
282 282
283 // Returns the location of the last seen octal literal
284 Location octal_location() const { return octal_loc_; }
285 void clear_octal_location() { octal_loc_ = Location(); }
286
283 // Returns the literal string, if any, for the current token (the 287 // Returns the literal string, if any, for the current token (the
284 // token returned by Next()). The string is 0-terminated and in 288 // token returned by Next()). The string is 0-terminated and in
285 // UTF-8 format; they may contain 0-characters. Literal strings are 289 // UTF-8 format; they may contain 0-characters. Literal strings are
286 // collected for identifiers, strings, and numbers. 290 // collected for identifiers, strings, and numbers.
287 // These functions only give the correct result if the literal 291 // These functions only give the correct result if the literal
288 // was scanned between calls to StartLiteral() and TerminateLiteral(). 292 // was scanned between calls to StartLiteral() and TerminateLiteral().
289 bool is_literal_ascii() { 293 bool is_literal_ascii() {
290 ASSERT_NOT_NULL(current_.literal_chars); 294 ASSERT_NOT_NULL(current_.literal_chars);
291 return current_.literal_chars->is_ascii(); 295 return current_.literal_chars->is_ascii();
292 } 296 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // Buffers collecting literal strings, numbers, etc. 407 // Buffers collecting literal strings, numbers, etc.
404 LiteralBuffer literal_buffer1_; 408 LiteralBuffer literal_buffer1_;
405 LiteralBuffer literal_buffer2_; 409 LiteralBuffer literal_buffer2_;
406 410
407 TokenDesc current_; // desc for current token (as returned by Next()) 411 TokenDesc current_; // desc for current token (as returned by Next())
408 TokenDesc next_; // desc for next token (one token look-ahead) 412 TokenDesc next_; // desc for next token (one token look-ahead)
409 413
410 // Input stream. Must be initialized to an UC16CharacterStream. 414 // Input stream. Must be initialized to an UC16CharacterStream.
411 UC16CharacterStream* source_; 415 UC16CharacterStream* source_;
412 416
417 // Location of the octal literal last seen
418 Location octal_loc_;
413 419
414 // One Unicode character look-ahead; c0_ < 0 at the end of the input. 420 // One Unicode character look-ahead; c0_ < 0 at the end of the input.
415 uc32 c0_; 421 uc32 c0_;
416 }; 422 };
417 423
418 // ---------------------------------------------------------------------------- 424 // ----------------------------------------------------------------------------
419 // JavaScriptScanner - base logic for JavaScript scanning. 425 // JavaScriptScanner - base logic for JavaScript scanning.
420 426
421 class JavaScriptScanner : public Scanner { 427 class JavaScriptScanner : public Scanner {
422 public: 428 public:
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // keyword with the current prefix). 623 // keyword with the current prefix).
618 const char* keyword_; 624 const char* keyword_;
619 int counter_; 625 int counter_;
620 Token::Value keyword_token_; 626 Token::Value keyword_token_;
621 }; 627 };
622 628
623 629
624 } } // namespace v8::internal 630 } } // namespace v8::internal
625 631
626 #endif // V8_SCANNER_BASE_H_ 632 #endif // V8_SCANNER_BASE_H_
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scanner-base.cc » ('j') | src/scanner-base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698