static L processIncludes(L tok) { int safety = 0; while (hasCodeTokens(tok, "!", "include") && ++safety < 100) tok = processIncludes_single(tok); ret tok; } static L processIncludes_single(L 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)); }