Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#259 closed defect (fixed)

Parsing Failure at ends of files

Reported by: Graham Dutton Owned by: Graham Dutton
Priority: major Milestone:
Component: 1:pg-eclipse Keywords:
Cc:

Description (last modified by Graham Dutton)

Parsing a file with no trailing whitespace fails.

For example: TestLcl.thy in test repository fails at the final lines. PG parses the final two lines:

 end
end

as a single unit:

 end[newline]en

(where [newline] is an actual newline), discarding the final character.

A functionally identical file TestLocale.thy with trailing whitespace will not exhibit this behaviour.

Attachments (2)

parser-parsetext-outbyone.patch (971 bytes) - added by Graham Dutton 15 years ago.
a partial solution: the line in question
parser.patch (2.0 KB) - added by David Aspinall 15 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 15 years ago by Graham Dutton

This of course results in broken prover interaction:

PGIP:

<pgip tag="PG-Eclipse" class="pa" id="/grape//6129632130384117" seq="107"><closetheory>end
en</closetheory></pgip>

Response:

Outer syntax error: command expected,
but identifier en was found

comment:2 Changed 15 years ago by Graham Dutton

Description: modified (diff)
Owner: changed from David Aspinall to Graham Dutton
Status: newassigned

Actually appears to be an out-by-one error: can recreate on any thy file by trimming all trailing whitespace.

Changed 15 years ago by Graham Dutton

a partial solution: the line in question

comment:3 Changed 15 years ago by Graham Dutton

this fixes the bug but creates another.

comment:4 Changed 15 years ago by Graham Dutton

Description: modified (diff)
Summary: Parsing Failure on TestLcl.thyParsing Failure at ends of files

comment:5 Changed 15 years ago by Graham Dutton

Description: modified (diff)

After much investigation, I'm now convinced that attached fix is the right thing, but it results in Processed region being set to '0' when the last line of the document is parsed. Investigating.

comment:6 Changed 15 years ago by David Aspinall

Milestone: PG-Eclipse-1.0.6

Sounds like a separate problem since files without final CR were not being parsed before.

My diff corrects the termination check at the end of the loop (notice that real error was in calculation of length=endOffset-startOffset, which should be endOffset-startOffset+1).

Changed 15 years ago by David Aspinall

Attachment: parser.patch added

comment:7 Changed 15 years ago by Graham Dutton

Description: modified (diff)

Yes, that is much more complete fix, and means that the fix I was working on for the subsequent issue now actually works... Commit on its way.

comment:8 Changed 15 years ago by Graham Dutton

Resolution: fixed
Status: assignedclosed

appears to be fixed.

comment:9 Changed 11 years ago by David Aspinall

Milestone: PG-Eclipse-1.0.6

Milestone PG-Eclipse-1.0.6 deleted

Note: See TracTickets for help on using tickets.