mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
compact
This commit is contained in:
+6
-7
@@ -26,7 +26,6 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.declaration.D
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers.Modifiers;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.members.ClassMember;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.members.EnumConstant;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.members.EnumConstants;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.members.InterfaceMember;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.types.TypeParameters;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
||||
@@ -272,7 +271,7 @@ public class TypeDefinition implements GroovyElementTypes {
|
||||
Separators.parse(builder);
|
||||
|
||||
if (parseEnumConstantStart(builder, parser)) {
|
||||
EnumConstants.parse(builder, parser);
|
||||
EnumConstant.parseConstantList(builder, parser);
|
||||
} else {
|
||||
ClassMember.parse(builder, enumName, parser);
|
||||
}
|
||||
@@ -290,11 +289,11 @@ public class TypeDefinition implements GroovyElementTypes {
|
||||
private static boolean parseEnumConstantStart(PsiBuilder builder, GroovyParser parser) {
|
||||
PsiBuilder.Marker checkMarker = builder.mark();
|
||||
|
||||
boolean result = !WRONGWAY.equals(EnumConstant.parse(builder, parser))
|
||||
&& (ParserUtils.getToken(builder, mCOMMA)
|
||||
|| ParserUtils.getToken(builder, mSEMI)
|
||||
|| ParserUtils.getToken(builder, mNLS)
|
||||
|| ParserUtils.getToken(builder, mRCURLY));
|
||||
boolean result = EnumConstant.parseEnumConstant(builder, parser) &&
|
||||
(ParserUtils.getToken(builder, mCOMMA)
|
||||
|| ParserUtils.getToken(builder, mSEMI)
|
||||
|| ParserUtils.getToken(builder, mNLS)
|
||||
|| ParserUtils.getToken(builder, mRCURLY));
|
||||
|
||||
checkMarker.rollbackTo();
|
||||
return result;
|
||||
|
||||
+19
-4
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.members;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
@@ -31,7 +30,7 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
||||
* @date: 06.04.2007
|
||||
*/
|
||||
public class EnumConstant implements GroovyElementTypes {
|
||||
public static IElementType parse(PsiBuilder builder, GroovyParser parser) {
|
||||
public static boolean parseEnumConstant(PsiBuilder builder, GroovyParser parser) {
|
||||
PsiBuilder.Marker ecMarker = builder.mark();
|
||||
ParserUtils.getToken(builder, mNLS);
|
||||
|
||||
@@ -39,7 +38,7 @@ public class EnumConstant implements GroovyElementTypes {
|
||||
|
||||
if (!ParserUtils.getToken(builder, mIDENT)) {
|
||||
ecMarker.rollbackTo();
|
||||
return WRONGWAY;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mLPAREN.equals(builder.getTokenType())) {
|
||||
@@ -57,7 +56,23 @@ public class EnumConstant implements GroovyElementTypes {
|
||||
}
|
||||
|
||||
ecMarker.done(ENUM_CONSTANT);
|
||||
return ENUM_CONSTANT;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static void parseConstantList(PsiBuilder builder, GroovyParser parser) {
|
||||
PsiBuilder.Marker enumConstantsMarker = builder.mark();
|
||||
|
||||
if (!parseEnumConstant(builder, parser)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (ParserUtils.getToken(builder, mCOMMA)) {
|
||||
parseEnumConstant(builder, parser);
|
||||
}
|
||||
|
||||
ParserUtils.getToken(builder, mCOMMA);
|
||||
|
||||
enumConstantsMarker.done(ENUM_CONSTANTS);
|
||||
}
|
||||
}
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.members;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
||||
|
||||
/**
|
||||
* @author: Dmitry.Krasilschikov
|
||||
* @date: 06.04.2007
|
||||
*/
|
||||
public class EnumConstants implements GroovyElementTypes {
|
||||
public static GroovyElementType parse(PsiBuilder builder, GroovyParser parser) {
|
||||
PsiBuilder.Marker enumConstantsMarker = builder.mark();
|
||||
|
||||
if (WRONGWAY.equals(EnumConstant.parse(builder, parser))) {
|
||||
return WRONGWAY;
|
||||
}
|
||||
|
||||
while (ParserUtils.getToken(builder, mCOMMA)) {
|
||||
EnumConstant.parse(builder, parser);
|
||||
}
|
||||
|
||||
ParserUtils.getToken(builder, mCOMMA);
|
||||
|
||||
enumConstantsMarker.done(ENUM_CONSTANTS);
|
||||
return ENUM_CONSTANTS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user