diff --git a/platform/lang-api/src/com/intellij/lexer/StringLiteralLexer.java b/platform/lang-api/src/com/intellij/lexer/StringLiteralLexer.java
index e308da55bf58..574f6e1f9b0a 100644
--- a/platform/lang-api/src/com/intellij/lexer/StringLiteralLexer.java
+++ b/platform/lang-api/src/com/intellij/lexer/StringLiteralLexer.java
@@ -16,6 +16,7 @@
package com.intellij.lexer;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.StringEscapesTokenTypes;
import com.intellij.psi.tree.IElementType;
@@ -91,10 +92,6 @@ public class StringLiteralLexer extends LexerBase {
return myLastState;
}
- private static boolean isHexDigit(char c) {
- return c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F';
- }
-
public IElementType getTokenType() {
if (myStart >= myEnd) return null;
@@ -113,14 +110,14 @@ public class StringLiteralLexer extends LexerBase {
}
if (nextChar == 'u') {
for(int i = myStart + 2; i < myStart + 6; i++) {
- if (i >= myEnd || !isHexDigit(myBuffer.charAt(i))) return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
+ if (i >= myEnd || !StringUtil.isHexDigit(myBuffer.charAt(i))) return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
}
return StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN;
}
if (nextChar == 'x' && myAllowHex) {
for(int i = myStart + 2; i < myStart + 4; i++) {
- if (i >= myEnd || !isHexDigit(myBuffer.charAt(i))) return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
+ if (i >= myEnd || !StringUtil.isHexDigit(myBuffer.charAt(i))) return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
}
return StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
index 975f0af1eee3..1b128501eeb8 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
@@ -56,9 +56,8 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
}
String elementMarker = tokenizer.nextToken();
if (TOP_LEVEL_CHILD_MARKER.equals(elementMarker)) {
- PsiElement[] children = file.getChildren();
PsiElement result = null;
- for (PsiElement child : children) {
+ for (PsiElement child = file.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child instanceof PsiWhiteSpace) {
continue;
}
@@ -69,7 +68,7 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
if (processingInfoStorage != null) {
processingInfoStorage.append(String.format(
"Stopping '%s' provider because it has top level marker but more than one non white-space child: %s",
- getClass().getName(), Arrays.toString(children)
+ getClass().getName(), Arrays.toString(file.getChildren())
));
}
// More than one top-level non-white space children. Can't match.
@@ -79,7 +78,7 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
if (processingInfoStorage != null) {
processingInfoStorage.append(String.format(
"Finished processing of '%s' provider because all of its top-level children have been processed: %s",
- getClass().getName(), Arrays.toString(children)
+ getClass().getName(), Arrays.toString(file.getChildren())
));
}
return result;
@@ -89,7 +88,7 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
return candidate instanceof PsiComment ? candidate : null;
}
else if (CODE_BLOCK_MARKER.equals(elementMarker)) {
- for (PsiElement child : parent.getChildren()) {
+ for (PsiElement child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
PsiElement firstChild = child.getFirstChild();
PsiElement lastChild = child.getLastChild();
if (firstChild != null && lastChild != null && "{".equals(firstChild.getText()) && "}".equals(lastChild.getText())) {
@@ -145,7 +144,7 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
if (parent == null) {
return false;
}
- for (PsiElement child : parent.getChildren()) {
+ for (PsiElement child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child instanceof PsiWhiteSpace) {
continue;
}
diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
index 86fae1651a18..1fb72208c642 100644
--- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * 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.
@@ -681,6 +681,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
// deal with width
final int width = Math.max(editorSize.width, historySize.width);
newEditorSize.width = width + editor.getScrollPane().getHorizontalScrollBar().getHeight();
+ editor.getSoftWrapModel().forceAdditionalColumnsUsage();
editor.getSettings().setAdditionalColumnsCount(2 + (width - editorSize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, editor));
history.getSettings().setAdditionalColumnsCount(2 + (width - historySize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, history));
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java
index 4acb456762fb..383fe632f1e0 100644
--- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java
+++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java
@@ -16,6 +16,7 @@
package com.intellij.ide.highlighter.custom.tokens;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.CustomHighlighterTokenType;
/**
@@ -28,15 +29,11 @@ public class HexNumberParser extends PrefixedTokenParser {
protected int getTokenEnd(int position) {
for (; position < myEndOffset; position++) {
- if (!isHexDigit(myBuffer.charAt(position))) break;
+ if (!StringUtil.isHexDigit(myBuffer.charAt(position))) break;
}
return position;
}
- public static boolean isHexDigit(char c) {
- return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
- }
-
public static HexNumberParser create(String prefix) {
if (prefix == null) return null;
final String trimmedPrefix = prefix.trim();
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java
index fcbfc8262cab..4e8d60bc753a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java
@@ -118,4 +118,48 @@ public interface SoftWrapModelEx extends SoftWrapModel {
/** Asks the model to completely recalculate soft wraps. */
void recalculate();
+
+ /**
+ * IJ editor defines a notion of {@link EditorSettings#getAdditionalColumnsCount() additional columns}. They define additional
+ * amount of space to be used during editor component's width calculation (IJ editor perform 'preventive UI component expansion'
+ * when user types near the right edge).
+ *
+ * The main idea of soft wraps is to avoid horizontal scrolling, however, there is a possible case that particular line
+ * of text can't be soft-wrapped, i.e. we need to show horizontal scroll bar. So, we have the following use-cases:
+ *
+ *
+ * -
+ * Long line is soft-wrapped.
+ *
+ * Example:
+ *
+ * this a long lin[caret] |<-- viewport's edge
+ *
+ * As soon as 'e' is typed, soft wrapping is performed and 'line' word is displayed at the next visual line, we need
+ * not to consider {@link EditorSettings#getAdditionalColumnsCount() additional columns} during width recalculation;
+ *
+ * -
+ * Long line can't be soft-wrapped
+ *
+ *
Example:
+ * thisisaratherlonglin[caret]|<-- viewport's edge
+ *
+ * When 'e' is typed we need to increase component's width and use
+ * {@link EditorSettings#getAdditionalColumnsCount() additional columns} for its calculation;
+ *
+ *
+ *
+ * This method allows to answer if {@link EditorSettings#getAdditionalColumnsCount() additional columns} should be used
+ * during editor component's width calculation.
+ *
+ * @return true if {@link EditorSettings#getAdditionalColumnsCount() additional columns} should be used
+ * during editor component's width recalculation;
+ * false otherwise
+ */
+ boolean isRespectAdditionalColumns();
+
+ /**
+ * Allows to instruct current model to always return 'true' from {@link #isRespectAdditionalColumns()}.
+ */
+ void forceAdditionalColumnsUsage();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
index 6ecddea85a1e..98f8edf25419 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
@@ -434,10 +434,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myScrollingModel = new ScrollingModelImpl(this);
- if (mySettings.isUseSoftWraps()) {
- mySettings.setAdditionalColumnsCount(0);
- }
-
myGutterComponent.updateSize();
Dimension preferredSize = getPreferredSize();
myEditorComponent.setSize(preferredSize);
@@ -3108,7 +3104,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
final Dimension draft = getSizeWithoutCaret();
- final int additionalSpace = mySettings.getAdditionalColumnsCount() * EditorUtil.getSpaceWidth(Font.PLAIN, this);
+ final int additionalSpace = mySoftWrapModel.isRespectAdditionalColumns()
+ ? mySettings.getAdditionalColumnsCount() * EditorUtil.getSpaceWidth(Font.PLAIN, this)
+ : 0;
if (!myDocument.isInBulkUpdate() && getCaretModel().isUpToDate()) {
int caretX = visualPositionToXY(getCaretModel().getVisualPosition()).x;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java
index a5bd5249b417..5fffa314c808 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -173,7 +173,7 @@ public class ScrollingModelImpl implements ScrollingModelEx {
hOffset = targetLocation.x - 4 * spaceWidth;
hOffset = hOffset > 0 ? hOffset : 0;
}
- else if (targetLocation.x > viewRect.x + viewRect.width) {
+ else if (targetLocation.x >= viewRect.x + viewRect.width) {
hOffset = targetLocation.x - viewRect.width + xInsets;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
index 74c0dc309a23..e7916cc79493 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
@@ -98,19 +98,6 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
private boolean myUseSoftWraps;
private int myTabWidth = -1;
- /**
- * Standard IJ editor starts showing horizontal scroll bar event when text line ends couple of symbols before the right visual
- * area edge (exact value of columns to use for such preliminary scrolling is identified by
- * {@link EditorSettings#getAdditionalColumnsCount() additionalColumnsCount} value).
- *
- * However, we want to avoid using horizontal scrolling within soft wraps whenever possible. Hence, we set that additional
- * columns property to zero when soft wraps are used and restore it if soft wraps are turned off.
- *
- * Current field holds initial 'additional columns count' property value that is to be restored if
- * soft wraps are turned off.
- */
- private int myAdditionalColumnsCount;
-
/**
* Soft wraps need to be kept up-to-date on all editor modification (changing text, adding/removing/expanding/collapsing fold
* regions etc). Hence, we need to react to all types of target changes. However, soft wraps processing uses various information
@@ -132,6 +119,8 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
* Current field serves as a flag for that 'dirty document, need complete soft wraps cache recalculation' state.
*/
private boolean myDirty;
+
+ private boolean myForceAdditionalColumns;
public SoftWrapModelImpl(@NotNull EditorEx editor) {
this(editor, new SoftWrapsStorage(), new CompositeSoftWrapPainter(editor));
@@ -183,7 +172,6 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
}
});
EditorSettings settings = myEditor.getSettings();
- myAdditionalColumnsCount = settings.getAdditionalColumnsCount();
myUseSoftWraps = settings.isUseSoftWraps();
editor.addPropertyChangeListener(this);
@@ -200,18 +188,11 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
int tabWidthBefore = myTabWidth;
myTabWidth = getCurrentTabWidth();
- if ((myUseSoftWraps && (!softWrapsUsedBefore || settings.getAdditionalColumnsCount() > 0))
- || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore))
- {
+ if ((myUseSoftWraps ^ softWrapsUsedBefore) || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore)) {
myApplianceManager.reset();
myDeferredFoldRegions.clear();
- myAdditionalColumnsCount = settings.getAdditionalColumnsCount();
- settings.setAdditionalColumnsCount(0);
+ myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
- else if (!myUseSoftWraps && softWrapsUsedBefore) {
- settings.setAdditionalColumnsCount(myAdditionalColumnsCount);
- }
- myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
/**
@@ -227,7 +208,17 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
final CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(file.getFileType());
return indentOptions.TAB_SIZE;
}
-
+
+ @Override
+ public boolean isRespectAdditionalColumns() {
+ return myForceAdditionalColumns || myApplianceManager.hasLinesWithFailedWrap();
+ }
+
+ @Override
+ public void forceAdditionalColumnsUsage() {
+ myForceAdditionalColumns = true;
+ }
+
@Override
public boolean isSoftWrappingEnabled() {
if (!myUseSoftWraps || myEditor.isOneLineMode()) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
index a7c9172c552d..b9d800cbafb8 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
@@ -97,6 +97,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
private int myCustomIndentValueUsedLastTime;
private int myVisibleAreaWidth;
private boolean myInProgress;
+ private boolean myHasLinesWithFailedWrap;
public SoftWrapApplianceManager(@NotNull SoftWrapsStorage storage,
@NotNull EditorEx editor,
@@ -111,6 +112,15 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
myWidthProvider = new DefaultVisibleAreaWidthProvider(editor);
}
+ /**
+ * @return true if soft wraps processing detected line(s) that exceeds viewport's size but can't be soft-wrapped;
+ * i.e. part of it lays outside of the screen;
+ * false otherwise
+ */
+ public boolean hasLinesWithFailedWrap() {
+ return myHasLinesWithFailedWrap;
+ }
+
public void registerSoftWrapIfNecessary() {
recalculateIfNecessary();
}
@@ -163,6 +173,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
myActiveEvents.addAll(events);
myEventsStorage.release();
myInProgress = true;
+ myHasLinesWithFailedWrap = false;
try {
for (IncrementalCacheUpdateEvent event : events) {
recalculateSoftWraps(event);
@@ -457,6 +468,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
);
if (softWrap == null) {
myContext.tryToShiftToNextLine();
+ myHasLinesWithFailedWrap = true;
return;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
index 846de538f668..8d203c82592b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
@@ -36,7 +36,10 @@ import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.ui.popup.StackingPopupDispatcher;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.registry.Registry;
-import com.intellij.openapi.wm.*;
+import com.intellij.openapi.wm.FocusCommand;
+import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.openapi.wm.KeyEventProcessor;
+import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.LayoutFocusTraversalPolicyExt;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
@@ -45,6 +48,9 @@ import com.intellij.ui.AppUIUtil;
import com.intellij.ui.FocusTrackback;
import com.intellij.ui.ScreenUtil;
import com.intellij.ui.SpeedSearchBase;
+import com.intellij.ui.mac.foundation.Foundation;
+import com.intellij.ui.mac.foundation.ID;
+import com.intellij.ui.mac.foundation.MacUtil;
import com.intellij.ui.popup.StackingPopupDispatcherImpl;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
@@ -681,6 +687,25 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
}
}
+ if (SystemInfo.isMacOSLion) {
+ final WindowAdapter macFullScreenPatchListener = new WindowAdapter() {
+ @Override
+ public void windowOpened(WindowEvent e) {
+ Window window = e.getWindow();
+ if (window instanceof Dialog) {
+ ID _native = MacUtil.findWindowForTitle(((Dialog)window).getTitle());
+ if (_native != null && _native.intValue() > 0) {
+ // see MacMainFrameDecorator
+ // NSCollectionBehaviorFullScreenAuxiliary = 1 << 8
+ Foundation.invoke(_native, "setCollectionBehavior:", 1 << 8);
+ }
+ }
+ }
+ };
+
+ addWindowListener(macFullScreenPatchListener);
+ }
+
super.show();
}
diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
index d5cb1834086f..24a42c481a60 100644
--- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
@@ -2213,4 +2213,12 @@ public class StringUtil {
m.appendTail(result);
return result.toString();
}
+
+ public static boolean isHexDigit(char c) {
+ return '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F';
+ }
+
+ public static boolean isOctalDigit(char c) {
+ return '0' <= c && c <= '7';
+ }
}
diff --git a/plugins/android/src/org/jetbrains/android/AndroidGotoDeclarationHandler.java b/plugins/android/src/org/jetbrains/android/AndroidGotoDeclarationHandler.java
index c4135dbbe143..8a3dd17f6c9c 100644
--- a/plugins/android/src/org/jetbrains/android/AndroidGotoDeclarationHandler.java
+++ b/plugins/android/src/org/jetbrains/android/AndroidGotoDeclarationHandler.java
@@ -16,9 +16,14 @@
package org.jetbrains.android;
import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler;
+import com.intellij.navigation.NavigationItem;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.*;
+import com.intellij.psi.meta.PsiMetaOwner;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.xml.XmlAttributeValue;
+import org.jetbrains.android.dom.wrappers.FileResourceElementWrapper;
+import org.jetbrains.android.dom.wrappers.ValueResourceElementWrapper;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.util.AndroidResourceUtil;
@@ -55,6 +60,23 @@ public class AndroidGotoDeclarationHandler implements GotoDeclarationHandler {
}
final PsiElement[] resources = AndroidResourceUtil.findResources(resolvedField);
- return resources.length > 0 ? resources : null;
+ final PsiElement[] wrappedResources = new PsiElement[resources.length];
+
+ for (int i = 0; i < resources.length; i++) {
+ final PsiElement resource = resources[i];
+
+ if (resource instanceof XmlAttributeValue &&
+ resource instanceof PsiMetaOwner &&
+ resource instanceof NavigationItem) {
+ wrappedResources[i] = new ValueResourceElementWrapper((XmlAttributeValue)resource);
+ }
+ else if (resource instanceof PsiFile) {
+ wrappedResources[i] = new FileResourceElementWrapper((PsiFile)resource);
+ }
+ else {
+ wrappedResources[i] = resource;
+ }
+ }
+ return wrappedResources.length > 0 ? wrappedResources : null;
}
}
diff --git a/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java b/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
index 4c2f09049869..063ce71d1244 100644
--- a/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
+++ b/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
@@ -35,14 +35,13 @@ import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.DependencyScope;
-import com.intellij.openapi.roots.ModifiableRootModel;
-import com.intellij.openapi.roots.ModuleOrderEntry;
+import com.intellij.openapi.roots.*;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.ExternalChangeAction;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiManager;
@@ -91,6 +90,21 @@ public class AndroidModuleBuilder extends JavaModuleBuilder {
rootModel.setSdk(mySdk);
+ final LanguageLevelModuleExtension moduleExt = rootModel.getModuleExtension(LanguageLevelModuleExtension.class);
+
+ if (moduleExt != null) {
+ LanguageLevel languageLevel = moduleExt.getLanguageLevel();
+ if (languageLevel == null) {
+ final LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(rootModel.getProject());
+ if (projectExt != null) {
+ languageLevel = projectExt.getLanguageLevel();
+ }
+ }
+ if (languageLevel == LanguageLevel.JDK_1_3) {
+ moduleExt.setLanguageLevel(LanguageLevel.JDK_1_5);
+ }
+ }
+
VirtualFile[] files = rootModel.getContentRoots();
if (files.length > 0) {
final VirtualFile contentRoot = files[0];
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/remote/GradleApiFacadeManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/remote/GradleApiFacadeManager.java
index e12a2c24eaac..b6dc845c8547 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/remote/GradleApiFacadeManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/remote/GradleApiFacadeManager.java
@@ -65,6 +65,8 @@ public class GradleApiFacadeManager {
private final AtomicReference> myFacade
= new AtomicReference>();
+ private final AtomicReference myExportedProgressManager
+ = new AtomicReference();
private final GradleLibraryManager myGradleLibraryManager;
private final RemoteGradleProgressNotificationManager myProgressManager;
@@ -110,7 +112,7 @@ public class GradleApiFacadeManager {
Collection gradleLibraries = myGradleLibraryManager.getAllLibraries(null);
GradleLog.LOG.assertTrue(gradleLibraries != null, GradleBundle.message("gradle.generic.text.error.sdk.undefined"));
if (gradleLibraries == null) {
- return null;
+ throw new ExecutionException("Can't find gradle libraries");
}
final SimpleJavaParameters params = new SimpleJavaParameters();
@@ -230,7 +232,16 @@ public class GradleApiFacadeManager {
return myFacade.get().first;
}
result.applySettings(getRemoteSettings());
- RemoteGradleProgressNotificationManager exported = (RemoteGradleProgressNotificationManager)UnicastRemoteObject.exportObject(myProgressManager, 0);
+ RemoteGradleProgressNotificationManager exported = myExportedProgressManager.get();
+ if (exported == null) {
+ try {
+ exported = (RemoteGradleProgressNotificationManager)UnicastRemoteObject.exportObject(myProgressManager, 0);
+ myExportedProgressManager.set(exported);
+ }
+ catch (RemoteException e) {
+ exported = myExportedProgressManager.get();
+ }
+ }
if (exported == null) {
GradleLog.LOG.warn("Can't export progress manager");
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
index 1f31f6b5780b..8a2545cef8c6 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
@@ -261,7 +261,7 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
PsiElement refNameElement = referenceExpression.getReferenceNameElement();
if (refNameElement != null && referenceExpression.getQualifier() == null) {
final IElementType type = refNameElement.getNode().getElementType();
- if (type == GroovyTokenTypes.mGSTRING_LITERAL || type == GroovyTokenTypes.mSTRING_LITERAL) return false;
+ if (TokenSets.STRING_LITERAL_SET.contains(type)) return false;
}
if (!GroovyUnresolvedHighlightFilter.shouldHighlight(referenceExpression)) return false;
@@ -831,12 +831,21 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
@Override
public void visitLiteralExpression(GrLiteral literal) {
- String text = literal.getText();
- checkStringLiteral(literal, text);
+ final IElementType elementType = literal.getFirstChild().getNode().getElementType();
+ if (elementType == GroovyTokenTypes.mSTRING_LITERAL || elementType == GroovyTokenTypes.mGSTRING_LITERAL) {
+ checkStringLiteral(literal, literal.getText());
+ }
+ else if (elementType == GroovyTokenTypes.mREGEX_LITERAL || elementType == GroovyTokenTypes.mDOLLAR_SLASH_REGEX_LITERAL) {
+ checkRegexLiteral(literal.getFirstChild());
+ }
}
@Override
public void visitRegexExpression(GrRegex regex) {
+ checkRegexLiteral(regex);
+ }
+
+ private void checkRegexLiteral(PsiElement regex) {
String text = regex.getText();
String quote = GrStringUtil.getStartQuote(text);
@@ -856,7 +865,16 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
}
}
- for (String part : regex.getTextParts()) {
+
+ String[] parts;
+ if (regex instanceof GrRegex) {
+ parts = ((GrRegex)regex).getTextParts();
+ }
+ else {
+ parts = new String[]{regex.getFirstChild().getNextSibling().getText()};
+ }
+
+ for (String part : parts) {
if (!GrStringUtil.parseRegexCharacters(part, new StringBuilder(part.length()), null, regex.getText().startsWith("/"))) {
myHolder.createErrorAnnotation(regex, GroovyBundle.message("illegal.escape.character.in.string.literal"));
return;
@@ -873,13 +891,12 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
}
}
- if (regex.getInjections().length > 0) {
+ if (regex instanceof GrRegex && ((GrRegex)regex).getInjections().length > 0) {
if (!config.isVersionAtLeast(regex, GroovyConfigUtils.GROOVY1_8)) {
myHolder.createErrorAnnotation(regex, GroovyBundle
.message("slashy.strings.with.injections.are.not.allowed.in.groovy.0", config.getSDKVersion(regex)));
}
}
-
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyLiteralSelectioner.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyLiteralSelectioner.java
index 3ee29f9cf451..bc3db214428f 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyLiteralSelectioner.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyLiteralSelectioner.java
@@ -21,9 +21,9 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
+import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrRegex;
import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
import java.util.List;
@@ -43,13 +43,12 @@ public class GroovyLiteralSelectioner extends GroovyBasicSelectioner {
if (element instanceof GrListOrMap) return true;
if (!(element instanceof GrLiteral)) return false;
- if (element instanceof GrRegex && ((GrRegex)element).getInjections().length == 0) return true;
ASTNode node = element.getNode();
if (node == null) return false;
ASTNode firstNode = node.getFirstChildNode();
final IElementType type = firstNode.getElementType();
- return firstNode == node.getLastChildNode() && (type == mSTRING_LITERAL || type == mGSTRING_LITERAL);
+ return firstNode == node.getLastChildNode() && TokenSets.STRING_LITERAL_SET.contains(type);
}
public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyWordSelectionFilter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyWordSelectionFilter.java
index a9e0530ebbe1..2f946f54f7a7 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyWordSelectionFilter.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyWordSelectionFilter.java
@@ -40,6 +40,8 @@ public class GroovyWordSelectionFilter implements Condition {
type == mSTRING_LITERAL ||
type == mGSTRING_LITERAL ||
type == mGSTRING_CONTENT ||
+ type == mREGEX_LITERAL ||
+ type == mDOLLAR_SLASH_REGEX_LITERAL ||
type == mGDOC_COMMENT_DATA ||
type == mGDOC_TAG_NAME ||
type == mGDOC_TAG_PLAIN_VALUE_TOKEN ||
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java
index 0fd33ed83f58..a3419ae2a7c4 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/processors/GroovySpacingProcessorBasic.java
@@ -182,9 +182,11 @@ public abstract class GroovySpacingProcessorBasic extends SpacingTokens implemen
}
// For Gstrings and regexes
- if (leftNode.getPsi().getParent() != null &&
- leftNode.getPsi().getParent().equals(rightNode.getPsi().getParent()) &&
- leftNode.getPsi().getParent() instanceof GrString) {
+ if (left.getParent() != null &&
+ left.getParent().equals(right.getParent()) &&
+ (left.getParent() instanceof GrString ||
+ leftNode.getTreeParent().getElementType() == mREGEX_LITERAL ||
+ leftNode.getTreeParent().getElementType() == mDOLLAR_SLASH_REGEX_LITERAL)) {
return NO_SPACING;
}
if (isDollarInGStringInjection(leftNode) || isDollarInGStringInjection(rightNode)) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovySlashyStringLexer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovySlashyStringLexer.java
index 82ef61fa447b..3718f1219882 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovySlashyStringLexer.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/GroovySlashyStringLexer.java
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.groovy.highlighter;
import com.intellij.lexer.LexerBase;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.StringEscapesTokenTypes;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.Nullable;
@@ -48,18 +49,30 @@ public class GroovySlashyStringLexer extends LexerBase {
if (myEnd >= myBufferEnd) return null;
myStart = myEnd;
- if (checkForEscape(myStart)) {
+ if (checkForSlashEscape(myStart)) {
myEnd = myStart + 2;
return StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN;
}
+ else if (checkForHexCodeStart(myStart)) {
+ for (myEnd = myStart + 2; myEnd < myStart + 6; myEnd++) {
+ if (myEnd >= myBufferEnd || !StringUtil.isHexDigit(myBuffer.charAt(myEnd))) {
+ return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
+ }
+ }
+ return StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN;
+ }
- while (myEnd < myBufferEnd && !checkForEscape(myEnd)) myEnd++;
+ while (myEnd < myBufferEnd && !checkForSlashEscape(myEnd) && !checkForHexCodeStart(myEnd)) myEnd++;
return GroovyTokenTypes.mREGEX_CONTENT;
}
- private boolean checkForEscape(int start) {
+ private boolean checkForSlashEscape(int start) {
return myBuffer.charAt(start) == '\\' && start + 1 < myBufferEnd && myBuffer.charAt(start + 1) == '/';
}
+
+ private boolean checkForHexCodeStart(int start) {
+ return myBuffer.charAt(start) == '\\' && start + 1 < myBufferEnd && myBuffer.charAt(start + 1) == 'u';
+ }
@Override
public int getState() {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/GroovyTokenTypes.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/GroovyTokenTypes.java
index 65489558aed4..92df6f6649ea 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/GroovyTokenTypes.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/GroovyTokenTypes.java
@@ -76,10 +76,13 @@ public interface GroovyTokenTypes extends GroovyDocElementTypes {
IElementType mREGEX_BEGIN = new GroovyElementType("regex begin");
IElementType mREGEX_CONTENT = new GroovyElementType("regex content");
IElementType mREGEX_END = new GroovyElementType("regex end");
+ IElementType mREGEX_LITERAL = new GroovyElementType("regex literal");
IElementType mDOLLAR_SLASH_REGEX_BEGIN = new GroovyElementType("$/ regex begin");
IElementType mDOLLAR_SLASH_REGEX_CONTENT = new GroovyElementType("$/ regex content");
IElementType mDOLLAR_SLASH_REGEX_END = new GroovyElementType("$/ regex end");
+ IElementType mDOLLAR_SLASH_REGEX_LITERAL = new GroovyElementType("$/ regex literal");
+
/* **************************************************************************************************
* Common tokens: operators, braces etc.
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java
index 623b870704e7..11f8c4068597 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/TokenSets.java
@@ -68,7 +68,9 @@ public abstract class TokenSets {
kFALSE,
kNULL,
mSTRING_LITERAL,
- mGSTRING_LITERAL
+ mGSTRING_LITERAL,
+ mREGEX_LITERAL,
+ mDOLLAR_SLASH_REGEX_LITERAL
);
public static final TokenSet BUILT_IN_TYPE = TokenSet.create(
@@ -83,7 +85,8 @@ public abstract class TokenSets {
kDOUBLE
);
- public static final TokenSet PROPERTY_NAMES = TokenSet.create(mIDENT, mSTRING_LITERAL, mGSTRING_LITERAL);
+ public static final TokenSet PROPERTY_NAMES =
+ TokenSet.create(mIDENT, mSTRING_LITERAL, mGSTRING_LITERAL, mREGEX_LITERAL, mDOLLAR_SLASH_REGEX_LITERAL);
public static final TokenSet KEYWORDS = TokenSet.create(kABSTRACT, kAS, kASSERT, kBOOLEAN, kBREAK, kBYTE, kCASE, kCATCH, kCHAR, kCLASS,
kCONTINUE, kDEF, kDEFAULT, kDO, kDOUBLE, kELSE, kEXTENDS, kENUM, kFALSE, kFINAL,
@@ -126,7 +129,9 @@ public abstract class TokenSets {
mGSTRING_LITERAL,
mGSTRING_CONTENT,
mGSTRING_BEGIN,
- mGSTRING_END
+ mGSTRING_END,
+ mREGEX_LITERAL,
+ mDOLLAR_SLASH_REGEX_LITERAL
);
public static TokenSet FOR_IN_DELIMITERS = TokenSet.create(kIN, mCOLON);
@@ -142,7 +147,7 @@ public abstract class TokenSets {
public static final TokenSet COMMENT_SET = TokenSet.create(mML_COMMENT, mSH_COMMENT, mSL_COMMENT, GROOVY_DOC_COMMENT);
- public static final TokenSet STRING_LITERAL_SET = TokenSet.create(mSTRING_LITERAL, mGSTRING_LITERAL);
+ public static final TokenSet STRING_LITERAL_SET = TokenSet.create(mSTRING_LITERAL, mGSTRING_LITERAL, mREGEX_LITERAL, mDOLLAR_SLASH_REGEX_LITERAL);
public static final TokenSet BRACES = TokenSet.create(mLBRACK, mRBRACK, mLPAREN, mRPAREN, mLCURLY, mRCURLY);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java
index 48a537bd8dfb..bcde7ee1d842 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyParserDefinition.java
@@ -101,7 +101,13 @@ public class GroovyParserDefinition implements ParserDefinition {
}
final IElementType parentType = left.getTreeParent().getElementType();
- if (parentType == GSTRING || parentType == REGEX || parentType == GSTRING_INJECTION) return MUST_NOT;
+ if (parentType == GSTRING ||
+ parentType == REGEX ||
+ parentType == GSTRING_INJECTION ||
+ parentType == mREGEX_LITERAL ||
+ parentType == mDOLLAR_SLASH_REGEX_LITERAL) {
+ return MUST_NOT;
+ }
return LanguageUtil.canStickTokensTogetherByLexer(left, right, new GroovyLexer());
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyPsiCreator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyPsiCreator.java
index d1e22babb37d..4cc19b43574e 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyPsiCreator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/GroovyPsiCreator.java
@@ -24,7 +24,7 @@ import org.jetbrains.plugins.groovy.lang.groovydoc.lexer.IGroovyDocElementType;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.GroovyDocPsiCreator;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyASTPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.GrLabelImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.GrListOrMapImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.GrThrowsClauseImpl;
@@ -250,7 +250,8 @@ public class GroovyPsiCreator implements GroovyElementTypes {
if (elem == SPREAD_ARGUMENT) return new GrSpreadArgumentImpl(node);
if (elem == ARGUMENT_LABEL) return new GrArgumentLabelImpl(node);
- if (elem == BALANCED_BRACKETS) return new GroovyPsiElementImpl(node){};
+ if (elem == BALANCED_BRACKETS) return new GroovyASTPsiElementImpl(node);
+ if (elem == mREGEX_LITERAL || elem == mDOLLAR_SLASH_REGEX_LITERAL) return new GroovyASTPsiElementImpl(node);
return new ASTWrapperPsiElement(node);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/arithmetic/PathExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/arithmetic/PathExpression.java
index 45500d00a401..feb2427e66eb 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/arithmetic/PathExpression.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/arithmetic/PathExpression.java
@@ -233,10 +233,10 @@ public class PathExpression implements GroovyElementTypes {
return PATH_PROPERTY_REFERENCE;
}
if (mREGEX_BEGIN.equals(tokenType)) {
- return RegexConstructorExpression.parse(builder, parser) ? PATH_PROPERTY_REFERENCE : REFERENCE_EXPRESSION;
+ return RegexConstructorExpression.parse(builder, parser, true) ? PATH_PROPERTY_REFERENCE : REFERENCE_EXPRESSION;
}
if (mDOLLAR_SLASH_REGEX_BEGIN.equals(tokenType)) {
- return DollarSlashRegexConstructorExpression.parse(builder, parser) ? PATH_PROPERTY_REFERENCE : REFERENCE_EXPRESSION;
+ return DollarSlashRegexConstructorExpression.parse(builder, parser, true) ? PATH_PROPERTY_REFERENCE : REFERENCE_EXPRESSION;
}
if (mLCURLY.equals(tokenType)) {
OpenOrClosableBlock.parseOpenBlock(builder, parser);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/DollarSlashRegexConstructorExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/DollarSlashRegexConstructorExpression.java
index 3a745d324708..b3819deafdef 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/DollarSlashRegexConstructorExpression.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/DollarSlashRegexConstructorExpression.java
@@ -23,9 +23,14 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.blocks.OpenOr
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.arithmetic.PathExpression;
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
-import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.*;
-import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.GSTRING_INJECTION;
-import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.REGEX;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mDOLLAR;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mDOLLAR_SLASH_REGEX_BEGIN;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mDOLLAR_SLASH_REGEX_END;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mDOLLAR_SLASH_REGEX_LITERAL;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mIDENT;
+import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mLCURLY;
+import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.*;
/**
* @author Max Medvedev
@@ -33,8 +38,9 @@ import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.REGEX;
public class DollarSlashRegexConstructorExpression {
private static final Logger LOG = Logger.getInstance(DollarSlashRegexConstructorExpression.class);
- public static boolean parse(PsiBuilder builder, GroovyParser parser) {
+ public static boolean parse(PsiBuilder builder, GroovyParser parser, boolean forRefExpr) {
PsiBuilder.Marker marker = builder.mark();
+ final PsiBuilder.Marker marker2 = builder.mark();
final boolean result = ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_BEGIN);
LOG.assertTrue(result);
@@ -48,7 +54,20 @@ public class DollarSlashRegexConstructorExpression {
if (!ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_END)) {
builder.error(GroovyBundle.message("dollar.slash.end.expected"));
}
- marker.done(REGEX);
+
+ if (inj) {
+ marker2.drop();
+ marker.done(REGEX);
+ }
+ else {
+ marker2.done(mDOLLAR_SLASH_REGEX_LITERAL);
+ if (forRefExpr) {
+ marker.drop();
+ }
+ else {
+ marker.done(LITERAL);
+ }
+ }
return inj;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/PrimaryExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/PrimaryExpression.java
index eb04353f7a2f..9fdf7265f8c4 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/PrimaryExpression.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/PrimaryExpression.java
@@ -69,11 +69,11 @@ public class PrimaryExpression implements GroovyElementTypes {
return StringConstructorExpression.parse(builder, parser);
}
if (mREGEX_BEGIN == tokenType) {
- RegexConstructorExpression.parse(builder, parser);
+ RegexConstructorExpression.parse(builder, parser, false);
return REGEX;
}
if (mDOLLAR_SLASH_REGEX_BEGIN == tokenType) {
- DollarSlashRegexConstructorExpression.parse(builder, parser);
+ DollarSlashRegexConstructorExpression.parse(builder, parser, false);
return REGEX;
}
if (mLBRACK == tokenType) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/RegexConstructorExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/RegexConstructorExpression.java
index b74b218412a9..21407282c7c8 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/RegexConstructorExpression.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/RegexConstructorExpression.java
@@ -34,8 +34,9 @@ public class RegexConstructorExpression implements GroovyElementTypes {
/**
* @return true if there are any injections
*/
- public static boolean parse(PsiBuilder builder, GroovyParser parser) {
+ public static boolean parse(PsiBuilder builder, GroovyParser parser, boolean forRefExpr) {
PsiBuilder.Marker marker = builder.mark();
+ final PsiBuilder.Marker marker2 = builder.mark();
final boolean result = ParserUtils.getToken(builder, mREGEX_BEGIN);
LOG.assertTrue(result);
@@ -49,7 +50,20 @@ public class RegexConstructorExpression implements GroovyElementTypes {
if (!ParserUtils.getToken(builder, mREGEX_END)) {
builder.error(GroovyBundle.message("regex.end.expected"));
}
- marker.done(REGEX);
+
+ if (inj) {
+ marker2.drop();
+ marker.done(REGEX);
+ }
+ else {
+ marker2.done(mREGEX_LITERAL);
+ if (forRefExpr) {
+ marker.drop();
+ }
+ else {
+ marker.done(LITERAL);
+ }
+ }
return inj;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyASTPsiElementImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyASTPsiElementImpl.java
new file mode 100644
index 000000000000..ab6610ea4f21
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyASTPsiElementImpl.java
@@ -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.
+ */
+package org.jetbrains.plugins.groovy.lang.psi.impl;
+
+import com.intellij.lang.ASTNode;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Max Medvedev
+ */
+public class GroovyASTPsiElementImpl extends GroovyPsiElementImpl {
+ public GroovyASTPsiElementImpl(@NotNull ASTNode node) {
+ super(node);
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
index 1fa360b6d49d..d22b0d669e6f 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
@@ -52,7 +52,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrAc
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList;
import org.jetbrains.plugins.groovy.lang.psi.impl.*;
-import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
+import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.literals.GrLiteralImpl;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
@@ -371,8 +371,11 @@ public class GrReferenceExpressionImpl extends GrReferenceElementImpl {
@@ -34,7 +36,18 @@ public class GrLiteralEscaper extends LiteralTextEscaper {
ProperTextRange.assertProperRange(rangeInsideHost);
String subText = rangeInsideHost.substring(myHost.getText());
outSourceOffsets = new int[subText.length() + 1];
- return GrStringUtil.parseStringCharacters(subText, outChars, outSourceOffsets);
+
+ final IElementType elementType = myHost.getFirstChild().getNode().getElementType();
+ if (elementType == GroovyTokenTypes.mSTRING_LITERAL || elementType == GroovyTokenTypes.mGSTRING_LITERAL) {
+ return GrStringUtil.parseStringCharacters(subText, outChars, outSourceOffsets);
+ }
+ else if (elementType == GroovyTokenTypes.mREGEX_LITERAL) {
+ return GrStringUtil.parseRegexCharacters(subText, outChars, outSourceOffsets, true);
+ }
+ else if (elementType == GroovyTokenTypes.mDOLLAR_SLASH_REGEX_LITERAL) {
+ return GrStringUtil.parseRegexCharacters(subText, outChars, outSourceOffsets, false);
+ }
+ else return false;
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrLiteralImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrLiteralImpl.java
index a51a480e5255..4cf5acd77074 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrLiteralImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrLiteralImpl.java
@@ -122,6 +122,27 @@ public class GrLiteralImpl extends GrAbstractLiteral implements GrLiteral, PsiLa
boolean result = GrStringUtil.parseStringCharacters(text, chars, null);
return result ? chars.toString() : null;
}
+ else if (elemType == mREGEX_LITERAL) {
+ final PsiElement cchild = child.getFirstChild();
+ if (cchild == null) return null;
+ final PsiElement sibling = cchild.getNextSibling();
+ if (sibling == null) return null;
+ text = sibling.getText();
+ final StringBuilder chars = new StringBuilder(text.length());
+ boolean result = GrStringUtil.parseRegexCharacters(text, chars, null, true);
+ return result ? chars.toString() : null;
+ }
+ else if (elemType == mDOLLAR_SLASH_REGEX_LITERAL) {
+ final PsiElement cchild = child.getFirstChild();
+ if (cchild == null) return null;
+ final PsiElement sibling = cchild.getNextSibling();
+ if (sibling == null) return null;
+ text = sibling.getText();
+ final StringBuilder chars = new StringBuilder(text.length());
+ boolean result = GrStringUtil.parseRegexCharacters(text, chars, null, false);
+ return result ? chars.toString() : null;
+ }
+
return null;
}
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/path/regexp.test b/plugins/groovy/testdata/parsing/groovy/expressions/path/regexp.test
index 330bf7ac6e3b..39825cd44675 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/path/regexp.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/path/regexp.test
@@ -9,12 +9,12 @@ Groovy script
Reference expression
PsiElement(identifier)('a')
PsiElement(.)('.')
- Compound regular expression
+ GroovyASTPsiElementImpl($/ regex literal)
PsiElement($/ regex begin)('$/')
PsiElement($/ regex content)('dfg')
PsiElement($/ regex end)('/$')
PsiElement(.)('.')
- Compound regular expression
+ GroovyASTPsiElementImpl(regex literal)
PsiElement(regex begin)('/')
PsiElement(regex content)('fg')
PsiElement(regex end)('/')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509err.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509err.test
index 7b874d92e5c0..17e8c7e481fb 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509err.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509err.test
@@ -1,8 +1,9 @@
/$1\/
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('$1\/')
- PsiErrorElement:Regex ending expected
-
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('$1\/')
+ PsiErrorElement:Regex ending expected
+
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509norm.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509norm.test
index d6b54d6c0608..5fda919514f7 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509norm.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509norm.test
@@ -1,7 +1,8 @@
/$1\//
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('$1\/')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('$1\/')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509test.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509test.test
index 3a0ad173a4ed..ce2a368f4d44 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509test.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/GRVY-1509test.test
@@ -1,7 +1,8 @@
/\//
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('\/')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('\/')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/chen.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/chen.test
index 3cc5730c0b8c..31ed3e9b1f07 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/chen.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/chen.test
@@ -17,10 +17,11 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=~)('=~')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('[;\/\?:@&=\+\$,%-\.]')
- PsiElement(regex end)('/')
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('[;\/\?:@&=\+\$,%-\.]')
+ PsiElement(regex end)('/')
PsiElement())(')')
PsiElement(.)('.')
PsiElement(identifier)('replaceAll')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy3.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy3.test
index 12a6ccd595cf..50531423299a 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy3.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy3.test
@@ -10,6 +10,7 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex end)('/$')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex end)('/$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy4.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy4.test
index f7cb6fac643e..771148d83003 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy4.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashy4.test
@@ -10,7 +10,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)('$')
- PsiElement($/ regex end)('/$')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)('$')
+ PsiElement($/ regex end)('/$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyDouble.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyDouble.test
index 80f108554eae..2d9420cc92f6 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyDouble.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyDouble.test
@@ -19,10 +19,11 @@ Groovy script
PsiElement({)('{')
Parameter list
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)(' a ')
- PsiElement($/ regex end)('/$')
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)(' a ')
+ PsiElement($/ regex end)('/$')
PsiElement(})('}')
PsiElement($/ regex content)(' ')
GString injection
@@ -31,10 +32,11 @@ Groovy script
PsiElement({)('{')
Parameter list
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)(' b ')
- PsiElement($/ regex end)('/$')
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)(' b ')
+ PsiElement($/ regex end)('/$')
PsiElement(})('}')
PsiElement($/ regex content)(' ')
PsiElement($/ regex end)('/$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyEof.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyEof.test
index 7072ddd6d88f..fd25456c4b83 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyEof.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyEof.test
@@ -10,7 +10,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiErrorElement:Dollar slash ending expected
-
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiErrorElement:Dollar slash ending expected
+
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegex.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegex.test
index 5a834f89e701..79ade82fd7ba 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegex.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegex.test
@@ -16,7 +16,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)('(?x) # enable whitespace and comments\n((?:19|20)\d\d) # year (group 1) (non-capture alternation for century)\n[- /.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /.] # seperator\n(0[1-9]|[12][0-9]|3[01]) # day (group 3)\n')
- PsiElement($/ regex end)('/$')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)('(?x) # enable whitespace and comments\n((?:19|20)\d\d) # year (group 1) (non-capture alternation for century)\n[- /.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /.] # seperator\n(0[1-9]|[12][0-9]|3[01]) # day (group 3)\n')
+ PsiElement($/ regex end)('/$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexFinishedTwice.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexFinishedTwice.test
index 6a8f88ba3bf5..133ee8cc5a2e 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexFinishedTwice.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexFinishedTwice.test
@@ -17,10 +17,11 @@ Groovy script
PsiElement(=)('=')
PsiWhiteSpace(' ')
Multiplicative expression
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)('(?x) # enable whitespace and comments\n((?:19|20)\d\d) # year (group 1) (non-capture alternation for century)\n[- /.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /.] # seperator\n(0[1-9]|[12][0-9]|3[01]) # day (group 3)\n')
- PsiElement($/ regex end)('/$')
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)('(?x) # enable whitespace and comments\n((?:19|20)\d\d) # year (group 1) (non-capture alternation for century)\n[- /.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /.] # seperator\n(0[1-9]|[12][0-9]|3[01]) # day (group 3)\n')
+ PsiElement($/ regex end)('/$')
PsiElement(/)('/')
Reference expression
PsiElement(identifier)('$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexUnfinished.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexUnfinished.test
index 8d2d8bf42086..23ee5a945a6d 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexUnfinished.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyRegexUnfinished.test
@@ -15,8 +15,9 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)('(?x) # enable whitespace and comments\n((?:19|20)\d\d) # year (group 1) (non-capture alternation for century)\n[- /.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /.] # seperator\n(0[1-9]|[12][0-9]|3[01]) # day (group 3)')
- PsiErrorElement:Dollar slash ending expected
-
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)('(?x) # enable whitespace and comments\n((?:19|20)\d\d) # year (group 1) (non-capture alternation for century)\n[- /.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /.] # seperator\n(0[1-9]|[12][0-9]|3[01]) # day (group 3)')
+ PsiErrorElement:Dollar slash ending expected
+
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyTriple.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyTriple.test
index fe1987b08030..7ead05705417 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyTriple.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyTriple.test
@@ -19,10 +19,11 @@ Groovy script
PsiElement({)('{')
Parameter list
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)(' a ')
- PsiElement($/ regex end)('/$')
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)(' a ')
+ PsiElement($/ regex end)('/$')
PsiElement(})('}')
PsiElement($/ regex content)(' ')
GString injection
@@ -45,10 +46,11 @@ Groovy script
PsiElement({)('{')
Parameter list
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)(' c ')
- PsiElement($/ regex end)('/$')
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)(' c ')
+ PsiElement($/ regex end)('/$')
PsiElement(})('}')
PsiElement($/ regex content)(' ')
PsiElement($/ regex end)('/$')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyWindowsPaths.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyWindowsPaths.test
index ab217d4f1895..24bb150b2c4b 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyWindowsPaths.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/dollarSlashyWindowsPaths.test
@@ -10,7 +10,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)('C:\temp\')
- PsiElement($/ regex end)('/$')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)('C:\temp\')
+ PsiElement($/ regex end)('/$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/multiLineSlashy.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/multiLineSlashy.test
index 334e67225f59..16dbf07b178e 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/multiLineSlashy.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/multiLineSlashy.test
@@ -14,7 +14,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('\nto be\nor\nnot to be\n')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('\nto be\nor\nnot to be\n')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex1.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex1.test
index 116f56020dd5..d31f6057e145 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex1.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex1.test
@@ -7,7 +7,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('abc')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('abc')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex10.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex10.test
index d7802962bb1d..a5b0daa2e1a4 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex10.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex10.test
@@ -40,7 +40,7 @@ Groovy script
Reference expression
PsiElement(identifier)('frg')
PsiElement(.)('.')
- Compound regular expression
+ GroovyASTPsiElementImpl(regex literal)
PsiElement(regex begin)('/')
PsiElement(regex content)('sdf')
PsiElement(regex end)('/')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex11.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex11.test
index f6ea6556eb3a..9d5475c7443a 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex11.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex11.test
@@ -7,10 +7,11 @@ Groovy script
Reference expression
PsiElement(identifier)('i')
PsiElement(=)('=')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('ab \\ncd')
- PsiElement(regex end)('/')
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('ab \\ncd')
+ PsiElement(regex end)('/')
PsiElement(new line)('\n')
Assignment expression
Reference expression
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex12.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex12.test
index 205264d123e2..791eab6674c6 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex12.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex12.test
@@ -2,7 +2,8 @@
-----
Groovy script
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('abc')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('abc')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex14.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex14.test
index 46b67f7a2f37..f3cd6cc319fd 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex14.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex14.test
@@ -19,10 +19,11 @@ Groovy script
PsiElement({)('{')
Parameter list
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('bugaga')
- PsiElement(regex end)('/')
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('bugaga')
+ PsiElement(regex end)('/')
PsiElement(})('}')
PsiElement(regex content)(' asd')
PsiElement(regex end)('/')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex15.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex15.test
index 8ff76918f76d..9f82dff2cf54 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex15.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex15.test
@@ -1,7 +1,8 @@
/$/
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('$')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('$')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex16.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex16.test
index 1437c0ef8bb3..f48806ce95d0 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex16.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex16.test
@@ -1,8 +1,9 @@
/$
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement($)('$')
- PsiErrorElement:Regex ending expected
-
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement($)('$')
+ PsiErrorElement:Regex ending expected
+
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex17.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex17.test
index fc5d4d5cb3cf..dc9e3c5b20c7 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex17.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex17.test
@@ -1,7 +1,8 @@
/sgfdhj$5dhfg/
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('sgfdhj$5dhfg')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('sgfdhj$5dhfg')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex18.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex18.test
index 0eac54134bb3..d7bcbc7bec40 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex18.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex18.test
@@ -1,7 +1,8 @@
/gsdfjk$ gsdkf$ $/
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('gsdfjk$ gsdkf$ $')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('gsdfjk$ gsdkf$ $')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex2.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex2.test
index 3a49c08f1b8c..3c1f0d92b0d4 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex2.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex2.test
@@ -30,7 +30,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('abc')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('abc')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex20.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex20.test
index 8a3cb97f8480..0bf2f1449f6c 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex20.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex20.test
@@ -7,8 +7,9 @@ Groovy script
PsiWhiteSpace(' ')
Arguments
PsiElement(()('(')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('a\${2}')
- PsiElement(regex end)('/')
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('a\${2}')
+ PsiElement(regex end)('/')
PsiElement())(')')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex21.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex21.test
index 5dd23aee9910..b1f4b878dc0f 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex21.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex21.test
@@ -1,7 +1,8 @@
$/abc/$
-----
Groovy script
- Compound regular expression
- PsiElement($/ regex begin)('$/')
- PsiElement($/ regex content)('abc')
- PsiElement($/ regex end)('/$')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl($/ regex literal)
+ PsiElement($/ regex begin)('$/')
+ PsiElement($/ regex content)('abc')
+ PsiElement($/ regex end)('/$')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex3.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex3.test
index 3bc0a6154976..4a9cbe3e7c62 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex3.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex3.test
@@ -1,7 +1,8 @@
/abc/
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('abc')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('abc')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex33.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex33.test
index cc69a5399931..da37f6ea391d 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex33.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex33.test
@@ -7,7 +7,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('abs$$$')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('abs$$$')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex4.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex4.test
index d78e463629cf..e2ef008b6fa0 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex4.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex4.test
@@ -3,10 +3,11 @@
-----
Groovy script
Call expression
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('asd\n')
- PsiElement(regex end)('/')
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('asd\n')
+ PsiElement(regex end)('/')
Command arguments
Reference expression
PsiElement(identifier)('abcdef')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex5.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex5.test
index de6bbd6bf311..edffeb4bc43a 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex5.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex5.test
@@ -13,7 +13,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=~)('=~')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('o(b.*r)f')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('o(b.*r)f')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex6.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex6.test
index b25028ce0a1f..c222776f335f 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex6.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex6.test
@@ -13,7 +13,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=~)('=~')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('\$(.*)\.')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('\$(.*)\.')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex8.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex8.test
index 601e09b3cd4c..c53a01ec74b5 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex8.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex8.test
@@ -56,7 +56,7 @@ Groovy script
Reference expression
PsiElement(identifier)('frg')
PsiElement(.)('.')
- Compound regular expression
+ GroovyASTPsiElementImpl(regex literal)
PsiElement(regex begin)('/')
PsiElement(regex content)('sdf')
PsiElement(regex end)('/')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex9.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex9.test
index 14231157069a..524b555dbc21 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex9.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex9.test
@@ -57,7 +57,7 @@ Groovy script
Reference expression
PsiElement(identifier)('frg')
PsiElement(.)('.')
- Compound regular expression
+ GroovyASTPsiElementImpl(regex literal)
PsiElement(regex begin)('/')
PsiElement(regex content)('sdf')
PsiElement(regex end)('/')
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin.test
index 9d41ab359bff..4961101949f8 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin.test
@@ -1,7 +1,8 @@
/temp_regex/
-----
Groovy script
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('temp_regex')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('temp_regex')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin2.test b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin2.test
index 73ca75cffe71..d43476fdc694 100644
--- a/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin2.test
+++ b/plugins/groovy/testdata/parsing/groovy/expressions/regex/regex_begin2.test
@@ -2,7 +2,8 @@
-----
Groovy script
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('temp_regex')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('temp_regex')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/statements/king_regex/king1.test b/plugins/groovy/testdata/parsing/groovy/statements/king_regex/king1.test
index 91974aa1c956..bf4b33e66239 100644
--- a/plugins/groovy/testdata/parsing/groovy/statements/king_regex/king1.test
+++ b/plugins/groovy/testdata/parsing/groovy/statements/king_regex/king1.test
@@ -10,7 +10,8 @@ Groovy script
PsiWhiteSpace(' ')
PsiElement(=)('=')
PsiWhiteSpace(' ')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('I cost $$@$@$$')
- PsiElement(regex end)('/')
\ No newline at end of file
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('I cost $$@$@$$')
+ PsiElement(regex end)('/')
\ No newline at end of file
diff --git a/plugins/groovy/testdata/parsing/groovy/statements/switch/swit2.test b/plugins/groovy/testdata/parsing/groovy/statements/switch/swit2.test
index e286f04dc183..a260d4845a2f 100644
--- a/plugins/groovy/testdata/parsing/groovy/statements/switch/swit2.test
+++ b/plugins/groovy/testdata/parsing/groovy/statements/switch/swit2.test
@@ -18,10 +18,11 @@ Groovy script
PsiWhiteSpace(' ')
Unary expression
PsiElement(~)('~')
- Compound regular expression
- PsiElement(regex begin)('/')
- PsiElement(regex content)('....')
- PsiElement(regex end)('/')
+ Literal
+ GroovyASTPsiElementImpl(regex literal)
+ PsiElement(regex begin)('/')
+ PsiElement(regex content)('....')
+ PsiElement(regex end)('/')
PsiWhiteSpace(' ')
PsiElement(:)(':')
PsiElement(new line)('\n')