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

17
LINES

< > BotCompany Repo | #1021215 // ai_withTokenRefNumbers

JavaX fragment (include)

sS ai_withTokenRefNumbers(L<TokenAndRange> tokens, Map<TokenAndRange> map) {
  Set<TokenAndRange> refd = valuesSet(map);
  int n = 0;
  new StringBuilder buf;
  new Map<TokenAndRange, Int> indices;
  for (TokenAndRange t : tokens) {
    buf.append(t.token);
    if (refd.contains(t)) {
      indices.put(t, ++n);
      buf.append(" [*" + n + "]");
    }
    TokenAndRange target = mapGet(map, t);
    if (target != null)
      buf.append(" [" + indices.get(target) + "]");
  }
  ret str(buf);
}

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: #1021215
Snippet name: ai_withTokenRefNumbers
Eternal ID of this version: #1021215/4
Text MD5: 08a9a7d472125552caab79b1e9274d8b
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-03 15:58:33
Source code size: 510 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 299 / 350
Version history: 3 change(s)
Referenced in: [show references]