Ticket #259: parser.patch

File parser.patch, 2.0 KB (added by David Aspinall, 15 years ago)
  • src/ed/inf/proofgeneral/editor/lazyparser/Parser.java

    ### Eclipse Workspace Patch 1.0
    #P ed.inf.proofgeneral
    RCS file: /disk/cvs/proofgen/eclipse/ed.inf.proofgeneral/src/ed/inf/proofgeneral/editor/lazyparser/Parser.java,v
    retrieving revision 1.123
    diff -u -r1.123 Parser.java
     
    130130                String parseText = "";
    131131                int results = 0;
    132132                int linestoAdd = 0;
    133                 int endOffset;
     133                int nextOffset;
    134134                try {
    135135                        int endLine = doc.getLineOfOffset(startOffset+length-1);
    136136                        do {
    137                                 endOffset = doc.getLineLength(endLine) + doc.getLineOffset(endLine) - 1;
    138                                 parseText = doc.getDesymbolised(startOffset, endOffset-startOffset);
     137                                nextOffset = doc.getLineLength(endLine) + doc.getLineOffset(endLine);
     138                                parseText = doc.getDesymbolised(startOffset, nextOffset-startOffset);
    139139                                parseResult = parseText(parseText, doc, startOffset,monitor);
    140140                                results = parseResultContentSize(parseResult);
    141141
     
    150150                                                endLine = doc.getNumberOfLines() - 1;
    151151                                        }
    152152                                }
    153                         } while (results <= 1 && endOffset + 1 < doc.getLength());
     153                        } while (results <= 1 && nextOffset < doc.getLength());
    154154                } catch (BadLocationException badloc) {
    155155                        // Shouldn't happen unless client called us incorrectly
    156156                        throw new ParsingException("Bad location during parsing");
     
    161161                try {
    162162                        // TODO: perhaps this should be in a workspace runnable, to ensure
    163163                        // thread safe access to document
    164                         ProofScriptMarkers.cleanMarkers(doc,startOffset,endOffset-startOffset); // NB: removes all types of marker
     164                        ProofScriptMarkers.cleanMarkers(doc,startOffset,nextOffset-startOffset); // NB: removes all types of marker
    165165                        linkParseresult(parseResult,doc,startOffset);
    166166                        doc.recalculateFoldingStructure();
    167167                } catch (UnparseableException x) {