| Index: src/parser.h
|
| ===================================================================
|
| --- src/parser.h (revision 6800)
|
| +++ src/parser.h (working copy)
|
| @@ -321,7 +321,6 @@
|
| // and sets the value if it is.
|
| bool ParseHexEscape(int length, uc32* value);
|
|
|
| - uc32 ParseControlLetterEscape();
|
| uc32 ParseOctalLiteral();
|
|
|
| // Tries to parse the input as a back reference. If successful it
|
| @@ -424,15 +423,24 @@
|
|
|
| // Returns NULL if parsing failed.
|
| FunctionLiteral* ParseProgram(Handle<String> source,
|
| - bool in_global_context);
|
| + bool in_global_context,
|
| + StrictModeFlag strict_mode);
|
|
|
| FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info);
|
|
|
| void ReportMessageAt(Scanner::Location loc,
|
| const char* message,
|
| Vector<const char*> args);
|
| + void ReportMessageAt(Scanner::Location loc,
|
| + const char* message,
|
| + Vector<Handle<String> > args);
|
|
|
| protected:
|
| + // Limit on number of function parameters is chosen arbitrarily.
|
| + // Code::Flags uses only the low 17 bits of num-parameters to
|
| + // construct a hashable id, so if more than 2^17 are allowed, this
|
| + // should be checked.
|
| + static const int kMaxNumFunctionParameters = 32766;
|
| FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info,
|
| UC16CharacterStream* source,
|
| ZoneScope* zone_scope);
|
| @@ -444,6 +452,7 @@
|
| // Called by ParseProgram after setting up the scanner.
|
| FunctionLiteral* DoParseProgram(Handle<String> source,
|
| bool in_global_context,
|
| + StrictModeFlag strict_mode,
|
| ZoneScope* zone_scope);
|
|
|
| // Report syntax error
|
| @@ -544,6 +553,7 @@
|
|
|
| ZoneList<Expression*>* ParseArguments(bool* ok);
|
| FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name,
|
| + bool name_is_reserved,
|
| int function_token_position,
|
| FunctionLiteralType type,
|
| bool* ok);
|
| @@ -573,6 +583,8 @@
|
| return scanner().Next();
|
| }
|
|
|
| + bool peek_any_identifier();
|
| +
|
| INLINE(void Consume(Token::Value token));
|
| void Expect(Token::Value token, bool* ok);
|
| bool Check(Token::Value token);
|
| @@ -606,11 +618,20 @@
|
| Literal* GetLiteralNumber(double value);
|
|
|
| Handle<String> ParseIdentifier(bool* ok);
|
| + Handle<String> ParseIdentifierOrReservedWord(bool* is_reserved, bool* ok);
|
| Handle<String> ParseIdentifierName(bool* ok);
|
| Handle<String> ParseIdentifierOrGetOrSet(bool* is_get,
|
| bool* is_set,
|
| bool* ok);
|
|
|
| + // Strict mode validation of LValue expressions
|
| + void CheckStrictModeLValue(Expression* expression,
|
| + const char* error,
|
| + bool* ok);
|
| +
|
| + // Strict mode octal literal validation.
|
| + void CheckOctalLiteral(int beg_pos, int end_pos, bool* ok);
|
| +
|
| // Parser support
|
| VariableProxy* Declare(Handle<String> name, Variable::Mode mode,
|
| FunctionLiteral* fun,
|
| @@ -683,6 +704,11 @@
|
| ScriptDataImpl* pre_data_;
|
| FuncNameInferrer* fni_;
|
| bool stack_overflow_;
|
| + // If true, the next (and immediately following) function literal is
|
| + // preceded by a parenthesis.
|
| + // Heuristically that means that the function will be called immediately,
|
| + // so never lazily compile it.
|
| + bool parenthesized_function_;
|
| };
|
|
|
|
|
|
|