Change the Coq printer so that it knows a bit about Coq syntax.
Assumptions about the input file: - The first lines up to the first empty line are supposed to have been generated automatically by Why3 and are discarded. - Any Axiom, Parameter, or block of lines started by (* Why3 assumption *) is supposed to have been generated automatically by a previous run of Why3 and acts as a location marker. There is a name associated with the marker: the first meaningful identifier encountered by the parser, e.g. the world after Inductive. - Any block of lines started by (* Why3 goal *) is supposed to have been automatically generated by Why3 up to a line ending by a point. The following lines are considered as user-edited content up to the first occurrence of Qed, Admitted, Defined, or Save. The location name is again extracted from the first meaningful identifier. The user content will be copied whenever Why3 prints a declaration with the same name. - Any other line is supposed to be user content. It will be copied whenever Why3 prints some declaration with a name matching a further location. Note that the parser is rather crude for now. It will presumably breaks bad in presence of commands that are commented out or if the user got creative with indentation. This should be considered as a proof of concept. Moreover, it does not handle yet features like gallina definitions and notations, which will be more user-friendly for realizing whole theories.
Showing with 176 additions and 207 deletions