Lookahead is now aware of whitespace and comment tokens that should not be count

This commit is contained in:
Maxim Shafirov
2010-12-16 15:38:26 +03:00
parent 6652fe5b15
commit 2957c2d05e
@@ -620,8 +620,17 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
@Nullable
@Override
public IElementType lookAhead(int steps) {
if (steps + myCurrentLexeme >= myLexemeCount) return null;
return myLexTypes[myCurrentLexeme + steps];
int cur = myCurrentLexeme;
while (steps > 0) {
while (cur < myLexemeCount && whitespaceOrComment(myLexTypes[cur])) {
cur++;
}
steps--;
}
return cur < myLexemeCount ? myLexTypes[cur] : null;
}
@Override