mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
regex & dollar-slash literals
This commit is contained in:
@@ -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
|
||||
|
||||
+2
-3
@@ -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<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
|
||||
|
||||
+2
@@ -40,6 +40,8 @@ public class GroovyWordSelectionFilter implements Condition<PsiElement> {
|
||||
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 ||
|
||||
|
||||
+5
-3
@@ -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)) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+7
-1
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+24
-5
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+16
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+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.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
+6
-3
@@ -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<GrExpressi
|
||||
PsiElement nameElement = getReferenceNameElement();
|
||||
if (nameElement != null) {
|
||||
IElementType nodeType = nameElement.getNode().getElementType();
|
||||
if (nodeType == mSTRING_LITERAL || nodeType == mGSTRING_LITERAL) {
|
||||
return GrStringUtil.removeQuotes(nameElement.getText());
|
||||
if (TokenSets.STRING_LITERAL_SET.contains(nodeType)) {
|
||||
final Object value = GrLiteralImpl.getLiteralValue(nameElement);
|
||||
if (value instanceof String) {
|
||||
return (String)value;
|
||||
}
|
||||
}
|
||||
|
||||
return nameElement.getText();
|
||||
|
||||
+2
@@ -110,6 +110,8 @@ public class TypesUtil {
|
||||
static {
|
||||
ourPrimitiveTypesToClassNames.put(mSTRING_LITERAL, JAVA_LANG_STRING);
|
||||
ourPrimitiveTypesToClassNames.put(mGSTRING_LITERAL, JAVA_LANG_STRING);
|
||||
ourPrimitiveTypesToClassNames.put(mREGEX_LITERAL, JAVA_LANG_STRING);
|
||||
ourPrimitiveTypesToClassNames.put(mDOLLAR_SLASH_REGEX_LITERAL, JAVA_LANG_STRING);
|
||||
ourPrimitiveTypesToClassNames.put(mNUM_INT, JAVA_LANG_INTEGER);
|
||||
ourPrimitiveTypesToClassNames.put(mNUM_LONG, JAVA_LANG_LONG);
|
||||
ourPrimitiveTypesToClassNames.put(mNUM_FLOAT, JAVA_LANG_FLOAT);
|
||||
|
||||
+14
-1
@@ -19,7 +19,9 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.litera
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
|
||||
|
||||
public class GrLiteralEscaper extends LiteralTextEscaper<GrLiteralImpl> {
|
||||
@@ -34,7 +36,18 @@ public class GrLiteralEscaper extends LiteralTextEscaper<GrLiteralImpl> {
|
||||
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
|
||||
|
||||
+21
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)('/')
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/$1\/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$1\/')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$1\/')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
+5
-4
@@ -1,7 +1,8 @@
|
||||
/$1\//
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$1\/')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$1\/')
|
||||
PsiElement(regex end)('/')
|
||||
+5
-4
@@ -1,7 +1,8 @@
|
||||
/\//
|
||||
-----
|
||||
Groovy script
|
||||
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)('/')
|
||||
@@ -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')
|
||||
|
||||
+4
-3
@@ -10,6 +10,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex end)('/$')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl($/ regex literal)
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+5
-4
@@ -10,7 +10,8 @@ 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)('/$')
|
||||
+10
-8
@@ -19,10 +19,11 @@ Groovy script
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty 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
|
||||
<empty 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)('/$')
|
||||
+5
-4
@@ -10,7 +10,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiErrorElement:Dollar slash ending expected
|
||||
<empty list>
|
||||
Literal
|
||||
GroovyASTPsiElementImpl($/ regex literal)
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiErrorElement:Dollar slash ending expected
|
||||
<empty list>
|
||||
+5
-4
@@ -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)('/$')
|
||||
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)('/$')
|
||||
Vendored
+5
-4
@@ -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)('$')
|
||||
+6
-5
@@ -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
|
||||
<empty list>
|
||||
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
|
||||
<empty list>
|
||||
+10
-8
@@ -19,10 +19,11 @@ Groovy script
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty 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
|
||||
<empty 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)('/$')
|
||||
|
||||
+5
-4
@@ -10,7 +10,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('C:\temp\')
|
||||
PsiElement($/ regex end)('/$')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl($/ regex literal)
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('C:\temp\')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+5
-4
@@ -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)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('\nto be\nor\nnot to be\n')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -7,7 +7,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -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)('/')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
-----
|
||||
Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -19,10 +19,11 @@ Groovy script
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty 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)('/')
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/$/
|
||||
-----
|
||||
Groovy script
|
||||
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)('/')
|
||||
@@ -1,8 +1,9 @@
|
||||
/$
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement($)('$')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement($)('$')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
@@ -1,7 +1,8 @@
|
||||
/sgfdhj$5dhfg/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('sgfdhj$5dhfg')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('sgfdhj$5dhfg')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -1,7 +1,8 @@
|
||||
/gsdfjk$ gsdkf$ $/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('gsdfjk$ gsdkf$ $')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('gsdfjk$ gsdkf$ $')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -30,7 +30,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -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())(')')
|
||||
@@ -1,7 +1,8 @@
|
||||
$/abc/$
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('abc')
|
||||
PsiElement($/ regex end)('/$')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl($/ regex literal)
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('abc')
|
||||
PsiElement($/ regex end)('/$')
|
||||
@@ -1,7 +1,8 @@
|
||||
/abc/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -7,7 +7,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abs$$$')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abs$$$')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -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')
|
||||
@@ -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)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('o(b.*r)f')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -13,7 +13,8 @@ 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)('/')
|
||||
@@ -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)('/')
|
||||
|
||||
@@ -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)('/')
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/temp_regex/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('temp_regex')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('temp_regex')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -2,7 +2,8 @@
|
||||
-----
|
||||
Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('temp_regex')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('temp_regex')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -10,7 +10,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('I cost $$@$@$$')
|
||||
PsiElement(regex end)('/')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl(regex literal)
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('I cost $$@$@$$')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user