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

18
LINES

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

JavaX fragment (include)

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

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