Mercurial Hosting > luan
comparison src/luan/modules/RpcLuan.java @ 1112:490f77bb2ad1
add JsonParser
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 02 Aug 2017 17:37:59 -0600 |
parents | 88b5b81cad4a |
children | 22652f4020fb |
comparison
equal
deleted
inserted
replaced
1111:88b5b81cad4a | 1112:490f77bb2ad1 |
---|---|
19 import luan.LuanTable; | 19 import luan.LuanTable; |
20 import luan.LuanFunction; | 20 import luan.LuanFunction; |
21 import luan.LuanException; | 21 import luan.LuanException; |
22 import luan.LuanMethod; | 22 import luan.LuanMethod; |
23 import luan.modules.parsers.Json; | 23 import luan.modules.parsers.Json; |
24 import luan.lib.json.JsonParser; | |
24 import luan.lib.parser.ParseException; | 25 import luan.lib.parser.ParseException; |
25 | 26 |
26 | 27 |
27 public final class RpcLuan { | 28 public final class RpcLuan { |
28 private static final int NIL = 0; | 29 private static final int NIL = 0; |
179 /* | 180 /* |
180 LuanFunction fn = Luan.load("return "+s,"rpc-reader"); | 181 LuanFunction fn = Luan.load("return "+s,"rpc-reader"); |
181 return fn.call(luan); | 182 return fn.call(luan); |
182 */ | 183 */ |
183 try { | 184 try { |
184 return Json.parse(s); | 185 return BasicLuan.to_luan(JsonParser.parse(s)); |
185 } catch(ParseException e) { | 186 } catch(ParseException e) { |
186 throw new LuanException(e); | 187 throw new LuanException(e); |
187 } | 188 } |
188 case IO: | 189 case IO: |
189 return new LuanInputStream(in,close).table(); | 190 return new LuanInputStream(in,close).table(); |