@@ -175,15 +175,15 @@ private void parseDelimitedToken(CharacterIterator c) throws MacroEvaluationExce
175
175
throw new MacroEvaluationException ("Missing } in macro usage" );
176
176
}
177
177
178
- processToken (c .getIndex ());
178
+ processToken (c .getIndex (), true );
179
179
c .next ();
180
180
}
181
181
182
182
private void parseNonDelimitedToken (CharacterIterator c ) throws MacroEvaluationException , IOException , InterruptedException {
183
183
String token = parseIdentifier (c );
184
184
if (StringUtils .isNotBlank (token )) {
185
185
startToken (token );
186
- processToken (c .getIndex ());
186
+ processToken (c .getIndex (), false );
187
187
}
188
188
}
189
189
@@ -450,7 +450,7 @@ boolean addTransform(Transform t) {
450
450
return true ;
451
451
}
452
452
453
- boolean processToken (int currentIndex ) throws IOException , InterruptedException , MacroEvaluationException {
453
+ boolean processToken (int currentIndex , boolean isDelimited ) throws IOException , InterruptedException , MacroEvaluationException {
454
454
String replacement = null ;
455
455
456
456
List <TokenMacro > all = new ArrayList <TokenMacro >(TokenMacro .all ());
@@ -492,7 +492,7 @@ boolean processToken(int currentIndex) throws IOException, InterruptedException,
492
492
throw new MacroEvaluationException (String .format ("Unrecognized macro '%s' in '%s'" , tokenName , stringWithMacro ));
493
493
494
494
if (replacement == null && !throwException ) { // just put the token back in since we don't want to throw the exception
495
- output .append (stringWithMacro .substring (tokenStartIndex , currentIndex +1 ));
495
+ output .append (stringWithMacro .substring (tokenStartIndex , currentIndex +( isDelimited ? 1 : 0 ) ));
496
496
} else if (replacement != null ) {
497
497
while (transforms != null && transforms .size () > 0 ) {
498
498
Transform t = transforms .pop ();
0 commit comments