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

Side by Side Diff: src/parser.h

Issue 8306024: Make native syntax an early error in the preparser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/compiler.cc ('k') | src/parser.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 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_PARSER_H_ 28 #ifndef V8_PARSER_H_
29 #define V8_PARSER_H_ 29 #define V8_PARSER_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "ast.h" 32 #include "ast.h"
33 #include "preparse-data-format.h" 33 #include "preparse-data-format.h"
34 #include "preparse-data.h" 34 #include "preparse-data.h"
35 #include "scopes.h" 35 #include "scopes.h"
36 #include "preparser.h"
36 37
37 namespace v8 { 38 namespace v8 {
38 namespace internal { 39 namespace internal {
39 40
40 class CompilationInfo; 41 class CompilationInfo;
41 class FuncNameInferrer; 42 class FuncNameInferrer;
42 class ParserLog; 43 class ParserLog;
43 class PositionStack; 44 class PositionStack;
44 class Target; 45 class Target;
45 class LexicalScope; 46 class LexicalScope;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 // Read strings written by ParserRecorder::WriteString. 152 // Read strings written by ParserRecorder::WriteString.
152 static const char* ReadString(unsigned* start, int* chars); 153 static const char* ReadString(unsigned* start, int* chars);
153 154
154 friend class ScriptData; 155 friend class ScriptData;
155 }; 156 };
156 157
157 158
158 class ParserApi { 159 class ParserApi {
159 public: 160 public:
161 enum Flags {
162 kNoFlags = v8::preparser::PreParser::kNoFlags,
163 kAllowLazy = v8::preparser::PreParser::kAllowLazy,
164 kAllowNativesSyntax = v8::preparser::PreParser::kAllowNativesSyntax,
165 kHarmonyScoping = kAllowNativesSyntax * 2
fschneider 2011/10/17 10:33:51 Why is there not harmony scoping flag in the prepa
Lasse Reichstein 2011/10/17 11:00:30 Not sure there is a reason. In the preparser, the
166 };
167
160 // Parses the source code represented by the compilation info and sets its 168 // Parses the source code represented by the compilation info and sets its
161 // function literal. Returns false (and deallocates any allocated AST 169 // function literal. Returns false (and deallocates any allocated AST
162 // nodes) if parsing failed. 170 // nodes) if parsing failed.
163 static bool Parse(CompilationInfo* info); 171 static bool Parse(CompilationInfo* info);
164 172
165 // Generic preparser generating full preparse data. 173 // Generic preparser generating full preparse data.
166 static ScriptDataImpl* PreParse(UC16CharacterStream* source, 174 static ScriptDataImpl* PreParse(UC16CharacterStream* source,
167 v8::Extension* extension, 175 v8::Extension* extension,
168 bool harmony_scoping); 176 int flags);
169 177
170 // Preparser that only does preprocessing that makes sense if only used 178 // Preparser that only does preprocessing that makes sense if only used
171 // immediately after. 179 // immediately after.
172 static ScriptDataImpl* PartialPreParse(UC16CharacterStream* source, 180 static ScriptDataImpl* PartialPreParse(UC16CharacterStream* source,
173 v8::Extension* extension, 181 v8::Extension* extension,
174 bool harmony_scoping); 182 int flags);
175 }; 183 };
176 184
177 // ---------------------------------------------------------------------------- 185 // ----------------------------------------------------------------------------
178 // REGEXP PARSING 186 // REGEXP PARSING
179 187
180 // A BuffferedZoneList is an automatically growing list, just like (and backed 188 // A BuffferedZoneList is an automatically growing list, just like (and backed
181 // by) a ZoneList, that is optimized for the case of adding and removing 189 // by) a ZoneList, that is optimized for the case of adding and removing
182 // a single element. The last element added is stored outside the backing list, 190 // a single element. The last element added is stored outside the backing list,
183 // and if no more than one element is ever added, the ZoneList isn't even 191 // and if no more than one element is ever added, the ZoneList isn't even
184 // allocated. 192 // allocated.
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 private: 772 private:
765 static const int kTypeSlot = 0; 773 static const int kTypeSlot = 0;
766 static const int kElementsSlot = 1; 774 static const int kElementsSlot = 1;
767 775
768 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 776 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
769 }; 777 };
770 778
771 } } // namespace v8::internal 779 } } // namespace v8::internal
772 780
773 #endif // V8_PARSER_H_ 781 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698