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

Side by Side Diff: src/preparser.h

Issue 7631020: Version 3.5.6. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: 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 | « src/platform-linux.cc ('k') | src/preparser.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // These types form an algebra over syntactic categories that is just 70 // These types form an algebra over syntactic categories that is just
71 // rich enough to let us recognize and propagate the constructs that 71 // rich enough to let us recognize and propagate the constructs that
72 // are either being counted in the preparser data, or is important 72 // are either being counted in the preparser data, or is important
73 // to throw the correct syntax error exceptions. 73 // to throw the correct syntax error exceptions.
74 74
75 enum ScopeType { 75 enum ScopeType {
76 kTopLevelScope, 76 kTopLevelScope,
77 kFunctionScope 77 kFunctionScope
78 }; 78 };
79 79
80 enum VariableDeclarationContext {
81 kSourceElement,
82 kStatement,
83 kForStatement
84 };
85
80 class Expression; 86 class Expression;
81 87
82 class Identifier { 88 class Identifier {
83 public: 89 public:
84 static Identifier Default() { 90 static Identifier Default() {
85 return Identifier(kUnknownIdentifier); 91 return Identifier(kUnknownIdentifier);
86 } 92 }
87 static Identifier Eval() { 93 static Identifier Eval() {
88 return Identifier(kEvalIdentifier); 94 return Identifier(kEvalIdentifier);
89 } 95 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 uintptr_t stack_limit, 343 uintptr_t stack_limit,
338 bool allow_lazy) 344 bool allow_lazy)
339 : scanner_(scanner), 345 : scanner_(scanner),
340 log_(log), 346 log_(log),
341 scope_(NULL), 347 scope_(NULL),
342 stack_limit_(stack_limit), 348 stack_limit_(stack_limit),
343 strict_mode_violation_location_(i::Scanner::Location::invalid()), 349 strict_mode_violation_location_(i::Scanner::Location::invalid()),
344 strict_mode_violation_type_(NULL), 350 strict_mode_violation_type_(NULL),
345 stack_overflow_(false), 351 stack_overflow_(false),
346 allow_lazy_(true), 352 allow_lazy_(true),
347 parenthesized_function_(false) { } 353 parenthesized_function_(false),
354 harmony_block_scoping_(scanner->HarmonyBlockScoping()) { }
348 355
349 // Preparse the program. Only called in PreParseProgram after creating 356 // Preparse the program. Only called in PreParseProgram after creating
350 // the instance. 357 // the instance.
351 PreParseResult PreParse() { 358 PreParseResult PreParse() {
352 Scope top_scope(&scope_, kTopLevelScope); 359 Scope top_scope(&scope_, kTopLevelScope);
353 bool ok = true; 360 bool ok = true;
354 int start_position = scanner_->peek_location().beg_pos; 361 int start_position = scanner_->peek_location().beg_pos;
355 ParseSourceElements(i::Token::EOS, &ok); 362 ParseSourceElements(i::Token::EOS, &ok);
356 if (stack_overflow_) return kPreParseStackOverflow; 363 if (stack_overflow_) return kPreParseStackOverflow;
357 if (!ok) { 364 if (!ok) {
(...skipping 12 matching lines...) Expand all
370 const char* name_opt) { 377 const char* name_opt) {
371 log_->LogMessage(start_pos, end_pos, type, name_opt); 378 log_->LogMessage(start_pos, end_pos, type, name_opt);
372 } 379 }
373 380
374 void CheckOctalLiteral(int beg_pos, int end_pos, bool* ok); 381 void CheckOctalLiteral(int beg_pos, int end_pos, bool* ok);
375 382
376 // All ParseXXX functions take as the last argument an *ok parameter 383 // All ParseXXX functions take as the last argument an *ok parameter
377 // which is set to false if parsing failed; it is unchanged otherwise. 384 // which is set to false if parsing failed; it is unchanged otherwise.
378 // By making the 'exception handling' explicit, we are forced to check 385 // By making the 'exception handling' explicit, we are forced to check
379 // for failure at the call sites. 386 // for failure at the call sites.
387 Statement ParseSourceElement(bool* ok);
380 SourceElements ParseSourceElements(int end_token, bool* ok); 388 SourceElements ParseSourceElements(int end_token, bool* ok);
381 Statement ParseStatement(bool* ok); 389 Statement ParseStatement(bool* ok);
382 Statement ParseFunctionDeclaration(bool* ok); 390 Statement ParseFunctionDeclaration(bool* ok);
383 Statement ParseBlock(bool* ok); 391 Statement ParseBlock(bool* ok);
384 Statement ParseVariableStatement(bool* ok); 392 Statement ParseVariableStatement(VariableDeclarationContext var_context,
385 Statement ParseVariableDeclarations(bool accept_IN, int* num_decl, bool* ok); 393 bool* ok);
394 Statement ParseVariableDeclarations(VariableDeclarationContext var_context,
395 int* num_decl,
396 bool* ok);
386 Statement ParseExpressionOrLabelledStatement(bool* ok); 397 Statement ParseExpressionOrLabelledStatement(bool* ok);
387 Statement ParseIfStatement(bool* ok); 398 Statement ParseIfStatement(bool* ok);
388 Statement ParseContinueStatement(bool* ok); 399 Statement ParseContinueStatement(bool* ok);
389 Statement ParseBreakStatement(bool* ok); 400 Statement ParseBreakStatement(bool* ok);
390 Statement ParseReturnStatement(bool* ok); 401 Statement ParseReturnStatement(bool* ok);
391 Statement ParseWithStatement(bool* ok); 402 Statement ParseWithStatement(bool* ok);
392 Statement ParseSwitchStatement(bool* ok); 403 Statement ParseSwitchStatement(bool* ok);
393 Statement ParseDoWhileStatement(bool* ok); 404 Statement ParseDoWhileStatement(bool* ok);
394 Statement ParseWhileStatement(bool* ok); 405 Statement ParseWhileStatement(bool* ok);
395 Statement ParseForStatement(bool* ok); 406 Statement ParseForStatement(bool* ok);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 500
490 i::JavaScriptScanner* scanner_; 501 i::JavaScriptScanner* scanner_;
491 i::ParserRecorder* log_; 502 i::ParserRecorder* log_;
492 Scope* scope_; 503 Scope* scope_;
493 uintptr_t stack_limit_; 504 uintptr_t stack_limit_;
494 i::Scanner::Location strict_mode_violation_location_; 505 i::Scanner::Location strict_mode_violation_location_;
495 const char* strict_mode_violation_type_; 506 const char* strict_mode_violation_type_;
496 bool stack_overflow_; 507 bool stack_overflow_;
497 bool allow_lazy_; 508 bool allow_lazy_;
498 bool parenthesized_function_; 509 bool parenthesized_function_;
510 bool harmony_block_scoping_;
499 }; 511 };
500 } } // v8::preparser 512 } } // v8::preparser
501 513
502 #endif // V8_PREPARSER_H 514 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698