disallow keywords as identifiers
[hiphop-php.git] / hphp / hack / src / parser / full_fidelity_lexer.mli
blob50c5b0e60bfba5d0cb497cabedeb9794af51696d
1 (**
2 * Copyright (c) 2016, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 module Env : sig
11 val set : force_hh:bool -> enable_xhp:bool -> codegen:bool -> unit
12 end
14 module WithToken : functor (Token : Lexable_token_sig.LexableToken_S) -> sig
15 type t [@@deriving show]
16 type string_literal_kind =
17 | Literal_execution_string
18 | Literal_double_quoted
19 | Literal_heredoc of string [@@deriving show]
20 val make :
21 ?is_experimental_mode:bool ->
22 ?force_hh:bool ->
23 ?enable_xhp:bool ->
24 ?codegen:bool ->
25 Full_fidelity_source_text.t -> t
26 val make_at : ?is_experimental_mode:bool -> Full_fidelity_source_text.t -> int -> t
27 val source : t -> Full_fidelity_source_text.t
28 val errors : t -> Full_fidelity_syntax_error.t list
29 val start_offset : t -> int
30 val end_offset : t -> int
31 val is_experimental_mode : t -> bool
32 val next_token : t -> t * Token.t
33 val next_token_no_trailing : t -> t * Token.t
34 val next_token_in_string : t -> string_literal_kind -> t * Token.t
35 val scan_markup: t ->
36 is_leading_section:bool ->
37 (* lexer *)
38 t *
39 (* markup text *)
40 Token.t *
41 (* optional suffix that consist of mandatory '<?' and optional 'name'
42 which can be either
43 - language 'hh', 'php'
44 - '=' is case of short '<?=' tag *)
45 (Token.t * Token.t option) option
46 val next_token_as_name : t -> t * Token.t
47 val next_token_non_reserved_as_name : t -> t * Token.t
48 val next_token_in_type : t -> t * Token.t
49 val next_docstring_header : t -> t * Token.t * String.t
50 val next_xhp_element_token : no_trailing:bool -> t
51 -> t * Token.t * String.t
52 val next_xhp_body_token : t -> t * Token.t
53 val next_xhp_class_name : t -> t * Token.t
54 val is_next_xhp_class_name : t -> bool
55 val is_next_name : t -> bool
56 val next_xhp_name : t -> t * Token.t
57 val is_next_xhp_category_name : t -> bool
58 val next_xhp_category_name : t -> t * Token.t
59 val rescan_halt_compiler : t -> Token.t -> t * Token.t
60 val scan_leading_php_trivia : t -> t * Token.Trivia.t list
61 val scan_trailing_php_trivia : t -> t * Token.Trivia.t list
62 val scan_leading_xhp_trivia : t -> t * Token.Trivia.t list
63 val scan_trailing_xhp_trivia : t -> t * Token.Trivia.t list
64 end