Opened 15 years ago

Closed 12 years ago

#296 closed defect (fixed)

PG accepts garbage though Coq said "illegal begin of vernac"

Reported by: Matt McCutchen Owned by: courtieu
Priority: major Milestone: PG-Emacs-4.2
Component: 2:pg-emacs Keywords:
Cc: greenrd@…

Description (last modified by David Aspinall)

If I type the following complete garbage and press "C-c C-RET" at the end of the line, Proof General accepts it, even though I see in the *coq* buffer that Coq has said "illegal begin of vernac":

Check nat.&!&*\:,.:<*&^!)@)$.

I'm guessing that Proof General doesn't recognize the first period as a command separator and there's a miscommunication between Coq and Proof General regarding how much of the text was processed.

I'm using GNU Emacs 23.1.1 and Proof General 3.7.1, though I checked that the problem still exists in the latest Proof General from CVS.

Change History (12)

comment:1 Changed 15 years ago by David Aspinall

Status: newaccepted

Many thanks for the report. Script management for Coq is still somewhat broken in current CVS, I'll try to have a look at this problem too when fixing it.

comment:2 Changed 15 years ago by David Aspinall

Milestone: PG-Emacs-4.0

comment:3 Changed 14 years ago by David Aspinall

Description: modified (diff)

comment:4 Changed 14 years ago by David Aspinall

Resolution: fixed
Status: acceptedclosed

Fixed: proof-script-command-end-regexp now allows any non-alphabetic character after a period to terminate a command. Hopefully correct.

comment:5 in reply to:  4 Changed 14 years ago by Erik Martin-Dorel

Priority: minormajor
Resolution: fixed
Status: closedreopened

Hello,

I reopen this ticket since I have just noticed that this Regexp change prevents from processing SSReflect libraries, because it breaks the parsing of all Coq notations that contain a period followed by a non-alphabetic character (for example, p .[ x ] do not work any more).

In fact I would virtually say that this report has more to do with a feature than a bug, all the more so as it is also reproducible within CoqIDE.

Thus we should definitely accept that ProofGeneral accepts such inputs.

Kind regards, Erik Martin-Dorel.

comment:6 Changed 14 years ago by David Aspinall

Resolution: invalid
Status: reopenedclosed

Aha. I had worried about this, many thanks for pointing out. Have reverted the change in coq.el 10.51 now.

Considering this as invalid --- or at least, it's a detail we won't get perfectly right unless we change the interaction protocol or provide PG with a way to track the precise command end syntax.

comment:7 Changed 13 years ago by Robin Green

Cc: greenrd@… added
Resolution: invalid
Status: closedreopened

In Coq trunk, I believe periods are not treated as end-of-command unless they are immediately followed by whitespace or end-of-line. (And therefore, multiple consecutive periods cannot be end-of-command - they must be something else, like a notation.) So that should be a simple way for Proof General to disambiguate periods as end-of-command from other uses of periods.

comment:8 Changed 13 years ago by David Aspinall

Milestone: PG-Emacs-4.0PG-Emacs-4.2

Thanks for the note. Moved against 4.2.

comment:9 Changed 12 years ago by coquser

I haven't tested the behavior of CVS proof general, but ... can also end tactic commands.

comment:10 Changed 12 years ago by Erik Martin-Dorel

I have just test the behavior of CVS ProofGeneral and the "..." syntax seems to work smoothly.

However, as pointed out in #435, there is currently an issue with the parsing of some SSReflect notations such as "n.+1" (and "n.-1").

To reproduce the bug, you can for instance process the following Coq code:

Notation succn := Datatypes.S (only parsing).
Notation "n .+1" := (succn n) (at level 2, left associativity,
  format "n .+1") : nat_scope.
Check 5.+1.
Check 7.+1.

which leads to the following output in the *coq* buffer.

Welcome to Coq 8.3pl3 (December 2011)

(... snip ...)

<prompt>Coq < 10 || 0 < </prompt>Notation succn := Datatypes.S (only parsing).

<prompt>Coq < 11 || 0 < </prompt>Notation "n .+1" := (succn n) (at level 2, left associativity,   format "n .+1") : nat_scope.

<prompt>Coq < 12 || 0 < </prompt>Check 5.+
5
     : nat

<prompt>Coq < 13 || 0 < </prompt>1.
Syntax error: illegal begin of vernac.

<prompt>Coq < 13 || 0 < </prompt>

Kind regards,

Erik Martin-Dorel

comment:11 Changed 12 years ago by David Aspinall

Owner: changed from David Aspinall to courtieu
Status: reopenedassigned

comment:12 Changed 12 years ago by courtieu

Resolution: fixed
Status: assignedclosed

This has been solved a long time ago. I tested the Notations above and it works. I close the bug.

Note: See TracTickets for help on using tickets.