@@ -415,6 +415,7 @@ let main () =
415415 (* ---*) gccompact : int option ;
416416 (* ---*) docgen : bool ;
417417 (* ---*) outdirp : string option ;
418+ (* ---*) upto : (int * int option ) option ;
418419 mutable trace : trace1 list option ;
419420 }
420421
@@ -493,6 +494,7 @@ let main () =
493494 ; gccompact = None
494495 ; docgen = false
495496 ; outdirp = None
497+ ; upto = None
496498 ; trace = None }
497499
498500 end
@@ -511,8 +513,9 @@ let main () =
511513
512514 let gcstats = cmpopts.cmpo_gcstats in
513515 let progress = if cmpopts.cmpo_script then `Script else `Human in
516+ let lastgoals = cmpopts.cmpo_lastgoals in
514517 let terminal =
515- lazy (T. from_channel ~name ~gcstats ~progress (open_in name))
518+ lazy (T. from_channel ~name ~gcstats ~progress ~lastgoals (open_in name))
516519 in
517520
518521 let trace0 =
@@ -528,6 +531,7 @@ let main () =
528531 ; gccompact = cmpopts.cmpo_compact
529532 ; docgen = false
530533 ; outdirp = None
534+ ; upto = cmpopts.cmpo_upto
531535 ; trace = trace0 }
532536
533537 end
@@ -572,6 +576,7 @@ let main () =
572576 ; gccompact = None
573577 ; docgen = true
574578 ; outdirp = docopts.doco_outdirp
579+ ; upto = None
575580 ; trace = None }
576581 end
577582
@@ -669,6 +674,16 @@ let main () =
669674 if T. interactive terminal then
670675 T. notice ~immediate: true `Warning copyright terminal;
671676
677+ (* Check if a location is past the -upto point *)
678+ let past_upto (loc : EcLocation.t ) =
679+ match state.upto with
680+ | None -> false
681+ | Some (line , col ) ->
682+ let (sl, sc) = loc.loc_start in
683+ sl > line || (sl = line && match col with
684+ | None -> false
685+ | Some c -> sc > = c) in
686+
672687 try
673688 if T. interactive terminal then Sys. catch_break true ;
674689
@@ -737,6 +752,14 @@ let main () =
737752 List. iter
738753 (fun p ->
739754 let loc = p.EP. gl_action.EcLocation. pl_loc in
755+
756+ (* -upto: if this command starts past the target, print goals and exit *)
757+ if past_upto loc then begin
758+ T. finalize terminal;
759+ EcCommands. pp_current_goal ~all: true Format. std_formatter;
760+ exit 0
761+ end ;
762+
740763 let timed = p.EP. gl_debug = Some `Timed in
741764 let break = p.EP. gl_debug = Some `Break in
742765 let ignore_fail = ref false in
0 commit comments