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

16
LINES

< > BotCompany Repo | #1026167 // tok_applyCurlyTransformers

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

Libraryless. Click here for Pure Java version (2760L/18K).

1  
sS tok_applyCurlyTransformers(IF1<S, IF1<S>> getTransformer, S s) {
2  
  ret join(tok_applyCurlyTransformers(getTransformer, javaTok(s)));
3  
}
4  
5  
static LS tok_applyCurlyTransformers(IF1<S, IF1<S>> getTransformer, LS tok) {
6  
  for (int iSlash : jfindAll(tok, "/<id>}")) {
7  
    int iClosing = iSlash+4;
8  
    IF1<S> transformer = getTransformer.get(tok.get(iSlash+2));
9  
    if (transformer == null) continue;
10  
    int iOpening = findBeginningOfBracketPart(tok, iClosing);
11  
    if (iOpening < 0) continue;
12  
    S transformed = transformer.get(joinSubList(tok, iOpening+1, iSlash-1));
13  
    replaceTokens(tok, iOpening, iClosing+1, transformed);
14  
  }
15  
  ret tok;
16  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1026167
Snippet name: tok_applyCurlyTransformers
Eternal ID of this version: #1026167/2
Text MD5: 287cbfec0b384295381da574bbb98daa
Transpilation MD5: f86770f9b6a9157751aab3d2331da91c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-27 17:26:01
Source code size: 657 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 191 / 292
Version history: 1 change(s)
Referenced in: [show references]