//!include once #1021761 // Fakery svoid gazelle_fakery_gatherRulesFromSections(TreeMap sections) { gazelle_fakery_clean(); for (S ruleID, ruleText : keysStartingWith(sections, "rule")) { new LS comments; LS lines = tlft(ruleText); while (isSquareBracketed(last(lines))) comments.add(deSquareBracket(popLast(lines))); int out = -1; for i over lines: { S s = lines.get(i); PairS p = splitTrailingSquareBracketStuff(s); if (startsWith(s, "=>")) out = i; if (nempty(p.b)) comments.add( (i >= out ? i == l(lines)-1 ? "out" : "out " + (i-out+1) : "in " + (i+1)) + " = " + p.b); lines.set(i, p.a); } rules.add(t3(lines(lines), lines(comments), ruleID)); } }