Skip to content

Commit

Permalink
Improve context on syntax errors.
Browse files Browse the repository at this point in the history
git-svn-id: https://piraha-peg.googlecode.com/svn/trunk@98 1a70d7c6-ffe7-ef14-4583-3269c1a2e543
  • Loading branch information
[email protected] committed Dec 5, 2014
1 parent 0f34857 commit faed3b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/edu/lsu/cct/piraha/Near.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ public class Near {
public int lineNum=1, pos, startOfLine, endOfLine;
public Near() {}
public String toString() {
String line = text.substring(startOfLine,endOfLine);
String str = line.substring(0,pos)+"|"+line.substring(pos);
int lstart = startOfLine - 50;
if(lstart < 0) lstart = 0;
int npos = pos + startOfLine - lstart;
String line = text.substring(lstart,endOfLine);
String str = line.substring(0,npos)+"|"+line.substring(npos);
String base = "";
if(expected != null) {
if(expected.possibilities.size()==1) {
Expand Down

0 comments on commit faed3b1

Please sign in to comment.