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

12
LINES

< > BotCompany Repo | #1025380 - tok_processMetaBlocks

JavaX fragment (include)

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

download  show line numbers  debug dex   

Travelled to 2 computer(s): mqqgnosmbjvj, tvejysmllsmz

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: 5 / 10
Referenced in: [show references]

Formerly at http://tinybrain.de/1025380 & http://1025380.tinybrain.de