mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] minor parser optimization (IDEA-CR-19063)
This commit is contained in:
@@ -106,9 +106,11 @@ public class FileParser {
|
||||
|
||||
private static boolean stopImportListParsing(PsiBuilder b) {
|
||||
IElementType type = b.getTokenType();
|
||||
String text = b.getTokenText();
|
||||
if (IMPORT_LIST_STOPPER_SET.contains(type)) return true;
|
||||
if (type == JavaTokenType.IDENTIFIER && (PsiKeyword.OPEN.equals(text) || PsiKeyword.MODULE.equals(text))) return true;
|
||||
if (type == JavaTokenType.IDENTIFIER) {
|
||||
String text = b.getTokenText();
|
||||
if (PsiKeyword.OPEN.equals(text) || PsiKeyword.MODULE.equals(text)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ public class ModuleParser {
|
||||
PsiBuilder.Marker firstAnnotation = myParser.getDeclarationParser().parseAnnotations(builder);
|
||||
|
||||
IElementType type = builder.getTokenType();
|
||||
String text = builder.getTokenText();
|
||||
if (type != JavaTokenType.IDENTIFIER || !(PsiKeyword.OPEN.equals(text) || PsiKeyword.MODULE.equals(text))) {
|
||||
String text = type == JavaTokenType.IDENTIFIER ? builder.getTokenText() : null;
|
||||
if (!(PsiKeyword.OPEN.equals(text) || PsiKeyword.MODULE.equals(text))) {
|
||||
module.rollbackTo();
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user