mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Lookahead is now aware of whitespace and comment tokens that should not be count
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user