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

18
LINES

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

JavaX fragment (include)

1  
static L<S> processIncludes(L<S> tok) {
2  
  int safety = 0;
3  
  while (hasCodeTokens(tok, "!", "include") && ++safety < 100)
4  
    tok = processIncludes_single(tok);
5  
  ret tok;
6  
}
7  
8  
static L<S> processIncludes_single(L<S> tok) {
9  
  S s = join(tok);
10  
  Matcher m = Pattern.compile("\n\\s*!include (#\\d+)").matcher(s);
11  
  StringBuffer buf = new StringBuffer();
12  
  while (m.find()) {
13  
    String includedSrc = loadSnippet(m.group(1));
14  
    m.appendReplacement(buf, m.quoteReplacement("\n" + includedSrc));
15  
  }
16  
  m.appendTail(buf);
17  
  ret jtok(str(buf));
18  
}

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