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

22
LINES

< > BotCompany Repo | #1032844 // tok_stages

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

Transpiled version (10343L) is out of date.

1  
svoid tok_stages(LS tok) {
2  
  // anonymous stage (name = shortened source code)
3  
4  
  replaceKeywordBlock(tok, "stage", "{ stage(r {", "}); }");
5  
  
6  
  // named stage
7  
  
8  
  replaceKeywordPlusQuotedBlock_dyn(tok, "stage", (_tok, iKeyword)
9  
    -> stringArray("{ stage(" + tok.get(iKeyword+2) + ", r {", "}); }"));
10  
    
11  
  // stage with name and variable
12  
  for (iStage : rjfindAll(tok, "stage <id> <quoted>")) {
13  
    S id = tok.get(iStage+2);
14  
    S name = tok.get(iStage+4);
15  
    int iOpening = iStage+6;
16  
    assertEquals("{", tok.get(iOpening));
17  
    int iClosing = tok_findEndOfBlock(tok, iOpening)-1;
18  
    tokSet_reTok(tok, iClosing, "});");
19  
    replaceTokens_reTok(tok, iStage, iOpening,
20  
      "Stage \*id*/ = stage(" + name + ", r ");
21  
  }
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032844
Snippet name: tok_stages
Eternal ID of this version: #1032844/8
Text MD5: c448b7ae3bdb06425a2cf33baed6617b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-06 18:45:38
Source code size: 753 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 150 / 295
Version history: 7 change(s)
Referenced in: [show references]