}
//create a 'synthetic token' in the place we were expecting it.
if (currentToken != null) {
AbstractTokenManager tokenManager = grammar.getTokenManager();
FastCharStream inputStream = tokenManager.getInputStream();
final int created = tokenManager.addCustom(currentToken, token);
if (created != AbstractTokenManager.CUSTOM_NOT_CREATED) {
if (created == AbstractTokenManager.CUSTOM_CREATED_WAS_PARENS) {
//if we had a parens, let's clear the tokens we iterated because we can have skipped indentations!
currentToken.next.next = null;
//EOF was already found... let's restore the previous indentation level!
if (tokenManager.levelBeforeEof != -1) {
tokenManager.level = tokenManager.levelBeforeEof;
tokenManager.levelBeforeEof = -1; //mark it as not found again.
}
inputStream.restoreLineColPos(currentToken.endLine, currentToken.endColumn);
}
grammar.addAndReport(e, "Created custom token: " + token);
return new SpecialStr(token, currentToken.beginLine, currentToken.beginColumn);
}
}