Skip to content

Commit

Permalink
add use_parser_resume so we can switch off parser completion for topl…
Browse files Browse the repository at this point in the history
…evel/usage/position modes (closes HaxeFoundation#2991)
  • Loading branch information
Simn committed May 15, 2014
1 parent 89fe67c commit d779f11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1140,15 +1140,19 @@ try
let file, pos = try ExtString.String.split file_pos "@" with _ -> failwith ("Invalid format : " ^ file_pos) in
let file = unquote file in
let pos, smode = try ExtString.String.split pos "@" with _ -> pos,"" in
let activate_special_display_mode () =
Common.define com Define.NoCOpt;
Parser.use_parser_resume := false
in
let mode = match smode with
| "position" ->
Common.define com Define.NoCOpt;
activate_special_display_mode();
DMPosition
| "usage" ->
Common.define com Define.NoCOpt;
activate_special_display_mode();
DMUsage
| "toplevel" ->
Common.define com Define.NoCOpt;
activate_special_display_mode();
DMToplevel
| _ ->
DMDefault
Expand Down
3 changes: 2 additions & 1 deletion parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ let unquote_ident f =
let cache = ref (DynArray.create())
let last_doc = ref None
let use_doc = ref false
let use_parser_resume = ref true
let resume_display = ref null_pos
let in_macro = ref false

Expand All @@ -85,7 +86,7 @@ let display e = raise (Display e)

let is_resuming p =
let p2 = !resume_display in
p.pmax = p2.pmin && Common.unique_full_path p.pfile = p2.pfile
p.pmax = p2.pmin && !use_parser_resume && Common.unique_full_path p.pfile = p2.pfile

let set_resume p =
resume_display := { p with pfile = Common.unique_full_path p.pfile }
Expand Down

0 comments on commit d779f11

Please sign in to comment.