public String getTextRuleAfterRemovingLeftRecursion() {
StringBuilder head = new StringBuilder();
StringBuilder star = new StringBuilder();
for (List<ATEToken> alts : getAlternatives()) {
ATEToken firstTokenInAlt = alts.get(0);
if (firstTokenInAlt.getAttribute().equals(name)) {
if (alts.size() > 1) {
if (star.length() > 0)
star.append(" | ");
int start = (alts.get(1)).getStartIndex();
int end = (alts.get(alts.size() - 1)).getEndIndex();
star.append(firstTokenInAlt.getText().substring(start, end));
}
} else {
if (head.length() > 0)
head.append(" | ");
int start = firstTokenInAlt.getStartIndex();
int end = (alts.get(alts.size() - 1)).getEndIndex();
head.append(firstTokenInAlt.getText().substring(start, end));
}
}
StringBuilder sb = new StringBuilder();
sb.append("(");