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.

svoid tok_stages(LS tok) {
  // anonymous stage (name = shortened source code)

  replaceKeywordBlock(tok, "stage", "{ stage(r {", "}); }");
  
  // named stage
  
  replaceKeywordPlusQuotedBlock_dyn(tok, "stage", (_tok, iKeyword)
    -> stringArray("{ stage(" + tok.get(iKeyword+2) + ", r {", "}); }"));
    
  // stage with name and variable
  for (iStage : rjfindAll(tok, "stage <id> <quoted>")) {
    S id = tok.get(iStage+2);
    S name = tok.get(iStage+4);
    int iOpening = iStage+6;
    assertEquals("{", tok.get(iOpening));
    int iClosing = tok_findEndOfBlock(tok, iOpening)-1;
    tokSet_reTok(tok, iClosing, "});");
    replaceTokens_reTok(tok, iStage, iOpening,
      "Stage \*id*/ = stage(" + name + ", r ");
  }
}

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: 149 / 293
Version history: 7 change(s)
Referenced in: [show references]