1 | static Lisp lispParse(S s) {
|
2 | ret new lispParse_X(s).parse(); |
3 | } |
4 | |
5 | sclass lispParse_X {
|
6 | L<S> tok; |
7 | int i; |
8 | |
9 | *(S s) {
|
10 | tok = javaTokC(s); |
11 | } |
12 | |
13 | Lisp parse() {
|
14 | if (i >= l(tok)) null; |
15 | S t = tok.get(i++); |
16 | Lisp l = lisp(unquote(t)); |
17 | if (neq(get(tok, i), "(")) ret l;
|
18 | ++i; |
19 | while (i < l(tok) && neq(get(tok, i), ")")) {
|
20 | l.add(parse()); |
21 | if (eq(get(tok, i), ",")) ++i; |
22 | } |
23 | if (eq(get(tok, i), ")")) ++i; |
24 | ret l; |
25 | } |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007715 |
| Snippet name: | lispParse - reverse of Lisp.toString() |
| Eternal ID of this version: | #1007715/8 |
| Text MD5: | d95a48447eecf113ea024a2745ecba4d |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-04-02 21:01:11 |
| Source code size: | 489 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 735 / 728 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |