Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show position information on the ast on demand
Summary:
Show position information on the AST

Enabled:
```
(AProgram
 ((Stmt (<1:1,1:5> (Markup (<1:1,1:5> "") ())))
  (Constant
   ((cst_mode: Mdecl) (cst_kind: Define) (cst_name: (<4:3,4:5> "\\A"))
    (cst_type: ()) (cst_value: (<5:3,5:5> (Int (<5:3,5:5> 555))))
    (cst_namespace:
     ((ns_name: "") (ns_ns_uses: (SMap ())) (ns_class_uses: (SMap ()))
      (ns_fun_uses: (SMap ())) (ns_const_uses: (SMap ()))))))))%
```
Disabled
```
~/fbcode ❯❯❯ hh_single_parse --parser ffp ~/test.php
(AProgram
 ((Stmt (p (Markup (p "") ())))
  (Constant
   ((cst_mode: Mdecl) (cst_kind: Define) (cst_name: (p "\\A")) (cst_type: ())
    (cst_value: (p (Int (p 555))))
    (cst_namespace:
     ((ns_name: "") (ns_ns_uses: (SMap ())) (ns_class_uses: (SMap ()))
```

Reviewed By: vladima

Differential Revision: D6777589

fbshipit-source-id: c856c338e4dad1eb19fe3a3c60c328668c6d2f2d
  • Loading branch information
oulgen authored and hhvm-bot committed Jan 22, 2018
1 parent 731d211 commit ff23826
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hphp/hack/src/hh_single_parse.ml
Expand Up @@ -339,12 +339,15 @@ let () =
"Which diff tool to compare different S-Expressions with [def: vimdiff]"
)
; ("--hash", Set hash,
"Get the decl level parsing hash of a given file "
"Get the decl level parsing hash of a given file "
)
; ("--sorted", Unit (fun () -> dumper := Debug.dump_sorted_ast),
"When using the `compare` parser, the (lexicographically) sort the " ^
"S-Expressions before diffing"
)
; ("--show-pos", Unit (fun () -> Sof.show_pos := true),
"Show positional information on the AST"
)
]) (fun fn -> filename := fn) usage;
let parse_function = match !use_parser with
| "ast" -> AST
Expand Down

0 comments on commit ff23826

Please sign in to comment.