Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1007715 // lispParse - reverse of Lisp.toString()

JavaX fragment (include)

static Lisp lispParse(S s) {
  ret new lispParse_X(s).parse();
}

sclass lispParse_X {
  L<S> tok;
  int i;
  
  *(S s) {
    tok = javaTokC(s);
  }
  
  Lisp parse() {
    if (i >= l(tok)) null;
    S t = tok.get(i++);
    Lisp l = lisp(unquote(t));
    if (neq(get(tok, i), "(")) ret l;
    ++i;
    while (i < l(tok) && neq(get(tok, i), ")")) {
      l.add(parse());
      if (eq(get(tok, i), ",")) ++i;
    }
    if (eq(get(tok, i), ")")) ++i;
    ret l;
  }
}

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: 525 / 508
Version history: 7 change(s)
Referenced in: [show references]