Mercurial Hosting > luan
comparison src/luan/lib/PickleClient.java @ 160:138b9baee80b
include IoLib.LuanFile fns in OsLib.LuanFile;
improve PickleClient error output;
git-svn-id: https://luan-java.googlecode.com/svn/trunk@161 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 19 Jun 2014 07:02:16 +0000 |
parents | 0517a4a7fcc5 |
children |
comparison
equal
deleted
inserted
replaced
159:0abc9181061a | 160:138b9baee80b |
---|---|
55 String src = (String)result[2]; | 55 String src = (String)result[2]; |
56 throw con.luan.exception( | 56 throw con.luan.exception( |
57 msg + "\n" | 57 msg + "\n" |
58 + "in:\n" | 58 + "in:\n" |
59 + "------------------\n" | 59 + "------------------\n" |
60 + src + "\n" | 60 + formatCode(src) + "\n" |
61 + "------------------\n" | 61 + "------------------\n" |
62 ); | 62 ); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
79 throw new RuntimeException(e); | 79 throw new RuntimeException(e); |
80 } | 80 } |
81 return tbl; | 81 return tbl; |
82 } | 82 } |
83 | 83 |
84 | |
85 public static String formatCode(String s) { | |
86 StringBuilder buf = new StringBuilder(); | |
87 int line = 1; | |
88 int i = 0; | |
89 int i2 = 0; | |
90 while( i2 != -1 ) { | |
91 buf.append( line++ ); | |
92 buf.append( '\t' ); | |
93 i2 = s.indexOf('\n',i); | |
94 String lineStr = i2 == -1 ? s.substring(i) : s.substring(i,i2+1); | |
95 int j; | |
96 for( j=0; j<lineStr.length() && lineStr.charAt(j)=='\t'; j++ ) { | |
97 buf.append( " " ); | |
98 } | |
99 buf.append( lineStr.substring(j) ); | |
100 i = i2 + 1; | |
101 } | |
102 return buf.toString(); | |
103 } | |
104 | |
105 | |
84 } | 106 } |