Mercurial Hosting > luan
diff core/src/luan/impl/ParseException.java @ 645:859c0dedc8b6
remove LuanSource
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 18:09:51 -0600 |
parents | 3dcb0f9bee82 |
children | b620b8e1010f |
line wrap: on
line diff
--- a/core/src/luan/impl/ParseException.java Tue Mar 29 13:53:01 2016 -0600 +++ b/core/src/luan/impl/ParseException.java Tue Mar 29 18:09:51 2016 -0600 @@ -1,16 +1,18 @@ package luan.impl; -import luan.LuanSource; - public final class ParseException extends Exception { - public final LuanSource src; +// public final LuanSource src; + public final String sourceName; + public final String text; public final int iCurrent; public final int iHigh; - ParseException(String msg,LuanSource src,int iCurrent,int iHigh) { + ParseException(String msg,String sourceName,String text,int iCurrent,int iHigh) { super(msg); - this.src = src; +// this.src = src; + this.sourceName = sourceName; + this.text = text; this.iCurrent = iCurrent; this.iHigh = iHigh; //System.out.println("iCurrent = "+iCurrent); @@ -25,7 +27,7 @@ int line = 0; int i = -1; while(true) { - int j = src.text.indexOf('\n',i+1); + int j = text.indexOf('\n',i+1); if( j == -1 || j >= index ) break; i = j; @@ -37,13 +39,13 @@ } private String[] lines() { - return src.text.split("\n",-1); + return text.split("\n",-1); } public String getFancyMessage() { Location loc = new Location(iCurrent); String line = lines()[loc.line]; - String msg = getMessage() + " (line " + (loc.line+1) + ", pos " + (loc.pos+1) + ") in " + src.name + "\n"; + String msg = getMessage() + " (line " + (loc.line+1) + ", pos " + (loc.pos+1) + ") in " + sourceName + "\n"; StringBuilder sb = new StringBuilder(msg); sb.append( line + "\n" ); for( int i=0; i<loc.pos; i++ ) {