Browse Source

add use_parser_resume so we can switch off parser completion for toplevel/usage/position modes (closes #2991)

Simon Krajewski 11 years ago
parent
commit
d779f11ff0
2 changed files with 9 additions and 4 deletions
  1. 7 3
      main.ml
  2. 2 1
      parser.ml

+ 7 - 3
main.ml

@@ -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

+ 2 - 1
parser.ml

@@ -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
 
@@ -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 }