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

21
LINES

< > BotCompany Repo | #1023530 // WordTokReplacer

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4175L/26K).

sclass WordTokReplacer extends WordTokRule {
  LLS tokReplaced; // multiple tokenized outputs
  
  *(S sentence, S _vars, S replaced) {
    this(sentence, javaTokWithBracketsC(_vars), replaced);
  }
    
  *(S sentence, Collection<S> vars, S replaced) {
    this(sentence, vars, ll(replaced));
  }
  
  *(S sentence, Collection<S> vars, LS replaced_multi) {
    super(sentence, asCISet(vars));
    tokReplaced = map wordTok_noBrackets(replaced_multi);
  }
  
  run {
    for (LS tok : tokReplaced)
      emit(join(replaceCodeTokensUsingMap_curly(tok, 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: #1023530
Snippet name: WordTokReplacer
Eternal ID of this version: #1023530/5
Text MD5: f1d1f0accce59be2a345f5d715cf880d
Transpilation MD5: 22e2cdad3ea7e799e568a9ec3956d288
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-08 19:00:06
Source code size: 584 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 317 / 778
Version history: 4 change(s)
Referenced in: #1023532 - WordTokReplacer_es1
#1023770 - WordTokReplacerWithSecondIn
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)