// return new rule text, add comments to comments sS gazelle_processSquareBracketAnnotations(S ruleText, 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( (out >= 0 ? i == out && i == l(lines)-1 ? "out" : "out " + (i-out+1) : "in " + (i+1)) + " = " + gazelle_canonicalizeLineType(p.b)); lines.set(i, p.a); } ret lines_rtrim(lines); }