if (matchStart != startx)
{
String prefix = text.substring(startx, matchStart);
tokenAccumulator.add(new TextToken(prefix, textStartLocation));
}
// Group 1 includes the real text of the expansion, with whitespace
// around the
// expression (but inside the curly braces) excluded.
String expression = matcher.group(1);
tokenAccumulator.add(new ExpansionToken(expression, textStartLocation));
startx = matcher.end();
}
// Catch anything after the final regexp match.
if (startx < text.length())
tokenAccumulator.add(new TextToken(text.substring(startx, text.length()),
textStartLocation));
}