Mercurial Hosting > luan
comparison core/src/luan/LuanElement.java @ 481:5d4a78c93383
luan errors are now tables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 11 May 2015 20:26:36 -0600 |
parents | b48cfa14ba60 |
children |
comparison
equal
deleted
inserted
replaced
480:44caaa6a3d92 | 481:5d4a78c93383 |
---|---|
25 | 25 |
26 public String text() { | 26 public String text() { |
27 return text!=null ? text : source.text.substring(start,end); | 27 return text!=null ? text : source.text.substring(start,end); |
28 } | 28 } |
29 | 29 |
30 private String location() { | 30 int lineNumber() { |
31 return source.name + " line " + lineNumber(); | |
32 } | |
33 | |
34 private int lineNumber() { | |
35 int line = 0; | 31 int line = 0; |
36 int i = -1; | 32 int i = -1; |
37 do { | 33 do { |
38 line++; | 34 line++; |
39 i = source.text.indexOf('\n',i+1); | 35 i = source.text.indexOf('\n',i+1); |
40 } while( i != -1 && i < start ); | 36 } while( i != -1 && i < start ); |
41 return line; | 37 return line; |
42 } | 38 } |
43 | 39 |
44 String toString(String fnName) { | |
45 String s = location(); | |
46 if( fnName != null ) | |
47 s += " in call to '" + fnName + "'"; | |
48 return s; | |
49 } | |
50 | |
51 } | 40 } |