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

18
LINES

< > BotCompany Repo | #1005026 // processIncludes [old]

JavaX fragment (include)

static L<S> processIncludes(L<S> tok) {
  int safety = 0;
  while (hasCodeTokens(tok, "!", "include") && ++safety < 100)
    tok = processIncludes_single(tok);
  ret tok;
}

static L<S> processIncludes_single(L<S> tok) {
  S s = join(tok);
  Matcher m = Pattern.compile("\n\\s*!include (#\\d+)").matcher(s);
  StringBuffer buf = new StringBuffer();
  while (m.find()) {
    String includedSrc = loadSnippet(m.group(1));
    m.appendReplacement(buf, m.quoteReplacement("\n" + includedSrc));
  }
  m.appendTail(buf);
  ret jtok(str(buf));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005026
Snippet name: processIncludes [old]
Eternal ID of this version: #1005026/2
Text MD5: d338682b23e2808f2716aaf8796975a2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-07 00:57:58
Source code size: 555 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 544 / 550
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)