showSteps );
// do we need to report errors for that?
if ( lines[i].equals( expanded[lastExpanded] ) ) {
// report error
this.addError( new ExpanderException( "Unable to expand: " + lines[i],
i + lineOffset ) );
}
// If the original starts with a "-", it means we need to add it
// as a modify term to the previous pattern
if ( trimmed.startsWith( "-" ) && (!lines[i].equals( expanded[lastExpanded] )) ) {
int lastMatchStart = -1;
int lastMatchEnd = -1;
String modifiers = "";
if ( lastPattern >= 0 ) {
final Matcher m2 = modifyFinder.matcher( expanded[lastPattern] );
while ( m2.find() ) {
lastMatchStart = m2.start();
lastMatchEnd = m2.end();
modifiers = m2.group( 1 ).trim();
}
}
if ( lastMatchStart > -1 ) {
// rebuilding previous modify structure
expanded[lastPattern] = expanded[lastPattern].substring( 0,
lastMatchStart )
+ "{ " + modifiers +
((modifiers.length() == 0) ? "" : ", ") +
expanded[lastExpanded].trim() + " }" +
expanded[lastPattern].substring( lastMatchEnd );
} else {
// error, pattern not found to add constraint to
this.addError( new ExpanderException( "No modify was found to add the modifier to: " + lines[i].trim(),
i + lineOffset ) );
}
lastExpanded--;
} else {
lastPattern = lastExpanded;