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

12
LINES

< > BotCompany Repo | #1025380 // tok_processMetaBlocks

JavaX fragment (include)

1  
svoid tok_processMetaBlocks(LS tok, bool metaCodeAllowed) {
2  
  for (int i = 0; i < 1000; i++) {
3  
    int idx = findCodeTokens(tok, "meta", "{");
4  
    if (idx < 0) break;
5  
    if (!metaCodeAllowed) fail("Meta code not allowed");
6  
    int j = findEndOfBracketPart(tok, idx+2);
7  
    S code = joinSubList(tok, idx+4, j-2);
8  
    print("Evaluating: " + code);
9  
    S result = str(javaEval(code));
10  
    replaceTokens_reTok(tok, idx, j+1, result);
11  
  }
12  
}

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: #1025380
Snippet name: tok_processMetaBlocks
Eternal ID of this version: #1025380/1
Text MD5: 5b36008d4354c4217b66445b7d82f131
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-27 00:53:02
Source code size: 447 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 237 / 276
Referenced in: [show references]