1 // Copyright 2016 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_PARSING_PARSING_H_ 6 #define V8_PARSING_PARSING_H_ 7 8 #include "src/globals.h" 9 10 namespace v8 { 11 namespace internal { 12 13 class ParseInfo; 14 class SharedFunctionInfo; 15 16 namespace parsing { 17 18 // Parses the top-level source code represented by the parse info and sets its 19 // function literal. Returns false (and deallocates any allocated AST 20 // nodes) if parsing failed. 21 V8_EXPORT_PRIVATE bool ParseProgram(ParseInfo* info, Isolate* isolate); 22 23 // Like ParseProgram but for an individual function which already has a 24 // allocated shared function info. 25 V8_EXPORT_PRIVATE bool ParseFunction(ParseInfo* info, 26 Handle<SharedFunctionInfo> shared_info, 27 Isolate* isolate); 28 29 // If you don't know whether info->is_toplevel() is true or not, use this method 30 // to dispatch to either of the above functions. Prefer to use the above methods 31 // whenever possible. 32 V8_EXPORT_PRIVATE bool ParseAny(ParseInfo* info, 33 Handle<SharedFunctionInfo> shared_info, 34 Isolate* isolate); 35 36 } // namespace parsing 37 } // namespace internal 38 } // namespace v8 39 40 #endif // V8_PARSING_PARSING_H_ 41