package pfff

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file flag_parsing_php.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(*s: flag_parsing_php.ml *)
(*x: flag_parsing_php.ml *)
(*x: flag_parsing_php.ml *)
(*x: flag_parsing_php.ml *)
(*x: flag_parsing_php.ml *)

let strict_lexer = ref false

(* todo: not that useful, probably can remove *)
let show_parsing_error_full = ref true

(*x: flag_parsing_php.ml *)
let short_open_tag = ref true
(*x: flag_parsing_php.ml *)

(* PHP is case insensitive, which is I think a bad idea, so
 * by default let's have a case sensitive lexer.
 *)
let case_sensitive = ref true

(* e.g. yield *)
let facebook_lang_extensions = ref true

(* in facebook context, we want xhp support by default *)
let xhp_builtin = ref true

let verbose_pp = ref false
(* Alternative way to get xhp by calling xhpize as a preprocessor.
 * Slower than builtin_xhp and have some issues where the comments
 * are removed, unless you use the experimental_merge_tokens_xhp
 * but which has some issues itself. 
 *)
let pp_default = ref (None: string option)
let xhp_command = "xhpize" 
let obsolete_merge_tokens_xhp = ref false

(*s: flag_parsing_php.ml pp related flags *)

let caching_parsing = ref false

open Common

(* coupling: copy paste of Php_vs_php *)
let is_metavar_name s = 
  s =~ "[A-Z]\\([0-9]?_[A-Z]*\\)?"

let cmdline_flags_pp () = [
  "-pp", Arg.String (fun s -> pp_default := Some s),
  " <cmd> optional preprocessor (e.g. xhpize)";
  "-verbose_pp", Arg.Set verbose_pp, 
  " ";
  (*s: other cmdline_flags_pp *)
  "-xhp", Arg.Set xhp_builtin,
  " parsing XHP constructs (default)";
  "-xhp_with_xhpize", Arg.Unit (fun () -> 
    xhp_builtin := false;
    pp_default := Some xhp_command),
  "  parsing XHP using xhpize as a preprocessor";
  "-no_xhp", Arg.Clear xhp_builtin,
  " ";
  "-no_fb_ext", Arg.Clear facebook_lang_extensions,
  " ";
  (*e: other cmdline_flags_pp *)
]
(*e: flag_parsing_php.ml pp related flags *)
(*e: flag_parsing_php.ml *)
OCaml

Innovation. Community. Security.