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

18
LINES

< > BotCompany Repo | #1022795 // parseExamplesAndAntiExamples ("=>" and "!=>")

JavaX fragment (include)

// t3(in, out, positive example)
static LT3<S, S, Bool> parseExamplesAndAntiExamples(S text) {
  new LT3<S, S, Bool> out;
  for (S s : tlft(text)) {
    LS tok = javaTok(s);
    int i = indexOfSubList(tok, splitAtDoubleArrow_tok());
    if (i < 0) continue;
    bool pos = true;
    S rhs = joinSubList(tok, i+4), lhs;
    if (eqGet(tok, i-1, "") && eqGet(tok, i-2, "!")) {
      pos = false;
      lhs = joinSubList(tok, 0, i-3);
    } else
      lhs = joinSubList(tok, 0, i-1);
    out.add(t3(lhs, rhs, pos));
  }
  ret out;
}

Author comment

Began life as a copy of #1014190

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022795
Snippet name: parseExamplesAndAntiExamples ("=>" and "!=>")
Eternal ID of this version: #1022795/3
Text MD5: 48f170577b44a6bc43e2711ed89dc673
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-07 17:40:01
Source code size: 545 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 193 / 237
Version history: 2 change(s)
Referenced in: [show references]