1 // Copyright 2012 the V8 project authors. All rights reserved. 2 // Redistribution and use in source and binary forms, with or without 3 // modification, are permitted provided that the following conditions are 4 // met: 5 // 6 // * Redistributions of source code must retain the above copyright 7 // notice, this list of conditions and the following disclaimer. 8 // * Redistributions in binary form must reproduce the above 9 // copyright notice, this list of conditions and the following 10 // disclaimer in the documentation and/or other materials provided 11 // with the distribution. 12 // * Neither the name of Google Inc. nor the names of its 13 // contributors may be used to endorse or promote products derived 14 // from this software without specific prior written permission. 15 // 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28 #ifndef V8_PREPARSER_H 29 #define V8_PREPARSER_H 30 31 #include "hashmap.h" 32 #include "token.h" 33 #include "scanner.h" 34 35 namespace v8 { 36 37 namespace internal { 38 class UnicodeCache; 39 } 40 41 namespace preparser { 42 43 typedef uint8_t byte; 44 45 // Preparsing checks a JavaScript program and emits preparse-data that helps 46 // a later parsing to be faster. 47 // See preparse-data-format.h for the data format. 48 49 // The PreParser checks that the syntax follows the grammar for JavaScript, 50 // and collects some information about the program along the way. 51 // The grammar check is only performed in order to understand the program 52 // sufficiently to deduce some information about it, that can be used 53 // to speed up later parsing. Finding errors is not the goal of pre-parsing, 54 // rather it is to speed up properly written and correct programs. 55 // That means that contextual checks (like a label being declared where 56 // it is used) are generally omitted. 57 58 namespace i = v8::internal; 59 60 class DuplicateFinder { 61 public: 62 explicit DuplicateFinder(i::UnicodeCache* constants) 63 : unicode_constants_(constants), 64 backing_store_(16), 65 map_(&Match) { } 66 67 int AddAsciiSymbol(i::Vector<const char> key, int value); 68 int AddUtf16Symbol(i::Vector<const uint16_t> key, int value); 69 // Add a a number literal by converting it (if necessary) 70 // to the string that ToString(ToNumber(literal)) would generate. 71 // and then adding that string with AddAsciiSymbol. 72 // This string is the actual value used as key in an object literal, 73 // and the one that must be different from the other keys. 74 int AddNumber(i::Vector<const char> key, int value); 75 76 private: 77 int AddSymbol(i::Vector<const byte> key, bool is_ascii, int value); 78 // Backs up the key and its length in the backing store. 79 // The backup is stored with a base 127 encoding of the 80 // length (plus a bit saying whether the string is ASCII), 81 // followed by the bytes of the key. 82 byte* BackupKey(i::Vector<const byte> key, bool is_ascii); 83 84 // Compare two encoded keys (both pointing into the backing store) 85 // for having the same base-127 encoded lengths and ASCII-ness, 86 // and then having the same 'length' bytes following. 87 static bool Match(void* first, void* second); 88 // Creates a hash from a sequence of bytes. 89 static uint32_t Hash(i::Vector<const byte> key, bool is_ascii); 90 // Checks whether a string containing a JS number is its canonical 91 // form. 92 static bool IsNumberCanonical(i::Vector<const char> key); 93 94 // Size of buffer. Sufficient for using it to call DoubleToCString in 95 // from conversions.h. 96 static const int kBufferSize = 100; 97 98 i::UnicodeCache* unicode_constants_; 99 // Backing store used to store strings used as hashmap keys. 100 i::SequenceCollector<unsigned char> backing_store_; 101 i::HashMap map_; 102 // Buffer used for string->number->canonical string conversions. 103 char number_buffer_[kBufferSize]; 104 }; 105 106 107 #ifdef WIN32 108 #undef Yield 109 #endif 110 111 112 class PreParser { 113 public: 114 enum PreParseResult { 115 kPreParseStackOverflow, 116 kPreParseSuccess 117 }; 118 119 120 PreParser(i::Scanner* scanner, 121 i::ParserRecorder* log, 122 uintptr_t stack_limit) 123 : scanner_(scanner), 124 log_(log), 125 scope_(NULL), 126 stack_limit_(stack_limit), 127 strict_mode_violation_location_(i::Scanner::Location::invalid()), 128 strict_mode_violation_type_(NULL), 129 stack_overflow_(false), 130 allow_lazy_(false), 131 allow_natives_syntax_(false), 132 allow_generators_(false), 133 allow_for_of_(false), 134 parenthesized_function_(false) { } 135 136 ~PreParser() {} 137 138 bool allow_natives_syntax() const { return allow_natives_syntax_; } 139 bool allow_lazy() const { return allow_lazy_; } 140 bool allow_modules() const { return scanner_->HarmonyModules(); } 141 bool allow_harmony_scoping() const { return scanner_->HarmonyScoping(); } 142 bool allow_generators() const { return allow_generators_; } 143 bool allow_for_of() const { return allow_for_of_; } 144 bool allow_harmony_numeric_literals() const { 145 return scanner_->HarmonyNumericLiterals(); 146 } 147 148 void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } 149 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } 150 void set_allow_modules(bool allow) { scanner_->SetHarmonyModules(allow); } 151 void set_allow_harmony_scoping(bool allow) { 152 scanner_->SetHarmonyScoping(allow); 153 } 154 void set_allow_generators(bool allow) { allow_generators_ = allow; } 155 void set_allow_for_of(bool allow) { allow_for_of_ = allow; } 156 void set_allow_harmony_numeric_literals(bool allow) { 157 scanner_->SetHarmonyNumericLiterals(allow); 158 } 159 160 // Pre-parse the program from the character stream; returns true on 161 // success (even if parsing failed, the pre-parse data successfully 162 // captured the syntax error), and false if a stack-overflow happened 163 // during parsing. 164 PreParseResult PreParseProgram() { 165 Scope top_scope(&scope_, kTopLevelScope); 166 bool ok = true; 167 int start_position = scanner_->peek_location().beg_pos; 168 ParseSourceElements(i::Token::EOS, &ok); 169 if (stack_overflow_) return kPreParseStackOverflow; 170 if (!ok) { 171 ReportUnexpectedToken(scanner_->current_token()); 172 } else if (!scope_->is_classic_mode()) { 173 CheckOctalLiteral(start_position, scanner_->location().end_pos, &ok); 174 } 175 return kPreParseSuccess; 176 } 177 178 // Parses a single function literal, from the opening parentheses before 179 // parameters to the closing brace after the body. 180 // Returns a FunctionEntry describing the body of the function in enough 181 // detail that it can be lazily compiled. 182 // The scanner is expected to have matched the "function" or "function*" 183 // keyword and parameters, and have consumed the initial '{'. 184 // At return, unless an error occurred, the scanner is positioned before the 185 // the final '}'. 186 PreParseResult PreParseLazyFunction(i::LanguageMode mode, 187 bool is_generator, 188 i::ParserRecorder* log); 189 190 private: 191 // Used to detect duplicates in object literals. Each of the values 192 // kGetterProperty, kSetterProperty and kValueProperty represents 193 // a type of object literal property. When parsing a property, its 194 // type value is stored in the DuplicateFinder for the property name. 195 // Values are chosen so that having intersection bits means the there is 196 // an incompatibility. 197 // I.e., you can add a getter to a property that already has a setter, since 198 // kGetterProperty and kSetterProperty doesn't intersect, but not if it 199 // already has a getter or a value. Adding the getter to an existing 200 // setter will store the value (kGetterProperty | kSetterProperty), which 201 // is incompatible with adding any further properties. 202 enum PropertyType { 203 kNone = 0, 204 // Bit patterns representing different object literal property types. 205 kGetterProperty = 1, 206 kSetterProperty = 2, 207 kValueProperty = 7, 208 // Helper constants. 209 kValueFlag = 4 210 }; 211 212 // Checks the type of conflict based on values coming from PropertyType. 213 bool HasConflict(int type1, int type2) { return (type1 & type2) != 0; } 214 bool IsDataDataConflict(int type1, int type2) { 215 return ((type1 & type2) & kValueFlag) != 0; 216 } 217 bool IsDataAccessorConflict(int type1, int type2) { 218 return ((type1 ^ type2) & kValueFlag) != 0; 219 } 220 bool IsAccessorAccessorConflict(int type1, int type2) { 221 return ((type1 | type2) & kValueFlag) == 0; 222 } 223 224 225 void CheckDuplicate(DuplicateFinder* finder, 226 i::Token::Value property, 227 int type, 228 bool* ok); 229 230 // These types form an algebra over syntactic categories that is just 231 // rich enough to let us recognize and propagate the constructs that 232 // are either being counted in the preparser data, or is important 233 // to throw the correct syntax error exceptions. 234 235 enum ScopeType { 236 kTopLevelScope, 237 kFunctionScope 238 }; 239 240 enum VariableDeclarationContext { 241 kSourceElement, 242 kStatement, 243 kForStatement 244 }; 245 246 // If a list of variable declarations includes any initializers. 247 enum VariableDeclarationProperties { 248 kHasInitializers, 249 kHasNoInitializers 250 }; 251 252 class Expression; 253 254 class Identifier { 255 public: 256 static Identifier Default() { 257 return Identifier(kUnknownIdentifier); 258 } 259 static Identifier Eval() { 260 return Identifier(kEvalIdentifier); 261 } 262 static Identifier Arguments() { 263 return Identifier(kArgumentsIdentifier); 264 } 265 static Identifier FutureReserved() { 266 return Identifier(kFutureReservedIdentifier); 267 } 268 static Identifier FutureStrictReserved() { 269 return Identifier(kFutureStrictReservedIdentifier); 270 } 271 static Identifier Yield() { 272 return Identifier(kYieldIdentifier); 273 } 274 bool IsEval() { return type_ == kEvalIdentifier; } 275 bool IsArguments() { return type_ == kArgumentsIdentifier; } 276 bool IsEvalOrArguments() { return type_ >= kEvalIdentifier; } 277 bool IsYield() { return type_ == kYieldIdentifier; } 278 bool IsFutureReserved() { return type_ == kFutureReservedIdentifier; } 279 bool IsFutureStrictReserved() { 280 return type_ == kFutureStrictReservedIdentifier; 281 } 282 bool IsValidStrictVariable() { return type_ == kUnknownIdentifier; } 283 284 private: 285 enum Type { 286 kUnknownIdentifier, 287 kFutureReservedIdentifier, 288 kFutureStrictReservedIdentifier, 289 kYieldIdentifier, 290 kEvalIdentifier, 291 kArgumentsIdentifier 292 }; 293 explicit Identifier(Type type) : type_(type) { } 294 Type type_; 295 296 friend class Expression; 297 }; 298 299 // Bits 0 and 1 are used to identify the type of expression: 300 // If bit 0 is set, it's an identifier. 301 // if bit 1 is set, it's a string literal. 302 // If neither is set, it's no particular type, and both set isn't 303 // use yet. 304 // Bit 2 is used to mark the expression as being parenthesized, 305 // so "(foo)" isn't recognized as a pure identifier (and possible label). 306 class Expression { 307 public: 308 static Expression Default() { 309 return Expression(kUnknownExpression); 310 } 311 312 static Expression FromIdentifier(Identifier id) { 313 return Expression(kIdentifierFlag | (id.type_ << kIdentifierShift)); 314 } 315 316 static Expression StringLiteral() { 317 return Expression(kUnknownStringLiteral); 318 } 319 320 static Expression UseStrictStringLiteral() { 321 return Expression(kUseStrictString); 322 } 323 324 static Expression This() { 325 return Expression(kThisExpression); 326 } 327 328 static Expression ThisProperty() { 329 return Expression(kThisPropertyExpression); 330 } 331 332 static Expression StrictFunction() { 333 return Expression(kStrictFunctionExpression); 334 } 335 336 bool IsIdentifier() { 337 return (code_ & kIdentifierFlag) != 0; 338 } 339 340 // Only works corretly if it is actually an identifier expression. 341 PreParser::Identifier AsIdentifier() { 342 return PreParser::Identifier( 343 static_cast<PreParser::Identifier::Type>(code_ >> kIdentifierShift)); 344 } 345 346 bool IsParenthesized() { 347 // If bit 0 or 1 is set, we interpret bit 2 as meaning parenthesized. 348 return (code_ & 7) > 4; 349 } 350 351 bool IsRawIdentifier() { 352 return !IsParenthesized() && IsIdentifier(); 353 } 354 355 bool IsStringLiteral() { return (code_ & kStringLiteralFlag) != 0; } 356 357 bool IsRawStringLiteral() { 358 return !IsParenthesized() && IsStringLiteral(); 359 } 360 361 bool IsUseStrictLiteral() { 362 return (code_ & kStringLiteralMask) == kUseStrictString; 363 } 364 365 bool IsThis() { 366 return code_ == kThisExpression; 367 } 368 369 bool IsThisProperty() { 370 return code_ == kThisPropertyExpression; 371 } 372 373 bool IsStrictFunction() { 374 return code_ == kStrictFunctionExpression; 375 } 376 377 Expression Parenthesize() { 378 int type = code_ & 3; 379 if (type != 0) { 380 // Identifiers and string literals can be parenthesized. 381 // They no longer work as labels or directive prologues, 382 // but are still recognized in other contexts. 383 return Expression(code_ | kParenthesizedExpressionFlag); 384 } 385 // For other types of expressions, it's not important to remember 386 // the parentheses. 387 return *this; 388 } 389 390 private: 391 // First two/three bits are used as flags. 392 // Bit 0 and 1 represent identifiers or strings literals, and are 393 // mutually exclusive, but can both be absent. 394 // If bit 0 or 1 are set, bit 2 marks that the expression has 395 // been wrapped in parentheses (a string literal can no longer 396 // be a directive prologue, and an identifier can no longer be 397 // a label. 398 enum { 399 kUnknownExpression = 0, 400 // Identifiers 401 kIdentifierFlag = 1, // Used to detect labels. 402 kIdentifierShift = 3, 403 404 kStringLiteralFlag = 2, // Used to detect directive prologue. 405 kUnknownStringLiteral = kStringLiteralFlag, 406 kUseStrictString = kStringLiteralFlag | 8, 407 kStringLiteralMask = kUseStrictString, 408 409 // Only if identifier or string literal. 410 kParenthesizedExpressionFlag = 4, 411 412 // Below here applies if neither identifier nor string literal. 413 kThisExpression = 4, 414 kThisPropertyExpression = 8, 415 kStrictFunctionExpression = 12 416 }; 417 418 explicit Expression(int expression_code) : code_(expression_code) { } 419 420 int code_; 421 }; 422 423 class Statement { 424 public: 425 static Statement Default() { 426 return Statement(kUnknownStatement); 427 } 428 429 static Statement FunctionDeclaration() { 430 return Statement(kFunctionDeclaration); 431 } 432 433 // Creates expression statement from expression. 434 // Preserves being an unparenthesized string literal, possibly 435 // "use strict". 436 static Statement ExpressionStatement(Expression expression) { 437 if (!expression.IsParenthesized()) { 438 if (expression.IsUseStrictLiteral()) { 439 return Statement(kUseStrictExpressionStatement); 440 } 441 if (expression.IsStringLiteral()) { 442 return Statement(kStringLiteralExpressionStatement); 443 } 444 } 445 return Default(); 446 } 447 448 bool IsStringLiteral() { 449 return code_ != kUnknownStatement; 450 } 451 452 bool IsUseStrictLiteral() { 453 return code_ == kUseStrictExpressionStatement; 454 } 455 456 bool IsFunctionDeclaration() { 457 return code_ == kFunctionDeclaration; 458 } 459 460 private: 461 enum Type { 462 kUnknownStatement, 463 kStringLiteralExpressionStatement, 464 kUseStrictExpressionStatement, 465 kFunctionDeclaration 466 }; 467 468 explicit Statement(Type code) : code_(code) {} 469 Type code_; 470 }; 471 472 enum SourceElements { 473 kUnknownSourceElements 474 }; 475 476 typedef int Arguments; 477 478 class Scope { 479 public: 480 Scope(Scope** variable, ScopeType type) 481 : variable_(variable), 482 prev_(*variable), 483 type_(type), 484 materialized_literal_count_(0), 485 expected_properties_(0), 486 with_nesting_count_(0), 487 language_mode_( 488 (prev_ != NULL) ? prev_->language_mode() : i::CLASSIC_MODE), 489 is_generator_(false) { 490 *variable = this; 491 } 492 ~Scope() { *variable_ = prev_; } 493 void NextMaterializedLiteralIndex() { materialized_literal_count_++; } 494 void AddProperty() { expected_properties_++; } 495 ScopeType type() { return type_; } 496 int expected_properties() { return expected_properties_; } 497 int materialized_literal_count() { return materialized_literal_count_; } 498 bool IsInsideWith() { return with_nesting_count_ != 0; } 499 bool is_generator() { return is_generator_; } 500 void set_is_generator(bool is_generator) { is_generator_ = is_generator; } 501 bool is_classic_mode() { 502 return language_mode_ == i::CLASSIC_MODE; 503 } 504 i::LanguageMode language_mode() { 505 return language_mode_; 506 } 507 void set_language_mode(i::LanguageMode language_mode) { 508 language_mode_ = language_mode; 509 } 510 511 class InsideWith { 512 public: 513 explicit InsideWith(Scope* scope) : scope_(scope) { 514 scope->with_nesting_count_++; 515 } 516 517 ~InsideWith() { scope_->with_nesting_count_--; } 518 519 private: 520 Scope* scope_; 521 DISALLOW_COPY_AND_ASSIGN(InsideWith); 522 }; 523 524 private: 525 Scope** const variable_; 526 Scope* const prev_; 527 const ScopeType type_; 528 int materialized_literal_count_; 529 int expected_properties_; 530 int with_nesting_count_; 531 i::LanguageMode language_mode_; 532 bool is_generator_; 533 }; 534 535 // Report syntax error 536 void ReportUnexpectedToken(i::Token::Value token); 537 void ReportMessageAt(i::Scanner::Location location, 538 const char* type, 539 const char* name_opt) { 540 log_->LogMessage(location.beg_pos, location.end_pos, type, name_opt); 541 } 542 void ReportMessageAt(int start_pos, 543 int end_pos, 544 const char* type, 545 const char* name_opt) { 546 log_->LogMessage(start_pos, end_pos, type, name_opt); 547 } 548 549 void CheckOctalLiteral(int beg_pos, int end_pos, bool* ok); 550 551 // All ParseXXX functions take as the last argument an *ok parameter 552 // which is set to false if parsing failed; it is unchanged otherwise. 553 // By making the 'exception handling' explicit, we are forced to check 554 // for failure at the call sites. 555 Statement ParseSourceElement(bool* ok); 556 SourceElements ParseSourceElements(int end_token, bool* ok); 557 Statement ParseStatement(bool* ok); 558 Statement ParseFunctionDeclaration(bool* ok); 559 Statement ParseBlock(bool* ok); 560 Statement ParseVariableStatement(VariableDeclarationContext var_context, 561 bool* ok); 562 Statement ParseVariableDeclarations(VariableDeclarationContext var_context, 563 VariableDeclarationProperties* decl_props, 564 int* num_decl, 565 bool* ok); 566 Statement ParseExpressionOrLabelledStatement(bool* ok); 567 Statement ParseIfStatement(bool* ok); 568 Statement ParseContinueStatement(bool* ok); 569 Statement ParseBreakStatement(bool* ok); 570 Statement ParseReturnStatement(bool* ok); 571 Statement ParseWithStatement(bool* ok); 572 Statement ParseSwitchStatement(bool* ok); 573 Statement ParseDoWhileStatement(bool* ok); 574 Statement ParseWhileStatement(bool* ok); 575 Statement ParseForStatement(bool* ok); 576 Statement ParseThrowStatement(bool* ok); 577 Statement ParseTryStatement(bool* ok); 578 Statement ParseDebuggerStatement(bool* ok); 579 580 Expression ParseExpression(bool accept_IN, bool* ok); 581 Expression ParseAssignmentExpression(bool accept_IN, bool* ok); 582 Expression ParseYieldExpression(bool* ok); 583 Expression ParseConditionalExpression(bool accept_IN, bool* ok); 584 Expression ParseBinaryExpression(int prec, bool accept_IN, bool* ok); 585 Expression ParseUnaryExpression(bool* ok); 586 Expression ParsePostfixExpression(bool* ok); 587 Expression ParseLeftHandSideExpression(bool* ok); 588 Expression ParseNewExpression(bool* ok); 589 Expression ParseMemberExpression(bool* ok); 590 Expression ParseMemberWithNewPrefixesExpression(unsigned new_count, bool* ok); 591 Expression ParsePrimaryExpression(bool* ok); 592 Expression ParseArrayLiteral(bool* ok); 593 Expression ParseObjectLiteral(bool* ok); 594 Expression ParseRegExpLiteral(bool seen_equal, bool* ok); 595 Expression ParseV8Intrinsic(bool* ok); 596 597 Arguments ParseArguments(bool* ok); 598 Expression ParseFunctionLiteral(bool is_generator, bool* ok); 599 void ParseLazyFunctionLiteralBody(bool* ok); 600 601 Identifier ParseIdentifier(bool* ok); 602 Identifier ParseIdentifierName(bool* ok); 603 Identifier ParseIdentifierNameOrGetOrSet(bool* is_get, 604 bool* is_set, 605 bool* ok); 606 607 // Logs the currently parsed literal as a symbol in the preparser data. 608 void LogSymbol(); 609 // Log the currently parsed identifier. 610 Identifier GetIdentifierSymbol(); 611 // Log the currently parsed string literal. 612 Expression GetStringSymbol(); 613 614 i::Token::Value peek() { 615 if (stack_overflow_) return i::Token::ILLEGAL; 616 return scanner_->peek(); 617 } 618 619 i::Token::Value Next() { 620 if (stack_overflow_) return i::Token::ILLEGAL; 621 { 622 int marker; 623 if (reinterpret_cast<uintptr_t>(&marker) < stack_limit_) { 624 // Further calls to peek/Next will return illegal token. 625 // The current one will still be returned. It might already 626 // have been seen using peek. 627 stack_overflow_ = true; 628 } 629 } 630 return scanner_->Next(); 631 } 632 633 bool peek_any_identifier(); 634 635 void set_language_mode(i::LanguageMode language_mode) { 636 scope_->set_language_mode(language_mode); 637 } 638 639 bool is_classic_mode() { 640 return scope_->language_mode() == i::CLASSIC_MODE; 641 } 642 643 bool is_extended_mode() { 644 return scope_->language_mode() == i::EXTENDED_MODE; 645 } 646 647 i::LanguageMode language_mode() { return scope_->language_mode(); } 648 649 void Consume(i::Token::Value token) { Next(); } 650 651 void Expect(i::Token::Value token, bool* ok) { 652 if (Next() != token) { 653 *ok = false; 654 } 655 } 656 657 bool Check(i::Token::Value token) { 658 i::Token::Value next = peek(); 659 if (next == token) { 660 Consume(next); 661 return true; 662 } 663 return false; 664 } 665 void ExpectSemicolon(bool* ok); 666 667 bool CheckInOrOf(bool accept_OF); 668 669 static int Precedence(i::Token::Value tok, bool accept_IN); 670 671 void SetStrictModeViolation(i::Scanner::Location, 672 const char* type, 673 bool* ok); 674 675 void CheckDelayedStrictModeViolation(int beg_pos, int end_pos, bool* ok); 676 677 void StrictModeIdentifierViolation(i::Scanner::Location, 678 const char* eval_args_type, 679 Identifier identifier, 680 bool* ok); 681 682 i::Scanner* scanner_; 683 i::ParserRecorder* log_; 684 Scope* scope_; 685 uintptr_t stack_limit_; 686 i::Scanner::Location strict_mode_violation_location_; 687 const char* strict_mode_violation_type_; 688 bool stack_overflow_; 689 bool allow_lazy_; 690 bool allow_natives_syntax_; 691 bool allow_generators_; 692 bool allow_for_of_; 693 bool parenthesized_function_; 694 }; 695 } } // v8::preparser 696 697 #endif // V8_PREPARSER_H 698