Cleaning up and abstracting the (FFP to AST) lowerer
[hiphop-php.git] / hphp / hack / src / parser / full_fidelity_ast.mli
blob3697aeddf545888b30d32c2ada38e58562e93073
1 (**
2 * Copyright (c) 2018, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
9 *)
11 (**
12 * Explicitly exporting the definition of `Syntax` used in the lowerer. This
13 * should
15 module Syntax = Full_fidelity_editable_positioned_syntax
17 (**
18 * The `env` of the lowerer is "full request." It provides all the settings the
19 * lowerer needs to produce an AST.
21 type env
23 val make_env
24 (* Optional parts *)
25 : ?hhvm_compat_mode:bool
26 -> ?codegen:bool
27 -> ?php5_compat_mode:bool
28 -> ?elaborate_namespaces:bool
29 -> ?include_line_comments:bool
30 -> ?keep_errors:bool
31 -> ?ignore_pos:bool
32 -> ?quick_mode:bool
33 -> ?lower_coroutines:bool
34 -> ?enable_hh_syntax:bool
35 -> ?parser_options:GlobalOptions.t
36 -> ?fi_mode:FileInfo.mode
37 -> ?is_hh_file:bool
38 -> ?stats:Stats_container.t
39 (* Required parts *)
40 -> Relative_path.t
41 -> env
43 (**
44 * A `result` contains some information from the original `env`; the information
45 * that is typically required later. This is still quite ad-hoc and should be
46 * redesigned properly at some point.
48 type result =
49 { fi_mode : FileInfo.mode
50 ; is_hh_file : bool
51 ; ast : Ast.program
52 ; content : string
53 ; file : Relative_path.t
54 ; comments : (Pos.t * Prim_defs.comment) list
56 val lower
57 : env
58 -> source_text:Syntax.SourceText.t
59 -> script:Syntax.t
60 -> result
61 val from_text : env -> Syntax.SourceText.t -> result
62 val from_file : env -> result
64 (**
65 * Here only for backward compatibility. Consider these deprecated.
67 val from_text_with_legacy : env -> string -> Parser_hack.parser_return
68 val from_file_with_legacy : env -> Parser_hack.parser_return