private int formatString(ParsingList l, int start) { int end = l.size(); String s = ""; for (int i = start; i < end; i++) { ParsingExpression e = l.get(i); if (e instanceof ParsingByte) { char c = (char) (((ParsingByte) e).byteChar); if (c >= ' ' && c < 127) { s += c; continue; } } end = i; break; } if (s.length() > 1) { this.formatString(Utils.quoteString('\'', s, '\'')); } return end - 1; }
protected void formatSequence(ParsingList l) { for (int i = 0; i < l.size(); i++) { if (i > 0) { this.formatString(" "); } int n = formatString(l, i); if (n > i) { i = n; continue; } ParsingExpression e = l.get(i); if (e instanceof ParsingChoice || e instanceof ParsingSequence) { this.formatString("( "); e.visit(this); this.formatString(" )"); continue; } e.visit(this); } }