mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
@@ -101,7 +101,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(element.getProject()).getElementFactory();
|
||||
for (String s : signature) {
|
||||
try {
|
||||
types.add(elementFactory.createTypeFromText(s, scope));
|
||||
types.add(elementFactory.createTypeFromText(s, element));
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
types.add(PsiType.NULL);
|
||||
|
||||
+17
-9
@@ -45,6 +45,7 @@ import com.intellij.refactoring.introduceVariable.VariableInplaceIntroducer;
|
||||
import com.intellij.refactoring.rename.inplace.VariableInplaceRenamer;
|
||||
import com.intellij.refactoring.ui.TypeSelectorManager;
|
||||
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
|
||||
import com.intellij.ui.TitlePanel;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import gnu.trove.TIntArrayList;
|
||||
@@ -107,10 +108,16 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
|
||||
myExprText = myExpr != null ? myExpr.getText() : null;
|
||||
|
||||
myWholePanel = new JPanel(new GridBagLayout());
|
||||
myWholePanel.setBorder(BorderFactory.createTitledBorder(IntroduceParameterHandler.REFACTORING_NAME));
|
||||
myWholePanel.setBorder(null);
|
||||
final GridBagConstraints gc =
|
||||
new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 0), 0, 0);
|
||||
new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
|
||||
|
||||
final TitlePanel titlePanel = new TitlePanel();
|
||||
titlePanel.setBorder(null);
|
||||
titlePanel.setText(IntroduceParameterHandler.REFACTORING_NAME);
|
||||
myWholePanel.add(titlePanel, gc);
|
||||
|
||||
gc.insets = new Insets(5, 5, 5, 0);
|
||||
if (myOccurrences.length > 1 && !myIsInvokedOnDeclaration) {
|
||||
gc.gridy++;
|
||||
createOccurrencesCb(gc, myWholePanel, myOccurrences.length);
|
||||
@@ -395,13 +402,14 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
|
||||
|
||||
private void showBalloon() {
|
||||
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(myWholePanel);
|
||||
balloonBuilder.setFadeoutTime(0);
|
||||
balloonBuilder.setFillColor(IdeTooltipManager.GRAPHITE_COLOR);
|
||||
balloonBuilder.setAnimationCycle(0);
|
||||
balloonBuilder.setHideOnClickOutside(false);
|
||||
balloonBuilder.setHideOnKeyOutside(false);
|
||||
balloonBuilder.setHideOnAction(false);
|
||||
balloonBuilder.setCloseButtonEnabled(true);
|
||||
balloonBuilder.setFadeoutTime(0)
|
||||
.setFillColor(IdeTooltipManager.GRAPHITE_COLOR)
|
||||
.setAnimationCycle(0)
|
||||
.setHideOnClickOutside(false)
|
||||
.setHideOnKeyOutside(false)
|
||||
.setHideOnAction(false)
|
||||
.setCloseButtonEnabled(true);
|
||||
|
||||
final RelativePoint target = JBPopupFactory.getInstance().guessBestPopupLocation(myEditor);
|
||||
final Point screenPoint = target.getScreenPoint();
|
||||
myBalloon = balloonBuilder.createBalloon();
|
||||
|
||||
+3
-2
@@ -171,7 +171,6 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
final List<PsiMethod> validEnclosingMethods,
|
||||
final Introducer introducer) {
|
||||
final JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(IdeBorderFactory.createRoundedBorder());
|
||||
final JCheckBox superMethod = new JCheckBox("Choose base method", true);
|
||||
superMethod.setMnemonic('b');
|
||||
panel.add(superMethod, BorderLayout.SOUTH);
|
||||
@@ -191,7 +190,9 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
}
|
||||
});
|
||||
updateView(validEnclosingMethods.get(0), editor, attributes, highlighters, superMethod);
|
||||
panel.add(ScrollPaneFactory.createScrollPane(list), BorderLayout.CENTER);
|
||||
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(list);
|
||||
scrollPane.setBorder(null);
|
||||
panel.add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
final List<Pair<ActionListener, KeyStroke>>
|
||||
keyboardActions = Collections.singletonList(Pair.<ActionListener, KeyStroke>create(new ActionListener() {
|
||||
|
||||
+3
-4
@@ -110,7 +110,7 @@ public class OldReferenceResolver {
|
||||
final JavaResolveResult adv = oldRef.advancedResolve(false);
|
||||
final PsiElement scope = getClassContainingResolve(adv);
|
||||
final PsiClass clss = PsiTreeUtil.getParentOfType(oldExpr, PsiClass.class);
|
||||
if (clss != null && scope != null && PsiTreeUtil.isAncestor(clss, scope, false)) {
|
||||
if (clss != null && scope != null ) {
|
||||
|
||||
final PsiElement subj = adv.getElement();
|
||||
|
||||
@@ -118,7 +118,6 @@ public class OldReferenceResolver {
|
||||
// Parameters
|
||||
if (subj instanceof PsiParameter) {
|
||||
PsiParameterList parameterList = myMethodToReplaceIn.getParameterList();
|
||||
PsiParameter[] parameters = parameterList.getParameters();
|
||||
|
||||
if (subj.getParent() != parameterList) return;
|
||||
int index = parameterList.getParameterIndex((PsiParameter)subj);
|
||||
@@ -133,7 +132,7 @@ public class OldReferenceResolver {
|
||||
}
|
||||
}
|
||||
// "naked" field and methods (should become qualified)
|
||||
else if ((subj instanceof PsiField || subj instanceof PsiMethod) && oldRef.getQualifierExpression() == null) {
|
||||
else if ((subj instanceof PsiField || subj instanceof PsiMethod) && oldRef.getQualifierExpression() == null && PsiTreeUtil.isAncestor(clss, scope, false)) {
|
||||
|
||||
boolean isStatic = subj instanceof PsiField && ((PsiField)subj).hasModifierProperty(PsiModifier.STATIC) ||
|
||||
subj instanceof PsiMethod && ((PsiMethod)subj).hasModifierProperty(PsiModifier.STATIC);
|
||||
@@ -151,7 +150,7 @@ public class OldReferenceResolver {
|
||||
}
|
||||
}
|
||||
|
||||
if (subj instanceof PsiField) {
|
||||
if (subj instanceof PsiField && PsiTreeUtil.isAncestor(clss, scope, false)) {
|
||||
// probably replacing field with a getter
|
||||
if (myReplaceFieldsWithGetters != IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE) {
|
||||
if (myReplaceFieldsWithGetters == IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL ||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package pkg;
|
||||
|
||||
/**
|
||||
* @see #equals(Object)
|
||||
|
||||
* @see A3#equals(Object)
|
||||
* @see pkg.A3#equals(Object)
|
||||
|
||||
* @see Object#equals(Object)
|
||||
* @see java.lang.Object#equals(Object)
|
||||
*/
|
||||
class A3 {
|
||||
public boolean equals(Object obj) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #equals(Object)
|
||||
|
||||
* @see B3#equals(Object)
|
||||
* @see pkg.B3#equals(Object)
|
||||
|
||||
* @see Object#equals(Object)
|
||||
* @see java.lang.Object#equals(Object)
|
||||
*/
|
||||
class B3 {
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
*/
|
||||
class AAAA {
|
||||
void foo() {
|
||||
sampleEnclosing("A" + "");
|
||||
}
|
||||
|
||||
private void sampleEnclosing(final String anObject) {
|
||||
new AAAA() {
|
||||
void bar() {
|
||||
System.out.println(anObject);
|
||||
}
|
||||
}.bar();
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
*/
|
||||
class AAAA {
|
||||
void foo() {
|
||||
sampleEnclosing("A");
|
||||
}
|
||||
|
||||
private void sampleEnclosing(final String s) {
|
||||
new AAAA() {
|
||||
void bar() {
|
||||
System.out.println(<selection>s + ""</selection>);
|
||||
}
|
||||
}.bar();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public class JavadocResolveTest extends DaemonAnalyzerTestCase {
|
||||
public void testSee0() throws Exception { doTest(); }
|
||||
public void testSee1() throws Exception { doTest(); }
|
||||
public void testSee2() throws Exception { doTest(); }
|
||||
public void testSee3() throws Exception { doTest(); }
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/pkg/" + getTestName(false) + ".java", BASE_PATH, false, false);
|
||||
|
||||
@@ -28,6 +28,8 @@ import gnu.trove.TIntArrayList;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@TestDataPath("$CONTENT_ROOT/testData")
|
||||
public class IntroduceParameterTest extends LightCodeInsightTestCase {
|
||||
@Override
|
||||
@@ -270,6 +272,12 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
|
||||
checkResultByFile("/refactoring/introduceParameter/after" + getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
public void testEnclosingWithParamDeletion() throws Exception {
|
||||
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
|
||||
perform(true, 0, "anObject", false, true, true, false, 1);
|
||||
checkResultByFile("/refactoring/introduceParameter/after" + getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
private static boolean perform(boolean replaceAllOccurences,
|
||||
int replaceFieldsWithGetters,
|
||||
@NonNls String parameterName,
|
||||
@@ -277,6 +285,18 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
|
||||
boolean declareFinal,
|
||||
final boolean removeUnusedParameters,
|
||||
final boolean generateDelegate) {
|
||||
return perform(replaceAllOccurences, replaceFieldsWithGetters, parameterName, searchForSuper, declareFinal, removeUnusedParameters,
|
||||
generateDelegate, 0);
|
||||
}
|
||||
|
||||
private static boolean perform(boolean replaceAllOccurences,
|
||||
int replaceFieldsWithGetters,
|
||||
@NonNls String parameterName,
|
||||
boolean searchForSuper,
|
||||
boolean declareFinal,
|
||||
final boolean removeUnusedParameters,
|
||||
final boolean generateDelegate,
|
||||
int enclosingLevel) {
|
||||
int startOffset = myEditor.getSelectionModel().getSelectionStart();
|
||||
int endOffset = myEditor.getSelectionModel().getSelectionEnd();
|
||||
|
||||
@@ -294,6 +314,10 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
|
||||
PsiMethod method = Util.getContainingMethod(context);
|
||||
if (method == null) return false;
|
||||
|
||||
final List<PsiMethod> methods = IntroduceParameterHandler.getEnclosingMethods(method);
|
||||
assertTrue(methods.size() > enclosingLevel);
|
||||
method = methods.get(enclosingLevel);
|
||||
|
||||
final PsiMethod methodToSearchFor;
|
||||
if (searchForSuper) {
|
||||
methodToSearchFor = method.findDeepestSuperMethod();
|
||||
|
||||
@@ -28,19 +28,19 @@ public class PorterStemmerUtil {
|
||||
// check for zero length
|
||||
final int strLen = str.length();
|
||||
if (strLen > 0) {
|
||||
int lastDigit = -1;
|
||||
int lastNonLetter = -1;
|
||||
for (int i = 0; i < strLen; ++i) {
|
||||
char c = str.charAt(i);
|
||||
if (Character.isDigit(c)) {
|
||||
lastDigit = i;
|
||||
if (Character.isDigit(c) || c == '-' || c == '_') {
|
||||
lastNonLetter = i;
|
||||
}
|
||||
else if (!Character.isLetter(c)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
++lastDigit;
|
||||
if (lastDigit > 0 && lastDigit < strLen) {
|
||||
return str.substring(0, lastDigit) + stemString(str.substring(lastDigit));
|
||||
++lastNonLetter;
|
||||
if (lastNonLetter > 0 && lastNonLetter < strLen) {
|
||||
return str.substring(0, lastNonLetter) + stemString(str.substring(lastNonLetter));
|
||||
}
|
||||
return stemString(str);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ public class SearchUtil {
|
||||
final String filter) {
|
||||
if (pos < end) {
|
||||
final Set<String> filters = SearchableOptionsRegistrar.getInstance().getProcessedWords(filter);
|
||||
final String[] words = text.substring(pos, end).split("[\\W&&[^_-]]");
|
||||
final String[] words = text.substring(pos, end).split("[\\W&&[^-]]+");
|
||||
for (String word : words) {
|
||||
if (filters.contains(PorterStemmerUtil.stem(word.toLowerCase()))) {
|
||||
selectedWords.add(word);
|
||||
|
||||
+12
-16
@@ -67,7 +67,7 @@ public class SearchableOptionsRegistrarImpl extends SearchableOptionsRegistrar {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl");
|
||||
public static final int LOAD_FACTOR = 20;
|
||||
@NonNls
|
||||
private static final Pattern REG_EXP = Pattern.compile("[\\W&&[^_-]]");
|
||||
private static final Pattern REG_EXP = Pattern.compile("[\\W&&[^-]]+");
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public SearchableOptionsRegistrarImpl() {
|
||||
@@ -360,14 +360,12 @@ public class SearchableOptionsRegistrarImpl extends SearchableOptionsRegistrar {
|
||||
Set<String> result = new HashSet<String>();
|
||||
@NonNls final String toLowerCase = text.toLowerCase();
|
||||
final String[] options = REG_EXP.split(toLowerCase);
|
||||
if (options != null) {
|
||||
for (String opt : options) {
|
||||
if (opt == null) continue;
|
||||
if (isStopWord(opt)) continue;
|
||||
final String processed = PorterStemmerUtil.stem(opt);
|
||||
if (isStopWord(processed)) continue;
|
||||
result.add(opt);
|
||||
}
|
||||
for (String opt : options) {
|
||||
if (isStopWord(opt)) continue;
|
||||
final String processed = PorterStemmerUtil.stem(opt);
|
||||
assert processed != null;
|
||||
if (isStopWord(processed)) continue;
|
||||
result.add(opt);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -376,13 +374,11 @@ public class SearchableOptionsRegistrarImpl extends SearchableOptionsRegistrar {
|
||||
Set<String> result = new HashSet<String>();
|
||||
@NonNls final String toLowerCase = text.toLowerCase();
|
||||
final String[] options = REG_EXP.split(toLowerCase);
|
||||
if (options != null) {
|
||||
for (String opt : options) {
|
||||
if (isStopWord(opt)) continue;
|
||||
opt = PorterStemmerUtil.stem(opt);
|
||||
if (opt == null) continue;
|
||||
result.add(opt);
|
||||
}
|
||||
for (String opt : options) {
|
||||
if (isStopWord(opt)) continue;
|
||||
opt = PorterStemmerUtil.stem(opt);
|
||||
assert opt != null;
|
||||
result.add(opt);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@ package org.jetbrains.android.compiler;
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.compiler.impl.CompileContextImpl;
|
||||
import com.intellij.compiler.impl.ModuleCompileScope;
|
||||
import com.intellij.compiler.options.CompileStepBeforeRun;
|
||||
import com.intellij.compiler.progress.CompilerTask;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfiguration;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
@@ -359,9 +356,4 @@ public class AndroidCompileUtil {
|
||||
}
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
public static boolean isFullBuild(@NotNull CompileContext context) {
|
||||
RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(context);
|
||||
return !(runConfiguration instanceof JUnitConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +75,6 @@ public class AndroidDexCompiler implements ClassPostProcessingCompiler {
|
||||
|
||||
@NotNull
|
||||
public ProcessingItem[] getProcessingItems(CompileContext context) {
|
||||
if (!AndroidCompileUtil.isFullBuild(context)) {
|
||||
return ProcessingItem.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
return ApplicationManager.getApplication().runReadAction(new PrepareAction(context));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,10 +94,6 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
|
||||
@NotNull
|
||||
public ProcessingItem[] getProcessingItems(CompileContext context) {
|
||||
if (!AndroidCompileUtil.isFullBuild(context)) {
|
||||
return ProcessingItem.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
final List<ProcessingItem> items = new ArrayList<ProcessingItem>();
|
||||
for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
|
||||
AndroidFacet facet = AndroidFacet.getInstance(module);
|
||||
|
||||
-4
@@ -42,10 +42,6 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
|
||||
@NotNull
|
||||
@Override
|
||||
public ProcessingItem[] getProcessingItems(CompileContext context) {
|
||||
if (!AndroidCompileUtil.isFullBuild(context)) {
|
||||
return ProcessingItem.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
final List<ProcessingItem> items = new ArrayList<ProcessingItem>();
|
||||
for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
|
||||
AndroidFacet facet = AndroidFacet.getInstance(module);
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.Separators;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers.Modifiers;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.*;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.blocks.OpenOrClosableBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.constructor.ConstructorBody;
|
||||
@@ -36,6 +37,8 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitio
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.toplevel.CompilationUnit;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.*;
|
||||
|
||||
/**
|
||||
* Parser for Groovy script files
|
||||
*
|
||||
@@ -50,13 +53,13 @@ public class GroovyParser implements PsiParser {
|
||||
@NotNull
|
||||
public ASTNode parse(IElementType root, PsiBuilder builder) {
|
||||
//builder.setDebugMode(true);
|
||||
if (root == GroovyElementTypes.OPEN_BLOCK) {
|
||||
if (root == OPEN_BLOCK) {
|
||||
OpenOrClosableBlock.parseOpenBlockDeep(builder, this);
|
||||
}
|
||||
else if (root == GroovyElementTypes.CLOSABLE_BLOCK) {
|
||||
else if (root == CLOSABLE_BLOCK) {
|
||||
OpenOrClosableBlock.parseClosableBlockDeep(builder, this);
|
||||
}
|
||||
else if (root == GroovyElementTypes.CONSTRUCTOR_BODY) {
|
||||
else if (root == CONSTRUCTOR_BODY) {
|
||||
ConstructorBody.parseConstructorBodyDeep(builder, this);
|
||||
}
|
||||
else {
|
||||
@@ -73,12 +76,12 @@ public class GroovyParser implements PsiParser {
|
||||
|
||||
ParserUtils.getToken(builder, GroovyTokenTypes.kFOR);
|
||||
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN, GroovyBundle.message("lparen.expected"))) {
|
||||
marker.done(GroovyElementTypes.FOR_STATEMENT);
|
||||
marker.done(FOR_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
if (!ForStatement.forClauseParse(builder, this)) {
|
||||
builder.error(GroovyBundle.message("for.clause.expected"));
|
||||
marker.done(GroovyElementTypes.FOR_STATEMENT);
|
||||
marker.done(FOR_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -88,7 +91,7 @@ public class GroovyParser implements PsiParser {
|
||||
while (!builder.eof() && GroovyTokenTypes.mNLS == builder.getTokenType()){
|
||||
builder.advanceLexer();
|
||||
}
|
||||
marker.done(GroovyElementTypes.FOR_STATEMENT);
|
||||
marker.done(FOR_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -99,18 +102,18 @@ public class GroovyParser implements PsiParser {
|
||||
|
||||
if (parseExtendedStatement(builder)) {
|
||||
warn.rollbackTo();
|
||||
marker.done(GroovyElementTypes.FOR_STATEMENT);
|
||||
marker.done(FOR_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!parseStatement(builder, true)) {
|
||||
warn.rollbackTo();
|
||||
builder.error(GroovyBundle.message("expression.expected"));
|
||||
marker.done(GroovyElementTypes.FOR_STATEMENT);
|
||||
marker.done(FOR_STATEMENT);
|
||||
return true;
|
||||
} else {
|
||||
warn.drop();
|
||||
marker.done(GroovyElementTypes.FOR_STATEMENT);
|
||||
marker.done(FOR_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -126,10 +129,8 @@ public class GroovyParser implements PsiParser {
|
||||
}
|
||||
|
||||
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN, GroovyBundle.message("lparen.expected"))) {
|
||||
// ifStmtMarker.done(IF_STATEMENT);
|
||||
// return IF_STATEMENT;
|
||||
ifStmtMarker.drop();
|
||||
return false;
|
||||
ifStmtMarker.done(IF_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ConditionalExpression.parse(builder, this)) {
|
||||
@@ -150,7 +151,7 @@ public class GroovyParser implements PsiParser {
|
||||
builder.error(GroovyBundle.message("rparen.expected"));
|
||||
}
|
||||
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN)) {
|
||||
ifStmtMarker.done(GroovyElementTypes.IF_STATEMENT);
|
||||
ifStmtMarker.done(IF_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -163,7 +164,7 @@ public class GroovyParser implements PsiParser {
|
||||
if (!parseStatement(builder, true) && !parseExtendedStatement(builder)) {
|
||||
warn.rollbackTo();
|
||||
builder.error(GroovyBundle.message("expression.expected"));
|
||||
ifStmtMarker.done(GroovyElementTypes.IF_STATEMENT);
|
||||
ifStmtMarker.done(IF_STATEMENT);
|
||||
return true;
|
||||
} else {
|
||||
warn.drop();
|
||||
@@ -184,18 +185,18 @@ public class GroovyParser implements PsiParser {
|
||||
if (!parseStatement(builder, true) && !parseExtendedStatement(builder)) {
|
||||
warn.rollbackTo();
|
||||
builder.error(GroovyBundle.message("expression.expected"));
|
||||
ifStmtMarker.done(GroovyElementTypes.IF_STATEMENT);
|
||||
ifStmtMarker.done(IF_STATEMENT);
|
||||
return true;
|
||||
} else {
|
||||
warn.drop();
|
||||
}
|
||||
|
||||
ifStmtMarker.done(GroovyElementTypes.IF_STATEMENT);
|
||||
ifStmtMarker.done(IF_STATEMENT);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
rb.rollbackTo();
|
||||
ifStmtMarker.done(GroovyElementTypes.IF_STATEMENT);
|
||||
ifStmtMarker.done(IF_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -279,7 +280,7 @@ public class GroovyParser implements PsiParser {
|
||||
ParserUtils.getToken(builder, GroovyTokenTypes.kWHILE);
|
||||
|
||||
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN, GroovyBundle.message("lparen.expected"))) {
|
||||
marker.done(GroovyElementTypes.WHILE_STATEMENT);
|
||||
marker.done(WHILE_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -295,7 +296,7 @@ public class GroovyParser implements PsiParser {
|
||||
builder.error(GroovyBundle.message("rparen.expected"));
|
||||
}
|
||||
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN)) {
|
||||
marker.done(GroovyElementTypes.WHILE_STATEMENT);
|
||||
marker.done(WHILE_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -306,11 +307,11 @@ public class GroovyParser implements PsiParser {
|
||||
if (!parseStatement(builder, true) && !parseExtendedStatement(builder)) {
|
||||
warn.rollbackTo();
|
||||
builder.error(GroovyBundle.message("expression.expected"));
|
||||
marker.done(GroovyElementTypes.WHILE_STATEMENT);
|
||||
marker.done(WHILE_STATEMENT);
|
||||
return true;
|
||||
} else {
|
||||
warn.drop();
|
||||
marker.done(GroovyElementTypes.WHILE_STATEMENT);
|
||||
marker.done(WHILE_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -391,7 +392,7 @@ public class GroovyParser implements PsiParser {
|
||||
if (isBlockStatementNeeded && GroovyTokenTypes.mLCURLY.equals(builder.getTokenType())) {
|
||||
final PsiBuilder.Marker marker = builder.mark();
|
||||
OpenOrClosableBlock.parseOpenBlockDeep(builder, this);
|
||||
marker.done(GroovyElementTypes.BLOCK_STATEMENT);
|
||||
marker.done(BLOCK_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -467,21 +468,39 @@ public class GroovyParser implements PsiParser {
|
||||
|
||||
//declaration
|
||||
PsiBuilder.Marker declMarker = builder.mark();
|
||||
if (!Declaration.parse(builder, false, this)) {
|
||||
declMarker.rollbackTo();
|
||||
} else {
|
||||
declMarker.drop();
|
||||
boolean modifiersParsed = Modifiers.parse(builder, this);
|
||||
|
||||
if (kIMPORT == builder.getTokenType()) {
|
||||
final PsiBuilder.Marker impMarker = declMarker.precede();
|
||||
ImportStatement.parseAfterModifiers(builder);
|
||||
declMarker.done(IMPORT_STATEMENT);
|
||||
impMarker.error(GroovyBundle.message("import.not.allowed"));
|
||||
return true;
|
||||
}
|
||||
|
||||
PsiBuilder.Marker marker = builder.mark();
|
||||
if (ImportStatement.parse(builder, this)) {
|
||||
marker.error(GroovyBundle.message("import.not.allowed"));
|
||||
if (kCLASS == builder.getTokenType() || kINTERFACE == builder.getTokenType() || kENUM == builder.getTokenType() || mAT == builder.getTokenType()) {
|
||||
final IElementType tdType = TypeDefinition.parseAfterModifiers(builder, this);
|
||||
if (tdType != WRONGWAY) {
|
||||
declMarker.done(tdType);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
marker.drop();
|
||||
|
||||
final IElementType declType = Declaration.parseAfterModifiers(builder, false, false, this, declMarker, modifiersParsed);
|
||||
if (declType != WRONGWAY) {
|
||||
if (declType != null) {
|
||||
declMarker.done(declType);
|
||||
} else {
|
||||
declMarker.drop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (TypeDefinition.parse(builder, this)) return true;
|
||||
|
||||
if (modifiersParsed) {
|
||||
declMarker.done(VARIABLE_DEFINITION_ERROR);
|
||||
return true;
|
||||
}
|
||||
declMarker.rollbackTo();
|
||||
|
||||
return AssignmentExpression.parse(builder, this, true);
|
||||
|
||||
@@ -498,14 +517,14 @@ public class GroovyParser implements PsiParser {
|
||||
private boolean parseLabeledStatement(PsiBuilder builder) {
|
||||
|
||||
PsiBuilder.Marker marker = builder.mark();
|
||||
ParserUtils.eatElement(builder, GroovyElementTypes.LABEL);
|
||||
ParserUtils.eatElement(builder, LABEL);
|
||||
ParserUtils.getToken(builder, GroovyTokenTypes.mCOLON);
|
||||
|
||||
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
|
||||
|
||||
parseStatement(builder, false);
|
||||
|
||||
marker.done(GroovyElementTypes.LABELED_STATEMENT);
|
||||
marker.done(LABELED_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
-51
@@ -1,51 +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.auxiliary.modifiers;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
|
||||
/**
|
||||
* @autor: Dmitry.Krasilschikov
|
||||
* @date: 14.03.2007
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modifier ::= private
|
||||
* | public
|
||||
* | protected
|
||||
* | static
|
||||
* | transient
|
||||
* | final
|
||||
* | abstract
|
||||
* | native
|
||||
* | synchronized
|
||||
* | volatile
|
||||
* | srtictfp
|
||||
* | def
|
||||
*/
|
||||
|
||||
public class Modifier implements GroovyElementTypes {
|
||||
public static boolean parse(PsiBuilder builder) {
|
||||
if (TokenSets.MODIFIERS.contains(builder.getTokenType())) {
|
||||
builder.advanceLexer();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+11
-2
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.annotations.Annotation;
|
||||
@@ -38,7 +39,7 @@ public class Modifiers implements GroovyElementTypes {
|
||||
boolean endsWithNewLine;
|
||||
PsiBuilder.Marker modifiersMarker = builder.mark();
|
||||
|
||||
if (!Annotation.parse(builder, parser) && !Modifier.parse(builder)) {
|
||||
if (!Annotation.parse(builder, parser) && !parseModifier(builder)) {
|
||||
modifiersMarker.done(MODIFIERS);
|
||||
return false;
|
||||
}
|
||||
@@ -49,7 +50,7 @@ public class Modifiers implements GroovyElementTypes {
|
||||
newLineMarker = builder.mark();
|
||||
endsWithNewLine = ParserUtils.getToken(builder, mNLS);
|
||||
|
||||
if (!Annotation.parse(builder, parser) && !Modifier.parse(builder)) break;
|
||||
if (!Annotation.parse(builder, parser) && !parseModifier(builder)) break;
|
||||
}
|
||||
|
||||
// Do not include last newline
|
||||
@@ -63,4 +64,12 @@ public class Modifiers implements GroovyElementTypes {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static boolean parseModifier(PsiBuilder builder) {
|
||||
if (TokenSets.MODIFIERS.contains(builder.getTokenType())) {
|
||||
builder.advanceLexer();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+48
-32
@@ -18,12 +18,12 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.declaration;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers.Modifiers;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.ReferenceElement;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.types.TypeParameters;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.types.TypeSpec;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
||||
@@ -50,11 +50,41 @@ public class Declaration implements GroovyElementTypes {
|
||||
//allows error messages
|
||||
boolean modifiersParsed = Modifiers.parse(builder, parser);
|
||||
|
||||
final boolean methodStart = mLT == builder.getTokenType();
|
||||
final IElementType type = parseAfterModifiers(builder, isInClass, isInAnnotation, parser, declMarker, modifiersParsed);
|
||||
if (type == WRONGWAY) {
|
||||
if (modifiersParsed && methodStart) {
|
||||
declMarker.error(GroovyBundle.message("method.definitions.expected"));
|
||||
return false;
|
||||
}
|
||||
|
||||
declMarker.rollbackTo();
|
||||
if (modifiersParsed) {
|
||||
builder.error(GroovyBundle.message("variable.definitions.expected"));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type != null) {
|
||||
declMarker.done(type);
|
||||
} else {
|
||||
declMarker.drop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IElementType parseAfterModifiers(PsiBuilder builder,
|
||||
boolean isInClass,
|
||||
boolean isInAnnotation,
|
||||
GroovyParser parser,
|
||||
PsiBuilder.Marker declMarker, boolean modifiersParsed) {
|
||||
if (modifiersParsed && mLT == builder.getTokenType()) {
|
||||
TypeParameters.parse(builder);
|
||||
PsiBuilder.Marker checkMarker = builder.mark(); //point to begin of type or variable
|
||||
|
||||
if (TypeSpec.parse(builder, true) == fail) { //if type wasn't recognized trying parse VaribleDeclaration
|
||||
if (TypeSpec.parse(builder, true) == fail) { //if type wasn't recognized trying parse VariableDeclaration
|
||||
checkMarker.rollbackTo();
|
||||
} else {
|
||||
checkMarker.drop();
|
||||
@@ -62,17 +92,17 @@ public class Declaration implements GroovyElementTypes {
|
||||
IElementType decl = VariableDefinitions.parseDefinitions(builder, isInClass, false, false, true, modifiersParsed, false, parser);
|
||||
|
||||
if (WRONGWAY.equals(decl)) {
|
||||
declMarker.error(GroovyBundle.message("method.definitions.expected"));
|
||||
} else {
|
||||
declMarker.done(METHOD_DEFINITION);
|
||||
return WRONGWAY;
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (modifiersParsed) {
|
||||
return METHOD_DEFINITION;
|
||||
}
|
||||
|
||||
if (modifiersParsed) {
|
||||
|
||||
PsiBuilder.Marker checkMarker = builder.mark(); //point to begin of type or variable
|
||||
|
||||
if (TypeSpec.parse(builder, false) == fail) { //if type wasn't recognized trying parse VaribleDeclaration
|
||||
if (TypeSpec.parse(builder, false) == fail) { //if type wasn't recognized trying parse VariableDeclaration
|
||||
checkMarker.rollbackTo();
|
||||
|
||||
if (isInAnnotation) {
|
||||
@@ -83,14 +113,9 @@ public class Declaration implements GroovyElementTypes {
|
||||
IElementType varDecl = VariableDefinitions.parse(builder, isInClass, modifiersParsed, parser);
|
||||
|
||||
if (WRONGWAY.equals(varDecl)) {
|
||||
declMarker.rollbackTo();
|
||||
builder.error(GroovyBundle.message("variable.definitions.expected"));
|
||||
return false;
|
||||
} else {
|
||||
declMarker.done(varDecl);
|
||||
return true;
|
||||
return WRONGWAY;
|
||||
}
|
||||
|
||||
return varDecl;
|
||||
} else { //type was recognized, identifier here
|
||||
//starts after type
|
||||
IElementType varDeclarationTop = VariableDefinitions.parse(builder, isInClass, modifiersParsed, false, parser);
|
||||
@@ -106,17 +131,13 @@ public class Declaration implements GroovyElementTypes {
|
||||
IElementType varDecl = VariableDefinitions.parse(builder, isInClass, modifiersParsed, false, parser);
|
||||
|
||||
if (WRONGWAY.equals(varDecl)) {
|
||||
builder.error(GroovyBundle.message("variable.definitions.expected"));
|
||||
declMarker.rollbackTo();
|
||||
return false;
|
||||
return WRONGWAY;
|
||||
} else {
|
||||
declMarker.done(varDecl);
|
||||
return true;
|
||||
return varDecl;
|
||||
}
|
||||
} else {
|
||||
checkMarker.drop();
|
||||
declMarker.done(varDeclarationTop);
|
||||
return true;
|
||||
return varDeclarationTop;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -130,8 +151,7 @@ public class Declaration implements GroovyElementTypes {
|
||||
&& (Character.isLowerCase((text.charAt(0))) || !Character.isLetter(text.charAt(0))) &&
|
||||
(ParserUtils.lookAhead(builder, mIDENT, mIDENT) || ParserUtils.lookAhead(builder, mIDENT, mLPAREN))) {
|
||||
//call expression
|
||||
declMarker.rollbackTo();
|
||||
return false;
|
||||
return WRONGWAY;
|
||||
}
|
||||
|
||||
boolean typeParsed = false;
|
||||
@@ -140,22 +160,18 @@ public class Declaration implements GroovyElementTypes {
|
||||
//type specification starts with upper case letter
|
||||
if (!typeParsed) {
|
||||
builder.error(GroovyBundle.message("type.specification.expected"));
|
||||
declMarker.rollbackTo();
|
||||
return false;
|
||||
return WRONGWAY;
|
||||
}
|
||||
}
|
||||
|
||||
IElementType varDef = VariableDefinitions.parseDefinitions(builder, isInClass, false, false, false, typeParsed, false, parser);
|
||||
if (varDef != WRONGWAY) {
|
||||
declMarker.done(varDef);
|
||||
return true;
|
||||
return varDef;
|
||||
} else if (isInClass && typeParsed) {
|
||||
declMarker.drop();
|
||||
return typeParsed;
|
||||
return typeParsed ? null : WRONGWAY;
|
||||
}
|
||||
|
||||
declMarker.rollbackTo();
|
||||
return false;
|
||||
return WRONGWAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -40,15 +40,18 @@ public class ImportStatement implements GroovyElementTypes {
|
||||
impMarker.rollbackTo();
|
||||
return false;
|
||||
}
|
||||
|
||||
parseAfterModifiers(builder);
|
||||
impMarker.done(IMPORT_STATEMENT);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void parseAfterModifiers(PsiBuilder builder) {
|
||||
ParserUtils.getToken(builder, kIMPORT, GroovyBundle.message("import.keyword.expected"));
|
||||
ParserUtils.getToken(builder, kSTATIC);
|
||||
if (!ImportReference.parse(builder)) {
|
||||
builder.error(GroovyBundle.message("import.identifier.expected"));
|
||||
}
|
||||
|
||||
impMarker.done(IMPORT_STATEMENT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+18
-10
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.typeDef.AnnotationDefinition;
|
||||
@@ -41,27 +42,34 @@ public class TypeDefinition implements GroovyElementTypes {
|
||||
public static boolean parse(PsiBuilder builder, GroovyParser parser) {
|
||||
PsiBuilder.Marker tdMarker = builder.mark();
|
||||
Modifiers.parse(builder, parser);
|
||||
|
||||
final IElementType tdType = parseAfterModifiers(builder, parser);
|
||||
if (tdType == WRONGWAY) {
|
||||
tdMarker.rollbackTo();
|
||||
return false;
|
||||
}
|
||||
|
||||
tdMarker.done(tdType);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static IElementType parseAfterModifiers(PsiBuilder builder, GroovyParser parser) {
|
||||
if (builder.getTokenType() == kCLASS && ClassDefinition.parse(builder, parser)) {
|
||||
tdMarker.done(CLASS_DEFINITION);
|
||||
return true;
|
||||
return CLASS_DEFINITION;
|
||||
}
|
||||
|
||||
if (builder.getTokenType() == kINTERFACE && InterfaceDefinition.parse(builder, parser)) {
|
||||
tdMarker.done(INTERFACE_DEFINITION);
|
||||
return true;
|
||||
return INTERFACE_DEFINITION;
|
||||
}
|
||||
|
||||
if (builder.getTokenType() == kENUM && EnumDefinition.parse(builder, parser)) {
|
||||
tdMarker.done(ENUM_DEFINITION);
|
||||
return true;
|
||||
return ENUM_DEFINITION;
|
||||
}
|
||||
|
||||
if (builder.getTokenType() == mAT && AnnotationDefinition.parse(builder, parser)) {
|
||||
tdMarker.done(ANNOTATION_DEFINITION);
|
||||
return true;
|
||||
return ANNOTATION_DEFINITION;
|
||||
}
|
||||
|
||||
tdMarker.rollbackTo();
|
||||
return false;
|
||||
return WRONGWAY;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.ThrowClause;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.annotations.Annotation;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers.Modifier;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers.Modifiers;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.parameters.ParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.constructor.ConstructorBody;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
|
||||
@@ -87,7 +87,7 @@ public class ConstructorDefinition implements GroovyElementTypes {
|
||||
return false;
|
||||
}
|
||||
ParserUtils.getToken(builder, mNLS);
|
||||
} while(Annotation.parse(builder, parser) || Modifier.parse(builder));
|
||||
} while(Annotation.parse(builder, parser) || Modifiers.parseModifier(builder));
|
||||
|
||||
modifiersMarker.done(MODIFIERS);
|
||||
return true;
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
|
||||
@@ -348,21 +347,5 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest(new GroovyAssignabilityCheckInspection());
|
||||
}
|
||||
|
||||
public void testCodeBlockReparse() throws IOException {
|
||||
myFixture.configureByText("a.groovy", "foo 'a', {<caret>}");
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
final String psiBefore = DebugUtil.psiToString(myFixture.getFile(), false);
|
||||
|
||||
myFixture.type('\n');
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
final String psiAfter = DebugUtil.psiToString(myFixture.getFile(), false);
|
||||
|
||||
myFixture.configureByText("a.txt", psiBefore);
|
||||
myFixture.checkResultByFile(getTestName(false) + "1.txt");
|
||||
|
||||
myFixture.configureByText("a.txt", psiAfter);
|
||||
myFixture.checkResultByFile(getTestName(false) + "2.txt");
|
||||
}
|
||||
|
||||
public void testDuplicatedNamedArgs() {doTest();}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package org.jetbrains.plugins.groovy.lang.parser
|
||||
|
||||
import com.intellij.psi.impl.DebugUtil
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
class GroovyReparseTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "reparse/";
|
||||
}
|
||||
|
||||
void checkReparse(String text, String type) {
|
||||
myFixture.configureByText("a.groovy", text);
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
final String psiBefore = DebugUtil.psiToString(myFixture.getFile(), false);
|
||||
|
||||
myFixture.type(type);
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
final String psiAfter = DebugUtil.psiToString(myFixture.getFile(), false);
|
||||
|
||||
myFixture.configureByText("a.txt", psiBefore);
|
||||
myFixture.checkResultByFile(getTestName(false) + "_before.txt");
|
||||
|
||||
myFixture.configureByText("a.txt", psiAfter);
|
||||
myFixture.checkResultByFile(getTestName(false) + "_after.txt");
|
||||
}
|
||||
|
||||
public void testCodeBlockReparse() throws IOException {
|
||||
checkReparse("foo 'a', {<caret>}", '\n')
|
||||
}
|
||||
|
||||
public void testSwitchCaseIf() throws Exception {
|
||||
checkReparse """
|
||||
def foo() {
|
||||
switch(x) {
|
||||
case 2:
|
||||
<caret>return 2
|
||||
}
|
||||
}
|
||||
""", "if "
|
||||
}
|
||||
|
||||
public void testSwitchCaseDef() throws Exception {
|
||||
checkReparse """
|
||||
def foo() {
|
||||
switch(x) {
|
||||
case 2:
|
||||
<caret>return 2
|
||||
}
|
||||
}
|
||||
""", "def "
|
||||
}
|
||||
|
||||
public void testSwitchCaseFor() throws Exception {
|
||||
checkReparse """
|
||||
def foo() {
|
||||
switch(x) {
|
||||
case 2:
|
||||
<caret>return 2
|
||||
}
|
||||
}
|
||||
""", "for "
|
||||
}
|
||||
public void testSwitchCaseWhile() throws Exception {
|
||||
checkReparse """
|
||||
def foo() {
|
||||
switch(x) {
|
||||
case 2:
|
||||
<caret>return 2
|
||||
}
|
||||
}
|
||||
""", "while "
|
||||
}
|
||||
public void testSwitchCaseDo() throws Exception {
|
||||
checkReparse """
|
||||
def foo() {
|
||||
switch(x) {
|
||||
case 2:
|
||||
<caret>return 2
|
||||
}
|
||||
}
|
||||
""", "do "
|
||||
}
|
||||
public void testSwitchCaseSwitch() throws Exception {
|
||||
checkReparse """
|
||||
def foo() {
|
||||
switch(x) {
|
||||
case 2:
|
||||
<caret>return 2
|
||||
}
|
||||
}
|
||||
""", "switch "
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
def final
|
||||
def final
|
||||
-----
|
||||
Groovy script
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(final)('final')
|
||||
PsiWhiteSpace(' ')
|
||||
Variable definitions
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(final)('final')
|
||||
PsiErrorElement:Identifier, string literal or '(' expected
|
||||
<empty list>
|
||||
@@ -27,8 +27,6 @@ Groovy script
|
||||
PsiElement(>)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('t')
|
||||
PsiErrorElement:';', '}' or new line expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiErrorElement:';', '}' or new line expected
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
if expr1 expr2 else expr3
|
||||
-----
|
||||
Groovy script
|
||||
PsiElement(if)('if')
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
IF statement
|
||||
PsiElement(if)('if')
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(identifier)('expr1')
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
def ((a))
|
||||
-----
|
||||
Groovy script
|
||||
Variable definitions
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(()('(')
|
||||
PsiElement(()('(')
|
||||
PsiElement(identifier)('a')
|
||||
|
||||
+6
-2
@@ -1,9 +1,13 @@
|
||||
def ((a,b),c)=[[1,2],3]
|
||||
-----
|
||||
Groovy script
|
||||
Variable definitions
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(()('(')
|
||||
PsiElement(()('(')
|
||||
PsiElement(identifier)('a')
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
Variable definitions
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiErrorElement:Identifier, string literal or '(' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,44 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,47 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
Reference expression
|
||||
PsiElement(identifier)('do')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,44 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,49 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
For statement
|
||||
PsiElement(for)('for')
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,44 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,49 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
IF statement
|
||||
PsiElement(if)('if')
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,44 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,49 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,44 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,49 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
WHILE statement
|
||||
PsiElement(while)('while')
|
||||
PsiErrorElement:'(' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
@@ -0,0 +1,44 @@
|
||||
Groovy script
|
||||
PsiElement(new line)('\n ')
|
||||
Method
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('foo')
|
||||
PsiElement(()('(')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Throw clause
|
||||
<empty list>
|
||||
Open block
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Switch statement
|
||||
PsiElement(switch)('switch')
|
||||
PsiElement(()('(')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement({)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
Case section
|
||||
Case label
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n ')
|
||||
RETURN statement
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiElement(})('}')
|
||||
PsiElement(new line)('\n')
|
||||
Reference in New Issue
Block a user