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

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

Issue 5295004: Preparser extracted into separate files that can be compiled to a library. (Closed)
Patch Set: Cleanup of preparse class. Created 10 years 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
« no previous file with comments | « src/scanner.cc ('k') | 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 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Next() were called). 221 // Next() were called).
222 int next_literal_length() const { 222 int next_literal_length() const {
223 // Excluding terminal '\x00' added by TerminateLiteral(). 223 // Excluding terminal '\x00' added by TerminateLiteral().
224 return next_.literal_chars.length() - 1; 224 return next_.literal_chars.length() - 1;
225 } 225 }
226 226
227 Vector<const char> next_literal() const { 227 Vector<const char> next_literal() const {
228 return Vector<const char>(next_literal_string(), next_literal_length()); 228 return Vector<const char>(next_literal_string(), next_literal_length());
229 } 229 }
230 230
231 bool stack_overflow() { return stack_overflow_; }
232
233 static const int kCharacterLookaheadBufferSize = 1; 231 static const int kCharacterLookaheadBufferSize = 1;
234 232
235 protected: 233 protected:
236 // The current and look-ahead token. 234 // The current and look-ahead token.
237 struct TokenDesc { 235 struct TokenDesc {
238 Token::Value token; 236 Token::Value token;
239 Location location; 237 Location location;
240 Vector<const char> literal_chars; 238 Vector<const char> literal_chars;
241 }; 239 };
242 240
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 TokenDesc current_; // desc for current token (as returned by Next()) 307 TokenDesc current_; // desc for current token (as returned by Next())
310 TokenDesc next_; // desc for next token (one token look-ahead) 308 TokenDesc next_; // desc for next token (one token look-ahead)
311 309
312 // Input stream. Must be initialized to an UTF16Buffer. 310 // Input stream. Must be initialized to an UTF16Buffer.
313 UTF16Buffer* source_; 311 UTF16Buffer* source_;
314 312
315 // Buffer to hold literal values (identifiers, strings, numbers) 313 // Buffer to hold literal values (identifiers, strings, numbers)
316 // using '\x00'-terminated UTF-8 encoding. Handles allocation internally. 314 // using '\x00'-terminated UTF-8 encoding. Handles allocation internally.
317 LiteralCollector literal_buffer_; 315 LiteralCollector literal_buffer_;
318 316
319 bool stack_overflow_;
320
321 // One Unicode character look-ahead; c0_ < 0 at the end of the input. 317 // One Unicode character look-ahead; c0_ < 0 at the end of the input.
322 uc32 c0_; 318 uc32 c0_;
323 }; 319 };
324 320
325 // ---------------------------------------------------------------------------- 321 // ----------------------------------------------------------------------------
326 // JavaScriptScanner - base logic for JavaScript scanning. 322 // JavaScriptScanner - base logic for JavaScript scanning.
327 323
328 class JavaScriptScanner : public Scanner { 324 class JavaScriptScanner : public Scanner {
329 public: 325 public:
330 326
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // keyword with the current prefix). 540 // keyword with the current prefix).
545 const char* keyword_; 541 const char* keyword_;
546 int counter_; 542 int counter_;
547 Token::Value keyword_token_; 543 Token::Value keyword_token_;
548 }; 544 };
549 545
550 546
551 } } // namespace v8::internal 547 } } // namespace v8::internal
552 548
553 #endif // V8_SCANNER_BASE_H_ 549 #endif // V8_SCANNER_BASE_H_
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | src/scanner-base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698