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

19
LINES

< > BotCompany Repo | #1021308 // ai_parseTokenRefNumbers

JavaX fragment (include)

static Pair<LS, Map<Int>> ai_parseTokenRefNumbers(LS tok) {
  tok = tok_combineSquareBrackets_keep(tok);
  new LS out;
  new Map<S, Int> refToToken;
  new Map<Int> map;
  for i over tok: {
    S t = get(tok, i+1);
    if (even(i) && isSquareBracketed(t)) {
      t = deSquareBracket(t);
      if (startsWith(t, "*"))
        refToToken.put(dropFirst(t), l(out)-1);
      else
        mapPut(map, l(out)-1, refToToken.get(t));
      ++i;
    } else
      out.add(tok.get(i));
  }
  ret pair(out, map);
}

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: #1021308
Snippet name: ai_parseTokenRefNumbers
Eternal ID of this version: #1021308/7
Text MD5: 2f44da297e8451e07ff07549ebac984b
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-08 14:10:26
Source code size: 520 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 278 / 297
Version history: 6 change(s)
Referenced in: [show references]