mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+1
-1
@@ -168,7 +168,7 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PsiElement findLiteralTokenType(PsiFile file, int selectionStart, int selectionEnd) {
|
||||
protected PsiElement findLiteralTokenType(PsiFile file, int selectionStart, int selectionEnd) {
|
||||
final PsiElement elementAtSelectionStart = file.findElementAt(selectionStart);
|
||||
if (elementAtSelectionStart == null) {
|
||||
return null;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.ether.dependencyView.ClassRepr;
|
||||
import org.jetbrains.ether.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.Module;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.PathUtil;
|
||||
import org.jetbrains.jps.incremental.storage.TimestampStorage;
|
||||
|
||||
import java.io.File;
|
||||
@@ -101,19 +102,35 @@ public abstract class Builder {
|
||||
return additionalPassRequired;
|
||||
}
|
||||
|
||||
private static boolean chunkContainsAffectedFiles(CompileContext context, ModuleChunk chunk, final Set<File> affected) throws Exception {
|
||||
final Ref<Boolean> result = new Ref<Boolean>(false);
|
||||
// todo: avoid calling processFiles to implement this logic
|
||||
context.processFiles(chunk, new FileProcessor() {
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
|
||||
if (affected.contains(file)) {
|
||||
result.set(true);
|
||||
return false;
|
||||
// delete all class files that according to mappings correspond to given sources
|
||||
public static void deleteCorrespondingClasses(CompileContext context, Collection<File> sources) {
|
||||
if (context.isMake() && !sources.isEmpty()) {
|
||||
final Mappings mappings = context.getMappings();
|
||||
for (File file : sources) {
|
||||
final Set<ClassRepr> classes = mappings.getClasses(FileUtil.toSystemIndependentName(file.getPath()));
|
||||
if (classes != null) {
|
||||
for (ClassRepr aClass : classes) {
|
||||
final String fileName = aClass.getFileName();
|
||||
if (fileName != null) {
|
||||
FileUtil.delete(new File(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean chunkContainsAffectedFiles(CompileContext context, ModuleChunk chunk, final Set<File> affected) throws Exception {
|
||||
final Set<File> chunkRoots = new HashSet<File>();
|
||||
for (String r : context.isCompilingTests() ? chunk.getTestRoots() : chunk.getSourceRoots()) {
|
||||
chunkRoots.add(new File(r));
|
||||
}
|
||||
for (File file : affected) {
|
||||
if (PathUtil.isUnder(chunkRoots, file)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return result.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Set<File> getAllAffectedFilesContainer(CompileContext context) {
|
||||
|
||||
@@ -4,14 +4,15 @@ import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.containers.SLRUCache;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.ether.dependencyView.ClassRepr;
|
||||
import org.jetbrains.ether.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.*;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
import org.jetbrains.jps.incremental.storage.BuildDataManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -28,7 +29,6 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
private final BuildDataManager myDataManager;
|
||||
private final Mappings myMappings;
|
||||
private final Set<Module> myDirtyModules = new HashSet<Module>();
|
||||
private final Map<Module, Collection<File>> myTempSourceRoots = new HashMap<Module, Collection<File>>();
|
||||
|
||||
private SLRUCache<Module, FSSnapshot> myFilesCache = new SLRUCache<Module, FSSnapshot>(10, 10) {
|
||||
@NotNull
|
||||
@@ -126,28 +126,14 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
|
||||
void setCompilingTests(boolean compilingTests) {
|
||||
myCompilingTests = compilingTests;
|
||||
myFilesCache.clear();
|
||||
for (Collection<File> roots : myTempSourceRoots.values()) {
|
||||
if (roots != null) {
|
||||
for (File root : roots) {
|
||||
FileUtil.delete(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
myTempSourceRoots.clear();
|
||||
myFilesCache.clear(); // todo: do we really need this?
|
||||
}
|
||||
|
||||
void onChunkBuildComplete(@NotNull ModuleChunk chunk) {
|
||||
myFilesCache.clear();
|
||||
myMappings.clearMemoryCaches();
|
||||
for (Module module : chunk.getModules()) {
|
||||
final Collection<File> roots = myTempSourceRoots.remove(module);
|
||||
if (roots != null) {
|
||||
for (File root : roots) {
|
||||
FileUtil.delete(root);
|
||||
}
|
||||
}
|
||||
myFilesCache.remove(module);
|
||||
}
|
||||
myMappings.clearMemoryCaches();
|
||||
}
|
||||
|
||||
public CompileScope getScope() {
|
||||
@@ -176,35 +162,6 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
return removed != null && !removed.isEmpty();
|
||||
}
|
||||
|
||||
// delete all class files that according to mappings correspond to given sources
|
||||
public void deleteCorrespondingClasses(Collection<File> sources) {
|
||||
if (isMake() && !sources.isEmpty()) {
|
||||
final Mappings mappings = getMappings();
|
||||
for (File file : sources) {
|
||||
final Set<ClassRepr> classes = mappings.getClasses(FileUtil.toSystemIndependentName(file.getPath()));
|
||||
if (classes != null) {
|
||||
for (ClassRepr aClass : classes) {
|
||||
final String fileName = aClass.getFileName();
|
||||
if (fileName != null) {
|
||||
FileUtil.delete(new File(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// assuming the root file exists
|
||||
public void registerTempSourceRoot(Module module, File root) {
|
||||
Collection<File> roots = myTempSourceRoots.get(module);
|
||||
if (roots == null) {
|
||||
roots = new HashSet<File>();
|
||||
myTempSourceRoots.put(module, roots);
|
||||
}
|
||||
roots.add(root);
|
||||
}
|
||||
|
||||
|
||||
/** @noinspection unchecked*/
|
||||
private FSSnapshot buildSnapshot(Module module) {
|
||||
final Set<File> excludes = new HashSet<File>();
|
||||
@@ -221,13 +178,6 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
buildStructure(root.getNode(), excludes);
|
||||
}
|
||||
}
|
||||
final Collection<File> tempRoots = myTempSourceRoots.get(module);
|
||||
if (tempRoots != null) {
|
||||
for (File tempRoot : tempRoots) {
|
||||
final FSSnapshot.Root root = snapshot.addRoot(tempRoot, FileUtil.toSystemIndependentName(tempRoot.getPath()));
|
||||
buildStructure(root.getNode(), excludes);
|
||||
}
|
||||
}
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.List;
|
||||
* Date: 10/8/11
|
||||
*/
|
||||
public class FSSnapshot {
|
||||
private static final Node[] EMPTY_NODE_ARRAY = new Node[0];
|
||||
|
||||
private final List<Root> myRoots = new ArrayList<Root>();
|
||||
private final Module myModule;
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import org.jetbrains.jps.Module;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 10/8/11
|
||||
*/
|
||||
public class FSSnapshotBuilder implements FileProcessor{
|
||||
private final FSSnapshot mySnapshot;
|
||||
|
||||
public FSSnapshotBuilder(Module module) {
|
||||
mySnapshot = new FSSnapshot(module);
|
||||
}
|
||||
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public FSSnapshot getResult() {
|
||||
return mySnapshot;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,9 @@ public class IncProjectBuilder {
|
||||
}
|
||||
|
||||
private void runBuild(CompileContext context) throws ProjectBuildException {
|
||||
cleanOutputRoots(context);
|
||||
if (!context.isMake()) {
|
||||
cleanOutputRoots(context);
|
||||
}
|
||||
|
||||
context.processMessage(new ProgressMessage("Running 'before' tasks"));
|
||||
runTasks(context, myBuilderRegistry.getBeforeTasks());
|
||||
@@ -127,29 +129,18 @@ public class IncProjectBuilder {
|
||||
private static void cleanOutputRoots(CompileContext context) throws ProjectBuildException {
|
||||
final CompileScope scope = context.getScope();
|
||||
final Collection<Module> allProjectModules = scope.getProject().getModules().values();
|
||||
final Collection<Module> modulesToClean = new HashSet<Module>();
|
||||
final Collection<Module> modulesToClean = new HashSet<Module>(scope.getAffectedModules());
|
||||
|
||||
if (context.isMake()) {
|
||||
for (Module module : scope.getAffectedModules()) {
|
||||
if (context.isDirty(module)) {
|
||||
modulesToClean.add(module);
|
||||
}
|
||||
final Set<Module> allModules = new HashSet<Module>(allProjectModules);
|
||||
allModules.removeAll(modulesToClean);
|
||||
if (allModules.isEmpty()) {
|
||||
// whole project is affected
|
||||
context.getBuildDataManager().clean();
|
||||
try {
|
||||
context.getMappings().clean();
|
||||
}
|
||||
}
|
||||
else {
|
||||
modulesToClean.addAll(scope.getAffectedModules());
|
||||
|
||||
final Set<Module> allModules = new HashSet<Module>(allProjectModules);
|
||||
allModules.removeAll(scope.getAffectedModules());
|
||||
if (allModules.isEmpty()) {
|
||||
// whole project is affected
|
||||
context.getBuildDataManager().clean();
|
||||
try {
|
||||
context.getMappings().clean();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ProjectBuildException(e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ProjectBuildException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,16 +218,13 @@ public class IncProjectBuilder {
|
||||
if (context.isMake()) {
|
||||
// cleanup outputs
|
||||
|
||||
// todo: use dirty and removed paths passed from IDEA instead of collecting all chunk sources
|
||||
final HashSet<File> allChunkSources = new HashSet<File>();
|
||||
context.processFiles(chunk, new FilesCollector(allChunkSources, FilesCollector.ALL_FILES));
|
||||
|
||||
// todo: use removed paths passed from IDEA?
|
||||
final OutputToSourceMapping storage = context.getBuildDataManager().getOutputToSourceStorage();
|
||||
final HashSet<File> allChunkRemovedSources = new HashSet<File>();
|
||||
for (Module module : chunk.getModules()) {
|
||||
final File moduleOutput = context.getProjectPaths().getModuleOutputDir(module, context.isCompilingTests());
|
||||
if (moduleOutput != null && moduleOutput.exists()) {
|
||||
deleteOutputsOfRemovedSources(moduleOutput, storage, allChunkSources, allChunkRemovedSources);
|
||||
deleteOutputsOfRemovedSources(moduleOutput, storage, allChunkRemovedSources);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,12 +269,12 @@ public class IncProjectBuilder {
|
||||
while (nextPassRequired);
|
||||
}
|
||||
|
||||
private static void deleteOutputsOfRemovedSources(File file, final OutputToSourceMapping outputToSourceStorage, Set<File> allChunkSources, Set<File> removedSources) throws Exception {
|
||||
private static void deleteOutputsOfRemovedSources(File file, final OutputToSourceMapping outputToSourceStorage, Set<File> removedSources) throws Exception {
|
||||
if (file.isDirectory()) {
|
||||
final File[] files = file.listFiles();
|
||||
if (files != null) {
|
||||
for (File child : files) {
|
||||
deleteOutputsOfRemovedSources(child, outputToSourceStorage, allChunkSources, removedSources);
|
||||
deleteOutputsOfRemovedSources(child, outputToSourceStorage, removedSources);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,9 +283,10 @@ public class IncProjectBuilder {
|
||||
final String srcPath = outputToSourceStorage.getState(outPath);
|
||||
if (srcPath != null) {
|
||||
// if we know about the association
|
||||
final File outputSource = new File(srcPath);
|
||||
if (!allChunkSources.contains(outputSource)) {
|
||||
removedSources.add(outputSource);
|
||||
final File srcFile = new File(srcPath);
|
||||
// todo: optimize
|
||||
if (!srcFile.exists()) {
|
||||
removedSources.add(srcFile);
|
||||
FileUtil.delete(file);
|
||||
outputToSourceStorage.remove(outPath);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class GroovyBuilder extends Builder {
|
||||
Arrays.<String>asList(myForStubs ? "stubs" : "groovyc", tempFile.getPath())
|
||||
);
|
||||
|
||||
context.deleteCorrespondingClasses(toCompile);
|
||||
deleteCorrespondingClasses(context, toCompile);
|
||||
|
||||
List<GroovycOSProcessHandler.OutputItem> successfullyCompiled = Collections.emptyList();
|
||||
try {
|
||||
|
||||
@@ -29,7 +29,8 @@ import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.commons.EmptyVisitor;
|
||||
|
||||
import javax.tools.*;
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -169,7 +170,7 @@ public class JavaBuilder extends Builder{
|
||||
}
|
||||
upToDateForms.clear();
|
||||
|
||||
context.deleteCorrespondingClasses(filesToCompile);
|
||||
deleteCorrespondingClasses(context, filesToCompile);
|
||||
|
||||
return compile(context, chunk, filesToCompile, formsToCompile);
|
||||
}
|
||||
|
||||
@@ -161,8 +161,6 @@
|
||||
<renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedFieldProcessor" order="first"/>
|
||||
<rename.inplace.resolveSnapshotProvider language="Groovy"
|
||||
implementationClass="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GroovyResolveSnapshotProvider"/>
|
||||
<!--<renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGrAccessorProcessor" order="first"/>-->
|
||||
|
||||
<nameSuggestionProvider implementation="org.jetbrains.plugins.groovy.refactoring.GroovyNameSuggestionProvider"/>
|
||||
|
||||
<statementUpDownMover implementation="org.jetbrains.plugins.groovy.lang.editor.actions.GroovyStatementMover"/>
|
||||
|
||||
@@ -16,47 +16,14 @@
|
||||
########################################################################################################################
|
||||
# Groovy script template
|
||||
########################################################################################################################
|
||||
error.file.already.exists=File with same name already exists
|
||||
|
||||
file.template.group.title.groovy=Groovy
|
||||
|
||||
newclass.dlg.title=New Groovy Class
|
||||
newclass.menu.action.text=Groovy Class
|
||||
newclass.menu.action.description=Creates new Groovy Class
|
||||
newclass.command.name=Create Groovy Class
|
||||
newclass.progress.text=Creating Groovy Class ''{0}''
|
||||
|
||||
newinterface.dlg.prompt=Enter name for new Groovy Interface
|
||||
newinterface.dlg.title=New Groovy Interface
|
||||
newinterface.menu.action.text=Groovy Interface
|
||||
newinterface.menu.action.description=Creates new Groovy Interface
|
||||
newinterface.command.name=Create Groovy Interface
|
||||
newinterface.progress.text=Creating Groovy Interface ''{0}''
|
||||
|
||||
newannot.dlg.prompt=Enter name for new Groovy Annotation
|
||||
newannot.dlg.title=New Groovy Annotation
|
||||
newannot.menu.action.text=Groovy Annotation
|
||||
newannot.menu.action.description=Creates new Groovy Annotation
|
||||
newannot.command.name=Create Groovy Annotation
|
||||
newannot.progress.text=Creating Groovy Annotation ''{0}''
|
||||
|
||||
newenum.dlg.prompt=Enter name for new Groovy Enumeration
|
||||
newenum.dlg.title=New Groovy Enumeration
|
||||
newenum.menu.action.text=Groovy Enumeration
|
||||
newenum.menu.action.description=Creates new Groovy Enumeration
|
||||
newenum.command.name=Create Groovy Enumeration
|
||||
newenum.progress.text=Creating Groovy Enumeration ''{0}''
|
||||
|
||||
newscript.dlg.prompt=Enter name for new Groovy Script
|
||||
newscript.dlg.title=New Groovy Script
|
||||
newscript.menu.action.text=Groovy Script
|
||||
newscript.menu.action.description=Creates new Groovy Script
|
||||
newscript.command.name=Create Groovy Script
|
||||
newscript.progress.text=Creating Groovy Script ''{0}''
|
||||
|
||||
action.group.groovy.title=Groovy
|
||||
action.group.groovy.description=Groovy
|
||||
|
||||
##########################################################################################################################
|
||||
# GDK & compilation
|
||||
########################################################################################################################
|
||||
@@ -83,20 +50,13 @@ import.identifier.expected=package or class name expected
|
||||
identifier.expected=Identifier expected
|
||||
import.not.allowed=Imports are not allowed inside blocks
|
||||
identifier.or.block.expected=Identifier or code block expected
|
||||
package.keyword.expected='package' expected
|
||||
string.end.expected=String end expected
|
||||
regex.end.expected=Regex ending expected
|
||||
mult.expression.expected=Multiplicative expression expected
|
||||
closure.op.expected='->' expected
|
||||
lbrack.expected='[' expected
|
||||
rbrack.expected=']' expected
|
||||
upper.case.ident.or.builtIn.type.or.qualified.type.name.expected=upper case identifier or built in type or qualified type name expected
|
||||
balanced.tokens.expected=balanced tokens expected
|
||||
lparen.expected='(' expected
|
||||
lcurly.expected='{' expected
|
||||
comma.expected=',' expected
|
||||
start.of.string.expected=start of string expected
|
||||
end.of.string.expected=end of string expected
|
||||
rcurly.expected='}' expected
|
||||
rparen.expected=')' expected
|
||||
semi.expected=';' expected
|
||||
@@ -108,14 +68,10 @@ case.without.switch='case' outside 'switch' block
|
||||
default.without.switch='default' outside 'switch' block
|
||||
catch.or.finally.expected='catch' or 'finally' expected
|
||||
colon.expected=':' expected
|
||||
lbrack.or.lparen.or.lcurly.or.string_ctor_start.expected='[', '{', '{' or start of the string expected
|
||||
wrong.declaration=Wrong declaration
|
||||
wrong.statement=Wrong statement
|
||||
variable.definitions.expected=Variable definition expected
|
||||
method.definitions.expected=Method definition expected
|
||||
type.specification.expected=Type specification expected
|
||||
modifier.expected=Modifier expected
|
||||
annotation.or.modifier.expected=Annotation or modifier expected
|
||||
type.definition.expected=Type definition expected
|
||||
expression.expected=Expression expected
|
||||
annotation.initializer.expected=Annotation initializer expected
|
||||
@@ -129,7 +85,6 @@ duplicate.modifier=Duplicate modifier ''{0}''
|
||||
param.expected=Parameter expected
|
||||
for.clause.expected=clause expected
|
||||
at.expected='@' expected
|
||||
intarface.expected='interface' expected
|
||||
if.expected='if' expected
|
||||
compound.statemenet.expected=Initializer block expected
|
||||
indentifier.or.string.or.left.parenth.literal.expected=Identifier, string literal or '(' expected
|
||||
@@ -169,10 +124,6 @@ import.class=Import Class
|
||||
create.class.family.name=Create Class
|
||||
create.class.text=Create Class ''{0}''
|
||||
create.interface.text=Create Interface ''{0}''
|
||||
dynamize.invalid.interface.text=Dynamize invalid interface instantiation
|
||||
dynamize.invalid.interface.family.name=Dynamize invalid code
|
||||
class.to.import.chooser.title=Choose class to import
|
||||
unused.import.statement=Unused import statement
|
||||
static.declaration.in.inner.class=Inner classes cannot have static declarations
|
||||
constructors.are.not.allowed.in.anonymous.class=Constructors are not allowed in anonymous class
|
||||
no.such.property=Property ''{0}'' does not exist
|
||||
@@ -209,27 +160,17 @@ def.visibility.presentation=def
|
||||
|
||||
|
||||
# {0} - colspan, {1} - method name, {2} - class name, {3} - formal myParameters row, {4} - arguments row
|
||||
argument.mismatch.html.tooltip=\
|
||||
<html><body><table border=0>\
|
||||
<tr><td><b>{1}</b></td>{3}<td colspan={0}>in <b>{2}</b>\\ cannot be applied</td></tr>\
|
||||
<tr><td>to</td>{4}</tr>\
|
||||
</table></body></html>
|
||||
|
||||
########################################################################################################################
|
||||
# Compiler
|
||||
########################################################################################################################
|
||||
class.already.exists=Class ''{0}'' already exists
|
||||
|
||||
selected.block.should.represent.an.expression=Selected code block must represent an expression
|
||||
annotation.definition.qualified.name.expected=annotation definition qualified name expected
|
||||
type.expected=type expected
|
||||
type.parameter.expected=Type parameter expected
|
||||
type.argument.expected=Type argument expected
|
||||
|
||||
repetitive.method.name.signature=Repetitive method name/signature
|
||||
repetitive.method.name.signature.and.return.type=repetitive method name, signature and return type
|
||||
illegal.combination.of.modifiers=illegal combination of modifiers
|
||||
modifier.is.not.allowed.here.0=modifier ''{0}'' is not allowed here
|
||||
illegal.combination.of.modifiers.abstract.and.final=illegal combination of modifiers 'abstract' and 'final'
|
||||
modifier.volatile.not.allowed.here=modifier 'volatile' not allowed here
|
||||
modifier.transient.not.allowed.here=modifier 'transient' not allowed here
|
||||
@@ -242,7 +183,6 @@ anonymous.class.cannot.have.abstract.method=anonymous class cannot have abstract
|
||||
illegal.combination.of.modifiers.volatile.and.final=illegal combination of modifiers 'volatile' and 'final'
|
||||
variable.cannot.be.native=variable cannot have modifier 'native'
|
||||
variable.cannot.be.abstract=variable cannot have modifier 'abstract'
|
||||
not.abstract.class.cannot.have.method.without.body=not abstract class cannot have method without body
|
||||
not.abstract.method.should.have.body=not abstract method should have body
|
||||
cannot.create.class.error.text=Cannot Create Class ''{0}'': {1}
|
||||
cannot.create.class.error.title=Cannot Create Class
|
||||
@@ -285,10 +225,8 @@ dynamic.window=Dynamic window
|
||||
dynamic.properties.table.no.arguments=Arguments list is empty.
|
||||
assignment.expected='=' expected
|
||||
tuple.cant.be.placed.in.class=Multiple assignments are not allowed for fields
|
||||
immutable.class.should.be.final=Class with '@Immutable' annotation should be final
|
||||
singleton.class.should.have.private.constructor=Class with '@Singleton' annotation should have private constructor
|
||||
qualified.new.of.static.class=Qualified new of static class
|
||||
cannot.have.static.declarations=Inner classes cannot have static declarations
|
||||
unknown.class=unknown class ''{0}''
|
||||
is.not.enclosing.class=''{0}'' is not an enclosing class
|
||||
package.definition.cannot.have.modifiers=Package definition cannot have modifiers
|
||||
@@ -308,7 +246,6 @@ groovy.like.library.found=Groovy Library Found
|
||||
groovy.like.library.found.text=Do you want to set up Groovy for module ''{0}'' \n\
|
||||
with found library ''{1}'' (Groovy version {2})?
|
||||
compile.groovy.files=&Compile Groovy files
|
||||
copy.groovy.files.to.output=Copy Groovy files to output as &resources
|
||||
in.expected='in' expected
|
||||
not.allowed.modifier.in.forin=Modifier ''{0}'' is not allowed here
|
||||
property.name.expected=Property name expected
|
||||
@@ -328,9 +265,7 @@ no.interface.expected.here=No interface expected here
|
||||
no.class.expected.here=No class expected here
|
||||
move.to.extends.list=Move reference to extends list
|
||||
move.to.implements.list=Move reference to implements list
|
||||
script.file.does.not.exist=Script file does not exist
|
||||
script.file.is.not.groovy.file=Script file is not Groovy file
|
||||
choose.class.to.execute=Choose class to execute
|
||||
class.does.not.exist=Class does not exist
|
||||
class.can't\ be\ executed=Class cannot be executed
|
||||
invoke.completion.second.time.to.show.skipped.methods=Invoke completion second time to show skipped methods
|
||||
@@ -339,7 +274,6 @@ groovy.file.extension.is.not.mapped.to.groovy.file.type=*.groovy files are mappe
|
||||
class.is.not.annotation=''{0}'' is not an annotation
|
||||
method.call.is.ambiguous=Method call is ambiguous
|
||||
duplicated.named.parameter=Duplicated named parameter ''{0}'' found
|
||||
cannot.find.method.call=No signature of method: {0}.call() is applicable for {1}
|
||||
no.super.classes.found=No super classes found
|
||||
no.super.method.found=No super methods found
|
||||
wrong.package.name=Package name ''{0}'' does not corresponding to the file path ''{1}''
|
||||
@@ -359,4 +293,9 @@ triple.is.not.expected.here='...' is not expected here
|
||||
Equals=Equals
|
||||
default.initializers.are.not.allowed.in.abstract.method=Default initializers are not allowed in abstract methods
|
||||
groovy.does.not.support.constructor.type.arguments=Groovy does not support constructor type arguments
|
||||
illegal.escape.character.in.string.literal=Illegal escape character in string literal
|
||||
illegal.escape.character.in.string.literal=Illegal escape character in string literal
|
||||
dollar.slash.end.expected=Dollar slash ending expected
|
||||
regex.cannot.be.first.argument.of.command.method.call=Regex cannot be first argument of command method call
|
||||
add.parentheses=Add parentheses
|
||||
add.parentheses.to.command.method.call=Add parentheses to command method call
|
||||
dollar.slash.strings.are.not.allowed.in.0=Dollar-slash strings are not allowed in Groovy {0}
|
||||
@@ -835,6 +835,63 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
checkStringLiteral(literal, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitRegexExpression(GrRegex regex) {
|
||||
String text = regex.getText();
|
||||
String quote = GrStringUtil.getStartQuote(text);
|
||||
|
||||
final GroovyConfigUtils config = GroovyConfigUtils.getInstance();
|
||||
|
||||
if ("$/".equals(quote)) {
|
||||
if (!config.isVersionAtLeast(regex, GroovyConfigUtils.GROOVY1_9)) {
|
||||
myHolder
|
||||
.createErrorAnnotation(regex, GroovyBundle.message("dollar.slash.strings.are.not.allowed.in.0", config.getSDKVersion(regex)));
|
||||
}
|
||||
if (regex.getParent() instanceof GrCommandArgumentList &&
|
||||
((GrCommandArgumentList)regex.getParent()).getAllArguments()[0] == regex) {
|
||||
final Annotation annotation =
|
||||
myHolder.createErrorAnnotation(regex, GroovyBundle.message("regex.cannot.be.first.argument.of.command.method.call"));
|
||||
annotation.registerFix(new AddParenthesesFix());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (String part : regex.getTextParts()) {
|
||||
if (!GrStringUtil.parseRegexCharacters(part, new StringBuilder(part.length()), null, regex.getText().startsWith("/"))) {
|
||||
myHolder.createErrorAnnotation(regex, GroovyBundle.message("illegal.escape.character.in.string.literal"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ("/".equals(quote)) {
|
||||
if (!config.isVersionAtLeast(regex, GroovyConfigUtils.GROOVY1_8)) {
|
||||
if (text.contains("\n") || text.contains("\r")) {
|
||||
myHolder.createErrorAnnotation(regex, GroovyBundle
|
||||
.message("multiline.slashy.strings.are.not.allowed.in.groovy.0", config.getSDKVersion(regex)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (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
|
||||
public void visitGStringExpression(GrString gstring) {
|
||||
for (String part : gstring.getTextParts()) {
|
||||
if (!GrStringUtil.parseStringCharacters(part, new StringBuilder(part.length()), null)) {
|
||||
myHolder.createErrorAnnotation(gstring, GroovyBundle.message("illegal.escape.character.in.string.literal"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkStringLiteral(PsiElement literal, String text) {
|
||||
|
||||
StringBuilder builder = new StringBuilder(text.length());
|
||||
@@ -842,63 +899,16 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
if (quote.isEmpty()) return;
|
||||
|
||||
String substring = text.substring(quote.length());
|
||||
|
||||
String[] parts;
|
||||
PsiElement child = literal.getFirstChild();
|
||||
if (child == null) child = literal;
|
||||
IElementType elementType = child.getNode().getElementType();
|
||||
boolean isSimpleString = elementType == GroovyTokenTypes.mSTRING_LITERAL ||
|
||||
elementType == GroovyTokenTypes.mGSTRING_LITERAL ||
|
||||
elementType == GroovyTokenTypes.mREGEX_LITERAL;
|
||||
if (isSimpleString) {
|
||||
parts = new String[]{substring};
|
||||
}
|
||||
else if (literal instanceof GrString) {
|
||||
parts = ((GrString)literal).getTextParts();
|
||||
}
|
||||
else {
|
||||
if (!GrStringUtil.parseStringCharacters(substring, new StringBuilder(text.length()), null)) {
|
||||
myHolder.createErrorAnnotation(literal, GroovyBundle.message("illegal.escape.character.in.string.literal"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String part : parts) {
|
||||
if (!GrStringUtil.parseStringCharacters(part, new StringBuilder(text.length()), null, !quote.equals("/"))) {
|
||||
myHolder.createErrorAnnotation(literal, GroovyBundle.message("illegal.escape.character.in.string.literal"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isSimpleString) {
|
||||
int[] offsets = new int[substring.length() + 1];
|
||||
boolean result = GrStringUtil.parseStringCharacters(substring, builder, offsets, !quote.equals("/"));
|
||||
LOG.assertTrue(result);
|
||||
if (!builder.toString().endsWith(quote) || substring.charAt(offsets[builder.length() - quote.length()]) == '\\') {
|
||||
myHolder.createErrorAnnotation(literal, GroovyBundle.message("string.end.expected"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.assertTrue(literal instanceof GrString);
|
||||
//absence of closing quote is registered by lexer
|
||||
}
|
||||
|
||||
|
||||
if (quote.equals("/")) {
|
||||
if (!GroovyConfigUtils.getInstance().isVersionAtLeast(literal, GroovyConfigUtils.GROOVY1_8)) {
|
||||
if (text.contains("\n") || text.contains("\r")) {
|
||||
myHolder.createErrorAnnotation(literal, GroovyBundle.message("multiline.slashy.strings.are.not.allowed.in.groovy.0",
|
||||
GroovyConfigUtils.getInstance().getSDKVersion(literal)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (literal instanceof GrRegex) {
|
||||
if (!GroovyConfigUtils.getInstance().isVersionAtLeast(literal, GroovyConfigUtils.GROOVY1_8)) {
|
||||
myHolder.createErrorAnnotation(literal, GroovyBundle.message("slashy.strings.with.injections.are.not.allowed.in.groovy.0",
|
||||
GroovyConfigUtils.getInstance().getSDKVersion(literal)));
|
||||
return;
|
||||
}
|
||||
int[] offsets = new int[substring.length() + 1];
|
||||
boolean result = GrStringUtil.parseStringCharacters(substring, builder, offsets);
|
||||
LOG.assertTrue(result);
|
||||
if (!builder.toString().endsWith(quote) || substring.charAt(offsets[builder.length() - quote.length()]) == '\\') {
|
||||
myHolder.createErrorAnnotation(literal, GroovyBundle.message("string.end.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.annotator.intentions;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrApplicationStatement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrCommandArgumentList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
|
||||
/**
|
||||
* @author Max Medvedev
|
||||
*/
|
||||
public class AddParenthesesFix implements IntentionAction {
|
||||
private static final Logger LOG = Logger.getInstance(AddParenthesesFix.class);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getText() {
|
||||
return GroovyBundle.message("add.parentheses");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return GroovyBundle.message("add.parentheses.to.command.method.call");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
final PsiElement at = file.findElementAt(offset);
|
||||
final GrCommandArgumentList argList = PsiTreeUtil.getParentOfType(at, GrCommandArgumentList.class);
|
||||
return argList != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
final PsiElement at = file.findElementAt(offset);
|
||||
final GrCommandArgumentList argList = PsiTreeUtil.getParentOfType(at, GrCommandArgumentList.class);
|
||||
if (argList == null) return;
|
||||
|
||||
final PsiElement parent = argList.getParent();
|
||||
LOG.assertTrue(parent instanceof GrApplicationStatement);
|
||||
|
||||
final GrExpression newExpr;
|
||||
try {
|
||||
newExpr = GroovyPsiElementFactory.getInstance(project)
|
||||
.createExpressionFromText(((GrApplicationStatement)parent).getInvokedExpression().getText() + '(' + argList.getText() + ')');
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
return;
|
||||
}
|
||||
|
||||
parent.replace(newExpr);
|
||||
editor.getCaretModel().moveToOffset(offset + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ public abstract class GroovyConfigUtils extends AbstractConfigUtils {
|
||||
public static final String NO_VERSION = "<no version>";
|
||||
public static final String GROOVY1_7 = "1.7";
|
||||
public static final String GROOVY1_8 = "1.8";
|
||||
public static final String GROOVY1_9 = "1.9";
|
||||
|
||||
private GroovyConfigUtils() {
|
||||
}
|
||||
|
||||
+55
-3
@@ -17,10 +17,13 @@ package org.jetbrains.plugins.groovy.lang.editor;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.StringLiteralCopyPasteProcessor;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.*;
|
||||
@@ -38,9 +41,52 @@ public class GroovyLiteralCopyPasteProcessor extends StringLiteralCopyPasteProce
|
||||
@Override
|
||||
protected boolean isStringLiteral(@NotNull PsiElement token) {
|
||||
ASTNode node = token.getNode();
|
||||
return node != null ? TokenSets.STRING_LITERALS.contains(node.getElementType()):false;
|
||||
return node != null && TokenSets.STRING_LITERALS.contains(node.getElementType());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected PsiElement findLiteralTokenType(PsiFile file, int selectionStart, int selectionEnd) {
|
||||
PsiElement elementAtSelectionStart = file.findElementAt(selectionStart);
|
||||
if (elementAtSelectionStart == null) {
|
||||
return null;
|
||||
}
|
||||
IElementType elementType = elementAtSelectionStart.getNode().getElementType();
|
||||
if ((elementType == mREGEX_END || elementType == mDOLLAR_SLASH_REGEX_END || elementType == mGSTRING_END) &&
|
||||
elementAtSelectionStart.getTextOffset() == selectionStart) {
|
||||
elementAtSelectionStart = elementAtSelectionStart.getPrevSibling();
|
||||
if (elementAtSelectionStart == null) return null;
|
||||
elementType = elementAtSelectionStart.getNode().getElementType();
|
||||
}
|
||||
|
||||
if (!isStringLiteral(elementAtSelectionStart) && !isCharLiteral(elementAtSelectionStart)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (elementAtSelectionStart.getTextRange().getEndOffset() < selectionEnd) {
|
||||
final PsiElement elementAtSelectionEnd = file.findElementAt(selectionEnd);
|
||||
if (elementAtSelectionEnd == null) {
|
||||
return null;
|
||||
}
|
||||
if (elementAtSelectionEnd.getNode().getElementType() == elementType &&
|
||||
elementAtSelectionEnd.getTextRange().getStartOffset() < selectionEnd) {
|
||||
return elementAtSelectionStart;
|
||||
}
|
||||
}
|
||||
|
||||
final TextRange textRange = elementAtSelectionStart.getTextRange();
|
||||
|
||||
//content elements don't have quotes, so they are shorter than whole string literals
|
||||
if (elementType == mREGEX_CONTENT || elementType == mGSTRING_CONTENT || elementType == mDOLLAR_SLASH_REGEX_CONTENT) {
|
||||
selectionStart++;
|
||||
selectionEnd--;
|
||||
}
|
||||
if (selectionStart <= textRange.getStartOffset() || selectionEnd >= textRange.getEndOffset()) {
|
||||
return null;
|
||||
}
|
||||
return elementAtSelectionStart;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getLineBreaker(PsiElement token) {
|
||||
final String text = token.getText();
|
||||
@@ -65,7 +111,10 @@ public class GroovyLiteralCopyPasteProcessor extends StringLiteralCopyPasteProce
|
||||
protected String escapeCharCharacters(@NotNull String s, @NotNull PsiElement token, boolean escapeSlashes) {
|
||||
IElementType tokenType = token.getNode().getElementType();
|
||||
|
||||
if (tokenType == mREGEX_CONTENT || tokenType == mREGEX_LITERAL) {
|
||||
if (tokenType == mREGEX_CONTENT ||
|
||||
tokenType == mREGEX_LITERAL ||
|
||||
tokenType == mDOLLAR_SLASH_REGEX_CONTENT ||
|
||||
tokenType == mDOLLAR_SLASH_REGEX_LITERAL) {
|
||||
if (escapeSlashes) {
|
||||
return StringUtil.escapeSlashes(s);
|
||||
}
|
||||
@@ -100,7 +149,10 @@ public class GroovyLiteralCopyPasteProcessor extends StringLiteralCopyPasteProce
|
||||
protected String unescape(String text, PsiElement token) {
|
||||
final IElementType tokenType = token.getNode().getElementType();
|
||||
|
||||
if (tokenType == mREGEX_CONTENT || tokenType == mREGEX_LITERAL) {
|
||||
if (tokenType == mREGEX_CONTENT ||
|
||||
tokenType == mREGEX_LITERAL ||
|
||||
tokenType == mDOLLAR_SLASH_REGEX_CONTENT ||
|
||||
tokenType == mDOLLAR_SLASH_REGEX_LITERAL) {
|
||||
return StringUtil.unescapeSlashes(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,12 +30,11 @@ import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.*;
|
||||
*/
|
||||
public class GroovyLexer extends LookAheadLexer {
|
||||
private static final TokenSet tokensToMerge = TokenSet.create(
|
||||
mSL_COMMENT,
|
||||
mML_COMMENT,
|
||||
mREGEX_BEGIN,
|
||||
mREGEX_CONTENT,
|
||||
mREGEX_END,
|
||||
WHITE_SPACE
|
||||
mSL_COMMENT,
|
||||
mML_COMMENT,
|
||||
mREGEX_CONTENT,
|
||||
mDOLLAR_SLASH_REGEX_CONTENT,
|
||||
WHITE_SPACE
|
||||
);
|
||||
|
||||
public GroovyLexer() {
|
||||
@@ -56,41 +55,13 @@ public class GroovyLexer extends LookAheadLexer {
|
||||
if (token == kDEF || token == kAS || token == kIN) {
|
||||
addToken(mIDENT);
|
||||
baseLexer.advance();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
addToken(token);
|
||||
baseLexer.advance();
|
||||
}
|
||||
} else if (type == mDOLLAR_SLASHY_LITERAL) {
|
||||
//todo rewrite groovy literal treatment with normal dollar-slashy strings treatment
|
||||
|
||||
String text = baseLexer.getTokenText();
|
||||
assert text.startsWith("$/");
|
||||
assert text.endsWith("/$");
|
||||
if (text.length() == 4) {
|
||||
addToken(mREGEX_LITERAL);
|
||||
baseLexer.advance();
|
||||
return;
|
||||
}
|
||||
|
||||
int start = baseLexer.getTokenStart() + 1;
|
||||
|
||||
GroovyLexer regex = new GroovyLexer();
|
||||
regex.start("/" + text.substring(2, text.length() - 2).replace('/', 'a') + "/");
|
||||
while (true) {
|
||||
IElementType tokenType = regex.getTokenType();
|
||||
int tokenEnd = regex.getTokenEnd();
|
||||
regex.advance();
|
||||
|
||||
boolean last = regex.getTokenType() == null;
|
||||
if (last) {
|
||||
addToken(tokenType);
|
||||
baseLexer.advance();
|
||||
return;
|
||||
}
|
||||
|
||||
addToken(start + tokenEnd, tokenType);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
super.lookAhead(baseLexer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,17 +73,20 @@ public interface GroovyTokenTypes extends GroovyDocElementTypes {
|
||||
IElementType mGSTRING_CONTENT = new GroovyElementType("Gstring content");
|
||||
IElementType mGSTRING_END = new GroovyElementType("Gstring end");
|
||||
|
||||
// IElementType mWRONG_STRING_LITERAL = new GroovyElementType("wrong string");
|
||||
// IElementType mWRONG_GSTRING_LITERAL = new GroovyElementType("wrong gstring");
|
||||
|
||||
IElementType mREGEX_LITERAL = new GroovyElementType("regexp");
|
||||
IElementType mDOLLAR_SLASHY_LITERAL = new GroovyElementType("dollarSlashy");
|
||||
IElementType mDOLLAR_SLASH_REGEX_LITERAL = new GroovyElementType("$/ regexp");
|
||||
IElementType mWRONG_DOLLAR_SLASH_LITERAL = new GroovyElementType("wrong dollar slash literal");
|
||||
|
||||
IElementType mREGEX_BEGIN = new GroovyElementType("regex begin");
|
||||
IElementType mREGEX_CONTENT = new GroovyElementType("regex content");
|
||||
IElementType mREGEX_END = new GroovyElementType("regex end");
|
||||
|
||||
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 mWRONG_REGEX_LITERAL = new GroovyElementType("wrong regex");
|
||||
IElementType mWRONG_DOLLAR_SLASH_REGEX_LITERAL = new GroovyElementType("wrong $/ regex");
|
||||
|
||||
/* **************************************************************************************************
|
||||
* Common tokens: operators, braces etc.
|
||||
|
||||
@@ -69,7 +69,8 @@ public abstract class TokenSets {
|
||||
kNULL,
|
||||
mSTRING_LITERAL,
|
||||
mGSTRING_LITERAL,
|
||||
mREGEX_LITERAL
|
||||
mREGEX_LITERAL,
|
||||
mDOLLAR_SLASH_REGEX_LITERAL
|
||||
);
|
||||
|
||||
public static final TokenSet BUILT_IN_TYPE = TokenSet.create(
|
||||
@@ -123,6 +124,9 @@ public abstract class TokenSets {
|
||||
public static TokenSet STRING_LITERALS = TokenSet.create(
|
||||
mSTRING_LITERAL,
|
||||
mREGEX_LITERAL,
|
||||
mREGEX_CONTENT,
|
||||
mDOLLAR_SLASH_REGEX_CONTENT,
|
||||
mDOLLAR_SLASH_REGEX_LITERAL,
|
||||
mGSTRING_LITERAL,
|
||||
mGSTRING_CONTENT,
|
||||
mGSTRING_BEGIN,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -134,7 +134,7 @@ mIDENT_NOBUCKS = {mLETTER} ({mLETTER} | {mDIGIT})*
|
||||
|
||||
mSTRING_NL = {mONE_NL}
|
||||
mSTRING_ESC = \\ [^] | \\ ({WHITE_SPACE})+ (\n|\r)
|
||||
mREGEX_ESC = \\ n | \\ r | \\ t | \\ b | \\ f | "\\" "\\" | \\ "$" | \\ \" | \\ \'
|
||||
mREGEX_ESC = \\ "$"
|
||||
| "\\""u"{mHEX_DIGIT}{4}
|
||||
| "\\" [0..3] ([0..7] ([0..7])?)?
|
||||
| "\\" [4..7] ([0..7])?
|
||||
@@ -142,18 +142,10 @@ mREGEX_ESC = \\ n | \\ r | \\ t | \\ b | \\ f | "\\" "\\" | \\ "$" | \\ \" | \\
|
||||
|
||||
/// Regexes ////////////////////////////////////////////////////////////////
|
||||
|
||||
ESCAPPED_REGEX_SEP = \\ "/"
|
||||
mREGEX_BEGIN = "/""$"
|
||||
| "/" ([^"/""$"] | {mREGEX_ESC} | {ESCAPPED_REGEX_SEP})? {mREGEX_CONTENT}"$"
|
||||
mREGEX_CONTENT = ({mREGEX_ESC}
|
||||
| {ESCAPPED_REGEX_SEP}
|
||||
| [^"/""$"])*
|
||||
ESCAPED_REGEX_SEP = \\ "/"
|
||||
mREGEX_CONTENT = ({mREGEX_ESC} | {ESCAPED_REGEX_SEP} | [^"/""$"])+
|
||||
|
||||
mREGEX_LITERAL = "/" ([^"/"\n\r"$"] | {mREGEX_ESC} | {ESCAPPED_REGEX_SEP})? {mREGEX_CONTENT} ("$""/" | "/")
|
||||
mDOLLAR_SLASHY_LITERAL_1 = \$\/ ([^\/] | \/[^\$] )* \/\$
|
||||
mDOLLAR_SLASHY_LITERAL_2 = \$\/ ([^\/] | \/[^\$] | {mDOLLAR_SLASHY_LITERAL_1} )* \/\$
|
||||
mDOLLAR_SLASHY_LITERAL_3 = \$\/ ([^\/] | \/[^\$] | {mDOLLAR_SLASHY_LITERAL_2} )* \/\$
|
||||
mDOLLAR_SLASHY_LITERAL = {mDOLLAR_SLASHY_LITERAL_3}
|
||||
mDOLLAR_SLASH_REGEX_CONTENT = ([^\/\$] | \/[^\$] )+
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -208,10 +200,6 @@ mGSTRING_LITERAL = \"\"
|
||||
%xstate IN_TRIPLE_IDENT
|
||||
%xstate IN_TRIPLE_DOT
|
||||
%xstate IN_TRIPLE_NLS
|
||||
%xstate KING_STATE
|
||||
%xstate KING_STATE_INNER
|
||||
%xstate KING_STATE_CONTENT
|
||||
%xstate KING_STATE_INNER_CONTENT
|
||||
|
||||
%state IN_INNER_BLOCK
|
||||
|
||||
@@ -220,6 +208,10 @@ mGSTRING_LITERAL = \"\"
|
||||
%xstate IN_REGEX
|
||||
%xstate IN_REGEX_IDENT
|
||||
%xstate IN_REGEX_DOT
|
||||
%xstate IN_DOLLAR_SLASH_REGEX_DOLLAR
|
||||
%xstate IN_DOLLAR_SLASH_REGEX
|
||||
%xstate IN_DOLLAR_SLASH_REGEX_IDENT
|
||||
%xstate IN_DOLLAR_SLASH_REGEX_DOT
|
||||
|
||||
// Not to separate NewLine sequence by comments
|
||||
%xstate NLS_AFTER_COMMENT
|
||||
@@ -371,6 +363,7 @@ mGSTRING_LITERAL = \"\"
|
||||
if (br.equals(mLPAREN)) yybegin(IN_SINGLE_GSTRING);
|
||||
if (br.equals(mLBRACK)) yybegin(IN_TRIPLE_GSTRING);
|
||||
if (br.equals(mDIV)) yybegin(IN_REGEX);
|
||||
if (br.equals(mDOLLAR)) yybegin(IN_DOLLAR_SLASH_REGEX);
|
||||
}
|
||||
while (!braceCount.isEmpty() && mLCURLY != braceCount.peek()) {
|
||||
braceCount.pop();
|
||||
@@ -490,93 +483,25 @@ mGSTRING_LITERAL = \"\"
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////// regexes //////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
<KING_STATE> { // Processing nasty $ signs
|
||||
("{" | {mIDENT_NOBUCKS}) { yypushback(yytext().length());
|
||||
gStringStack.push(mDIV); // For regexes
|
||||
yybegin(IN_REGEX_DOLLAR); }
|
||||
|
||||
. | {mNLS} { yypushback(yytext().length());
|
||||
yybegin(KING_STATE_INNER);
|
||||
}
|
||||
}
|
||||
|
||||
<KING_STATE_CONTENT> { // Processing nasty $ signs
|
||||
("{" | {mIDENT_NOBUCKS}) { yypushback(yytext().length());
|
||||
gStringStack.push(mDIV); // For regexes
|
||||
yybegin(IN_REGEX_DOLLAR); }
|
||||
|
||||
. | {mNLS} { yypushback(yytext().length());
|
||||
yybegin(KING_STATE_INNER_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
<KING_STATE_INNER> {
|
||||
"$" { yybegin(KING_STATE);
|
||||
return mREGEX_BEGIN; }
|
||||
|
||||
{ESCAPPED_REGEX_SEP} { return mREGEX_BEGIN; }
|
||||
|
||||
"/" { if (blockStack.isEmpty()){
|
||||
yybegin(YYINITIAL);
|
||||
} else {
|
||||
yybegin(IN_INNER_BLOCK);
|
||||
}
|
||||
return mREGEX_END; }
|
||||
|
||||
. | {mNLS} { return mREGEX_BEGIN; }
|
||||
|
||||
}
|
||||
|
||||
<KING_STATE_INNER_CONTENT> {
|
||||
"$" { yybegin(KING_STATE_CONTENT);
|
||||
return mREGEX_CONTENT; }
|
||||
|
||||
{ESCAPPED_REGEX_SEP} { return mREGEX_CONTENT; }
|
||||
|
||||
"/" { if (blockStack.isEmpty()){
|
||||
yybegin(YYINITIAL);
|
||||
} else {
|
||||
yybegin(IN_INNER_BLOCK);
|
||||
}
|
||||
return mREGEX_END; }
|
||||
|
||||
. | {mNLS} { return mREGEX_CONTENT; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
<WAIT_FOR_REGEX> {
|
||||
|
||||
{WHITE_SPACE} { afterComment = YYINITIAL;
|
||||
return(WHITE_SPACE); }
|
||||
{WHITE_SPACE} { afterComment = YYINITIAL;
|
||||
return(WHITE_SPACE); }
|
||||
|
||||
{mSL_COMMENT} { return mSL_COMMENT; }
|
||||
{mML_COMMENT} { return mML_COMMENT; }
|
||||
{mDOC_COMMENT} { return GROOVY_DOC_COMMENT; }
|
||||
{mSL_COMMENT} { return mSL_COMMENT; }
|
||||
{mML_COMMENT} { return mML_COMMENT; }
|
||||
{mDOC_COMMENT} { return GROOVY_DOC_COMMENT; }
|
||||
|
||||
{mDOLLAR_SLASHY_LITERAL} { if (blockStack.isEmpty()){
|
||||
yybegin(YYINITIAL);
|
||||
} else {
|
||||
yybegin(IN_INNER_BLOCK);
|
||||
}
|
||||
return(mDOLLAR_SLASHY_LITERAL); }
|
||||
|
||||
{mREGEX_LITERAL} { if (blockStack.isEmpty()){
|
||||
yybegin(YYINITIAL);
|
||||
} else {
|
||||
yybegin(IN_INNER_BLOCK);
|
||||
}
|
||||
return(mREGEX_LITERAL); }
|
||||
|
||||
{mREGEX_BEGIN} { yybegin(KING_STATE);
|
||||
"/" { yybegin(IN_REGEX);
|
||||
gStringStack.push(mDIV);
|
||||
return mREGEX_BEGIN; }
|
||||
|
||||
"/" ([^\"\$\/] | {mREGEX_ESC} | {ESCAPPED_REGEX_SEP})? {mREGEX_CONTENT} { return mWRONG_REGEX_LITERAL; }
|
||||
"$""/" { yybegin(IN_DOLLAR_SLASH_REGEX);
|
||||
gStringStack.push(mDOLLAR);
|
||||
return mDOLLAR_SLASH_REGEX_BEGIN; }
|
||||
|
||||
[^] { yypushback(1);
|
||||
[^] { yypushback(1);
|
||||
if (blockStack.isEmpty()){
|
||||
yybegin(YYINITIAL);
|
||||
} else {
|
||||
@@ -585,17 +510,24 @@ mGSTRING_LITERAL = \"\"
|
||||
}
|
||||
}
|
||||
|
||||
<IN_REGEX_IDENT>{
|
||||
{mIDENT_NOBUCKS} { yybegin(IN_REGEX_DOT);
|
||||
return mIDENT; }
|
||||
[^] { yypushback(1);
|
||||
yybegin(IN_REGEX); }
|
||||
}
|
||||
<IN_REGEX_DOT>{
|
||||
"." /{mIDENT_NOBUCKS} { yybegin(IN_REGEX_IDENT);
|
||||
return mDOT; }
|
||||
[^] { yypushback(1);
|
||||
yybegin(IN_REGEX); }
|
||||
<IN_REGEX> {
|
||||
"/" { if (!gStringStack.isEmpty()) {
|
||||
gStringStack.pop();
|
||||
}
|
||||
if (blockStack.isEmpty()){
|
||||
yybegin(YYINITIAL);
|
||||
} else {
|
||||
yybegin(IN_INNER_BLOCK);
|
||||
}
|
||||
return mREGEX_END; }
|
||||
|
||||
{mREGEX_CONTENT}? "$"
|
||||
/[^"{"[:letter:]"_"] { return mREGEX_CONTENT; }
|
||||
|
||||
{mREGEX_CONTENT} { return mREGEX_CONTENT; }
|
||||
|
||||
"$" { yybegin(IN_REGEX_DOLLAR);
|
||||
return mDOLLAR;}
|
||||
}
|
||||
|
||||
<IN_REGEX_DOLLAR> {
|
||||
@@ -606,20 +538,24 @@ mGSTRING_LITERAL = \"\"
|
||||
braceCount.push(mLCURLY);
|
||||
yybegin(NLS_AFTER_LBRACE);
|
||||
return mLCURLY; }
|
||||
([^{[:jletter:]\n\r] | "$")
|
||||
{mSTRING_ESC}* { gStringStack.clear();
|
||||
yybegin(YYINITIAL);
|
||||
return mWRONG_REGEX_LITERAL; }
|
||||
{mNLS} { yybegin(NLS_AFTER_NLS);
|
||||
afterComment = YYINITIAL;
|
||||
clearStacks();
|
||||
return mNLS;}
|
||||
}
|
||||
|
||||
<IN_REGEX> {
|
||||
{mREGEX_CONTENT}"$" { yybegin(KING_STATE_CONTENT);
|
||||
return mREGEX_CONTENT; }
|
||||
{mREGEX_CONTENT} ("$" "/" | "/") { if (!gStringStack.isEmpty()) {
|
||||
<IN_REGEX_DOT>{
|
||||
"." /{mIDENT_NOBUCKS} { yybegin(IN_REGEX_IDENT);
|
||||
return mDOT; }
|
||||
[^] { yypushback(1);
|
||||
yybegin(IN_REGEX); }
|
||||
}
|
||||
|
||||
<IN_REGEX_IDENT>{
|
||||
{mIDENT_NOBUCKS} { yybegin(IN_REGEX_DOT);
|
||||
return mIDENT; }
|
||||
[^] { yypushback(1);
|
||||
yybegin(IN_REGEX); }
|
||||
}
|
||||
|
||||
<IN_DOLLAR_SLASH_REGEX> {
|
||||
"/""$" { if (!gStringStack.isEmpty()) {
|
||||
gStringStack.pop();
|
||||
}
|
||||
if (blockStack.isEmpty()){
|
||||
@@ -627,16 +563,45 @@ mGSTRING_LITERAL = \"\"
|
||||
} else {
|
||||
yybegin(IN_INNER_BLOCK);
|
||||
}
|
||||
return mREGEX_END; }
|
||||
{mREGEX_CONTENT} { gStringStack.clear();
|
||||
yybegin(YYINITIAL);
|
||||
return mWRONG_REGEX_LITERAL; }
|
||||
{mNLS} { clearStacks();
|
||||
yybegin(NLS_AFTER_NLS);
|
||||
afterComment = YYINITIAL;
|
||||
return mNLS; }
|
||||
return mDOLLAR_SLASH_REGEX_END; }
|
||||
|
||||
{mDOLLAR_SLASH_REGEX_CONTENT}? "$"
|
||||
/[^"{"[:letter:]"_"] { return mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
"/" { return mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
{mDOLLAR_SLASH_REGEX_CONTENT} { return mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
"$" { yybegin(IN_DOLLAR_SLASH_REGEX_DOLLAR);
|
||||
return mDOLLAR;}
|
||||
}
|
||||
|
||||
<IN_DOLLAR_SLASH_REGEX_DOLLAR> {
|
||||
|
||||
{mIDENT_NOBUCKS} { yybegin(IN_DOLLAR_SLASH_REGEX_DOT);
|
||||
return mIDENT; }
|
||||
"{" { blockStack.push(mDOLLAR);
|
||||
braceCount.push(mLCURLY);
|
||||
yybegin(NLS_AFTER_LBRACE);
|
||||
return mLCURLY; }
|
||||
}
|
||||
|
||||
<IN_DOLLAR_SLASH_REGEX_DOT>{
|
||||
"." /{mIDENT_NOBUCKS} { yybegin(IN_DOLLAR_SLASH_REGEX_IDENT);
|
||||
return mDOT; }
|
||||
[^] { yypushback(1);
|
||||
yybegin(IN_DOLLAR_SLASH_REGEX); }
|
||||
}
|
||||
|
||||
<IN_DOLLAR_SLASH_REGEX_IDENT>{
|
||||
{mIDENT_NOBUCKS} { yybegin(IN_DOLLAR_SLASH_REGEX_DOT);
|
||||
return mIDENT; }
|
||||
[^] { yypushback(1);
|
||||
yybegin(IN_DOLLAR_SLASH_REGEX); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
"}" {
|
||||
@@ -646,7 +611,7 @@ mGSTRING_LITERAL = \"\"
|
||||
if (!braceCount.isEmpty() && mLCURLY == braceCount.peek()) {
|
||||
braceCount.pop();
|
||||
}
|
||||
return(mRCURLY); }
|
||||
return mRCURLY; }
|
||||
|
||||
}
|
||||
|
||||
@@ -699,6 +664,9 @@ mGSTRING_LITERAL = \"\"
|
||||
|
||||
{mGSTRING_LITERAL} { return mGSTRING_LITERAL; }
|
||||
|
||||
"$""/" { yypushback(2);
|
||||
yybegin(WAIT_FOR_REGEX); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////// keywords /////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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.parser.parsing.statements.expressions.primary;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.blocks.OpenOrClosableBlock;
|
||||
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.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.mIDENT;
|
||||
import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.mLCURLY;
|
||||
import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.*;
|
||||
|
||||
/**
|
||||
* @author Max Medvedev
|
||||
*/
|
||||
public class DollarSlashRegexConstructorExpression {
|
||||
public static GroovyElementType parse(PsiBuilder builder, GroovyParser parser) {
|
||||
|
||||
PsiBuilder.Marker sMarker = builder.mark();
|
||||
if (ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_BEGIN)) {
|
||||
ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_CONTENT);
|
||||
if (!parseInjection(builder, parser)) {
|
||||
if (!ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_END)) {
|
||||
builder.error(GroovyBundle.message("dollar.slash.end.expected"));
|
||||
}
|
||||
sMarker.done(REGEX);
|
||||
return REGEX;
|
||||
}
|
||||
else {
|
||||
while (ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_CONTENT)) {
|
||||
if (!parseInjection(builder, parser)) break;
|
||||
}
|
||||
if (!ParserUtils.getToken(builder, mDOLLAR_SLASH_REGEX_END)) {
|
||||
builder.error(GroovyBundle.message("dollar.slash.end.expected"));
|
||||
}
|
||||
sMarker.done(REGEX);
|
||||
return REGEX;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sMarker.drop();
|
||||
return WRONGWAY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses heredoc's content in GString
|
||||
*
|
||||
* @param builder given builder
|
||||
* @return nothing
|
||||
*/
|
||||
private static boolean parseInjection(PsiBuilder builder, GroovyParser parser) {
|
||||
if (builder.getTokenType() != mDOLLAR) return false;
|
||||
|
||||
final PsiBuilder.Marker injection = builder.mark();
|
||||
ParserUtils.getToken(builder, mDOLLAR);
|
||||
|
||||
if (mIDENT.equals(builder.getTokenType())) {
|
||||
PathExpression.parse(builder, parser);
|
||||
}
|
||||
else if (mLCURLY.equals(builder.getTokenType())) {
|
||||
OpenOrClosableBlock.parseClosableBlock(builder, parser);
|
||||
}
|
||||
else {
|
||||
injection.drop();
|
||||
return false;
|
||||
}
|
||||
|
||||
injection.done(GSTRING_INJECTION);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+13
-2
@@ -71,6 +71,9 @@ public class PrimaryExpression implements GroovyElementTypes {
|
||||
if (mREGEX_BEGIN == tokenType) {
|
||||
return RegexConstructorExpression.parse(builder, parser);
|
||||
}
|
||||
if (mDOLLAR_SLASH_REGEX_BEGIN == tokenType) {
|
||||
return DollarSlashRegexConstructorExpression.parse(builder, parser);
|
||||
}
|
||||
if (mLBRACK == tokenType) {
|
||||
return ListOrMapConstructorExpression.parse(builder, parser);
|
||||
}
|
||||
@@ -82,7 +85,8 @@ public class PrimaryExpression implements GroovyElementTypes {
|
||||
}
|
||||
if (tokenType == mSTRING_LITERAL ||
|
||||
tokenType == mGSTRING_LITERAL ||
|
||||
tokenType == mREGEX_LITERAL) {
|
||||
tokenType == mREGEX_LITERAL ||
|
||||
tokenType == mDOLLAR_SLASH_REGEX_LITERAL) {
|
||||
return ParserUtils.eatElement(builder, literalsAsRefExprs ? REFERENCE_EXPRESSION : LITERAL);
|
||||
}
|
||||
if (TokenSets.CONSTANTS.contains(tokenType)) {
|
||||
@@ -91,7 +95,14 @@ public class PrimaryExpression implements GroovyElementTypes {
|
||||
if (mWRONG_REGEX_LITERAL == tokenType) {
|
||||
PsiBuilder.Marker marker = builder.mark();
|
||||
builder.advanceLexer();
|
||||
builder.error(GroovyBundle.message("wrong.string"));
|
||||
builder.error(GroovyBundle.message("regex.end.expected"));
|
||||
marker.done(LITERAL);
|
||||
return LITERAL;
|
||||
}
|
||||
if (mWRONG_DOLLAR_SLASH_LITERAL == tokenType) {
|
||||
final PsiBuilder.Marker marker = builder.mark();
|
||||
builder.advanceLexer();
|
||||
builder.error(GroovyBundle.message("dollar.slash.end.expected"));
|
||||
marker.done(LITERAL);
|
||||
return LITERAL;
|
||||
}
|
||||
|
||||
+31
-20
@@ -34,23 +34,26 @@ public class RegexConstructorExpression implements GroovyElementTypes {
|
||||
|
||||
PsiBuilder.Marker sMarker = builder.mark();
|
||||
if (ParserUtils.getToken(builder, mREGEX_BEGIN)) {
|
||||
if (!regexConstructorValuePart(builder, parser)) {
|
||||
ParserUtils.getToken(builder, mREGEX_CONTENT);
|
||||
if (!parseInjection(builder, parser)) {
|
||||
if (!ParserUtils.getToken(builder, mREGEX_END)) {
|
||||
builder.error(GroovyBundle.message("identifier.or.block.expected"));
|
||||
}
|
||||
sMarker.done(REGEX);
|
||||
return REGEX;
|
||||
} else {
|
||||
while (ParserUtils.getToken(builder, mREGEX_CONTENT)) {
|
||||
if (!regexConstructorValuePart(builder, parser)) break;
|
||||
}
|
||||
if (!ParserUtils.getToken(builder, mREGEX_END)) {
|
||||
builder.error(GroovyBundle.message("identifier.or.block.expected"));
|
||||
builder.error(GroovyBundle.message("regex.end.expected"));
|
||||
}
|
||||
sMarker.done(REGEX);
|
||||
return REGEX;
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
while (ParserUtils.getToken(builder, mREGEX_CONTENT)) {
|
||||
if (!parseInjection(builder, parser)) break;
|
||||
}
|
||||
if (!ParserUtils.getToken(builder, mREGEX_END)) {
|
||||
builder.error(GroovyBundle.message("regex.end.expected"));
|
||||
}
|
||||
sMarker.done(REGEX);
|
||||
return REGEX;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sMarker.drop();
|
||||
return WRONGWAY;
|
||||
}
|
||||
@@ -62,16 +65,24 @@ public class RegexConstructorExpression implements GroovyElementTypes {
|
||||
* @param builder given builder
|
||||
* @return nothing
|
||||
*/
|
||||
private static boolean regexConstructorValuePart(PsiBuilder builder, GroovyParser parser) {
|
||||
//ParserUtils.getToken(builder, mSTAR);
|
||||
private static boolean parseInjection(PsiBuilder builder, GroovyParser parser) {
|
||||
if (builder.getTokenType() != mDOLLAR) return false;
|
||||
|
||||
final PsiBuilder.Marker injection = builder.mark();
|
||||
ParserUtils.getToken(builder, mDOLLAR);
|
||||
|
||||
if (mIDENT.equals(builder.getTokenType())) {
|
||||
PathExpression.parse(builder, parser);
|
||||
return true;
|
||||
} else if (mLCURLY.equals(builder.getTokenType())) {
|
||||
OpenOrClosableBlock.parseClosableBlock(builder, parser);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (mLCURLY.equals(builder.getTokenType())) {
|
||||
OpenOrClosableBlock.parseClosableBlock(builder, parser);
|
||||
}
|
||||
else {
|
||||
injection.drop();
|
||||
return false;
|
||||
}
|
||||
|
||||
injection.done(GSTRING_INJECTION);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-1
@@ -110,7 +110,6 @@ 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(mNUM_INT, JAVA_LANG_INTEGER);
|
||||
ourPrimitiveTypesToClassNames.put(mNUM_LONG, JAVA_LANG_LONG);
|
||||
ourPrimitiveTypesToClassNames.put(mNUM_FLOAT, JAVA_LANG_FLOAT);
|
||||
|
||||
+1
-8
@@ -19,9 +19,7 @@ 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.PsiElement;
|
||||
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> {
|
||||
@@ -36,7 +34,7 @@ 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, isStrictBackSlash());
|
||||
return GrStringUtil.parseStringCharacters(subText, outChars, outSourceOffsets);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,11 +44,6 @@ public class GrLiteralEscaper extends LiteralTextEscaper<GrLiteralImpl> {
|
||||
return (result <= rangeInsideHost.getLength() ? result : rangeInsideHost.getLength()) + rangeInsideHost.getStartOffset();
|
||||
}
|
||||
|
||||
protected boolean isStrictBackSlash() {
|
||||
PsiElement child = myHost.getFirstChild();
|
||||
return child == null || child.getNode().getElementType() != GroovyTokenTypes.mREGEX_LITERAL;
|
||||
}
|
||||
|
||||
public boolean isOneLine() {
|
||||
final Object value = myHost.getValue();
|
||||
return value instanceof String && ((String)value).indexOf('\n') < 0;
|
||||
|
||||
+4
-20
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.literals;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference;
|
||||
@@ -31,7 +30,6 @@ import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrExpressionImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
|
||||
|
||||
@@ -112,30 +110,16 @@ public class GrLiteralImpl extends GrAbstractLiteral implements GrLiteral, PsiLa
|
||||
}
|
||||
else if (elemType == mSTRING_LITERAL) {
|
||||
if (!text.startsWith("'")) return null;
|
||||
text = text.substring(1);
|
||||
if (text.endsWith("'")) {
|
||||
text = text.substring(0, text.length() - 1);
|
||||
}
|
||||
text = GrStringUtil.removeQuotes(text);
|
||||
StringBuilder chars = new StringBuilder(text.length());
|
||||
boolean result = GrStringUtil.parseStringCharacters(text, chars, null, true);
|
||||
boolean result = GrStringUtil.parseStringCharacters(text, chars, null);
|
||||
return result ? chars.toString() : null;
|
||||
}
|
||||
else if (elemType == mGSTRING_LITERAL) {
|
||||
if (!text.startsWith("\"")) return null;
|
||||
if (text.startsWith("\"\"\"")) {
|
||||
text = StringUtil.trimEnd(text.substring(3), "\"\"\"");
|
||||
}
|
||||
else {
|
||||
text = StringUtil.trimEnd(text.substring(1), "\"");
|
||||
}
|
||||
text = GrStringUtil.removeQuotes(text);
|
||||
StringBuilder chars = new StringBuilder(text.length());
|
||||
boolean result = GrStringUtil.parseStringCharacters(text, chars, null, true);
|
||||
return result ? chars.toString() : null;
|
||||
}
|
||||
else if (elemType == mREGEX_LITERAL) {
|
||||
text = StringUtil.trimStart(StringUtil.trimEnd(text, "/"), "/");
|
||||
StringBuilder chars = new StringBuilder(text.length());
|
||||
boolean result = GrStringUtil.parseStringCharacters(text, chars, null, false);
|
||||
boolean result = GrStringUtil.parseStringCharacters(text, chars, null);
|
||||
return result ? chars.toString() : null;
|
||||
}
|
||||
return null;
|
||||
|
||||
+36
@@ -17,9 +17,14 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.literals;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
@@ -42,5 +47,36 @@ public class GrRegexImpl extends GrStringImpl implements GrRegex {
|
||||
visitor.visitRegexExpression(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
if (getInjections().length > 0) return null;
|
||||
|
||||
PsiElement child = getFirstChild();
|
||||
if (child == null) return null;
|
||||
|
||||
child = child.getNextSibling();
|
||||
if (child == null ||
|
||||
child.getNode().getElementType() != GroovyTokenTypes.mREGEX_CONTENT &&
|
||||
child.getNode().getElementType() != GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final StringBuilder chars = new StringBuilder();
|
||||
final boolean isDollarSlash = child.getNode().getElementType() == GroovyTokenTypes.mREGEX_CONTENT;
|
||||
GrStringUtil.parseRegexCharacters(child.getText(), chars, null, isDollarSlash);
|
||||
return chars.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextParts() {
|
||||
List<PsiElement> parts = findChildrenByType(GroovyTokenTypes.mREGEX_CONTENT);
|
||||
|
||||
String[] result = new String[parts.size()];
|
||||
int i = 0;
|
||||
for (PsiElement part : parts) {
|
||||
result[i++] = part.getText();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -27,7 +27,7 @@ import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrString;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrStringInjection;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrExpressionImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
|
||||
import java.util.List;
|
||||
@@ -86,6 +86,17 @@ public class GrStringImpl extends GrAbstractLiteral implements GrString {
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return null;
|
||||
if (findChildByClass(GrStringInjection.class) != null) return null;
|
||||
|
||||
final PsiElement fchild = getFirstChild();
|
||||
if (fchild == null) return null;
|
||||
|
||||
final PsiElement content = fchild.getNextSibling();
|
||||
if (content == null || content.getNode().getElementType() != GroovyTokenTypes.mGSTRING_CONTENT) return null;
|
||||
|
||||
final String text = content.getText();
|
||||
StringBuilder chars = new StringBuilder(text.length());
|
||||
boolean result = GrStringUtil.parseStringCharacters(text, chars, null);
|
||||
return result ? chars.toString() : null;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ public class GrStringUtil {
|
||||
private static final String DOUBLE_QUOTES = "\"";
|
||||
private static final String TRIPLE_DOUBLE_QUOTES = "\"\"\"";
|
||||
private static final String SLASH = "/";
|
||||
private static final String DOLLAR_SLASH = "$/";
|
||||
private static final String SLASH_DOLLAR = "/$";
|
||||
|
||||
private GrStringUtil() {
|
||||
}
|
||||
@@ -179,10 +181,21 @@ public class GrStringUtil {
|
||||
String quote = getStartQuote(s);
|
||||
int sL = s.length();
|
||||
int qL = quote.length();
|
||||
if (sL >= qL * 2 && DOLLAR_SLASH.equals(quote)) {
|
||||
if (s.endsWith(SLASH_DOLLAR)) {
|
||||
return s.substring(qL, sL - qL);
|
||||
}
|
||||
else {
|
||||
return s.substring(qL);
|
||||
}
|
||||
}
|
||||
|
||||
if (sL >= qL * 2 && s.endsWith(quote)) {
|
||||
return s.substring(qL, sL - qL);
|
||||
}
|
||||
return s;
|
||||
else {
|
||||
return s.substring(qL);
|
||||
}
|
||||
}
|
||||
|
||||
public static String addQuotes(String s, boolean forGString) {
|
||||
@@ -335,16 +348,99 @@ public class GrStringUtil {
|
||||
if (text.startsWith(TRIPLE_DOUBLE_QUOTES)) return TRIPLE_DOUBLE_QUOTES;
|
||||
if (text.startsWith(DOUBLE_QUOTES)) return DOUBLE_QUOTES;
|
||||
if (text.startsWith(SLASH)) return SLASH;
|
||||
if (text.startsWith(DOLLAR_SLASH)) return DOLLAR_SLASH;
|
||||
return "";
|
||||
}
|
||||
|
||||
public static boolean parseRegexCharacters(@NotNull String chars,
|
||||
@NotNull StringBuilder outChars,
|
||||
@Nullable int[] sourceOffsets,
|
||||
boolean escapeSlash) {
|
||||
assert sourceOffsets == null || sourceOffsets.length == chars.length() + 1;
|
||||
if (chars.indexOf('\\') < 0) {
|
||||
outChars.append(chars);
|
||||
if (sourceOffsets != null) {
|
||||
for (int i = 0; i < sourceOffsets.length; i++) {
|
||||
sourceOffsets[i] = i;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
final int outOffset = outChars.length();
|
||||
while (index < chars.length()) {
|
||||
char c = chars.charAt(index++);
|
||||
if (sourceOffsets != null) {
|
||||
sourceOffsets[outChars.length() - outOffset] = index - 1;
|
||||
sourceOffsets[outChars.length() + 1 - outOffset] = index;
|
||||
}
|
||||
if (c != '\\') {
|
||||
outChars.append(c);
|
||||
continue;
|
||||
}
|
||||
if (index == chars.length()) {
|
||||
outChars.append('\\');
|
||||
return true;
|
||||
}
|
||||
c = chars.charAt(index++);
|
||||
switch (c) {
|
||||
case '/':
|
||||
if (escapeSlash) {
|
||||
outChars.append(c);
|
||||
if (sourceOffsets != null) {
|
||||
sourceOffsets[outChars.length() - outOffset] = index;
|
||||
}
|
||||
}
|
||||
else {
|
||||
outChars.append('\\').append('/');
|
||||
}
|
||||
|
||||
break;
|
||||
case '\n':
|
||||
//do nothing
|
||||
if (sourceOffsets != null) {
|
||||
sourceOffsets[outChars.length() - outOffset] = index;
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
// uuuuu1234 is valid too
|
||||
while (index != chars.length() && chars.charAt(index) == 'u') {
|
||||
index++;
|
||||
}
|
||||
if (index + 4 <= chars.length()) {
|
||||
try {
|
||||
int code = Integer.parseInt(chars.substring(index, index + 4), 16);
|
||||
//line separators are invalid here
|
||||
if (code == 0x000a || code == 0x000d) return false;
|
||||
c = chars.charAt(index);
|
||||
if (c == '+' || c == '-') return false;
|
||||
outChars.append((char)code);
|
||||
index += 4;
|
||||
|
||||
if (sourceOffsets != null) {
|
||||
sourceOffsets[outChars.length() - outOffset] = index;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
outChars.append('\\').append(c);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl#parseStringCharacters(String, StringBuilder, int[])
|
||||
*/
|
||||
public static boolean parseStringCharacters(@NotNull String chars,
|
||||
@NotNull StringBuilder outChars,
|
||||
@Nullable int[] sourceOffsets,
|
||||
final boolean strictBackSlash) {
|
||||
public static boolean parseStringCharacters(@NotNull String chars, @NotNull StringBuilder outChars, @Nullable int[] sourceOffsets) {
|
||||
assert sourceOffsets == null || sourceOffsets.length == chars.length()+1;
|
||||
if (chars.indexOf('\\') < 0) {
|
||||
outChars.append(chars);
|
||||
@@ -371,15 +467,31 @@ public class GrStringUtil {
|
||||
c = chars.charAt(index++);
|
||||
switch (c) {
|
||||
case'b':
|
||||
outChars.append('\b');
|
||||
break;
|
||||
case't':
|
||||
outChars.append('\t');
|
||||
break;
|
||||
case'n':
|
||||
outChars.append('\n');
|
||||
break;
|
||||
case'f':
|
||||
outChars.append('\f');
|
||||
break;
|
||||
case'r':
|
||||
outChars.append('\r');
|
||||
break;
|
||||
case'"':
|
||||
outChars.append('\"');
|
||||
break;
|
||||
case'\'':
|
||||
outChars.append('\'');
|
||||
break;
|
||||
case'$':
|
||||
outChars.append('$');
|
||||
break;
|
||||
case'\\':
|
||||
outChars.append(c);
|
||||
outChars.append('\\');
|
||||
break;
|
||||
case '\n':
|
||||
//do nothing
|
||||
@@ -442,9 +554,6 @@ public class GrStringUtil {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!strictBackSlash) {
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (sourceOffsets != null) {
|
||||
|
||||
@@ -54,7 +54,7 @@ class GroovyCopyPasteTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testEscapeSlashesInRegexFromRegex() {
|
||||
doTest 'a.groovy', 'def x = /<selection>a\\/b</selection>/', 'def x = /smth<caret>/', 'def x = /smtha\\/b<caret>/'
|
||||
doTest 'a.groovy', 'def x = / <selection>a\\/b</selection>/', 'def x = /smth<caret>/', 'def x = /smtha\\/b<caret>/'
|
||||
}
|
||||
|
||||
void testDontEscapeSymbolsInRegex(){
|
||||
@@ -100,4 +100,8 @@ second
|
||||
<caret>"""'''
|
||||
}
|
||||
|
||||
void testPasteInGStringContent() {
|
||||
doTest 'a.groovy', 'def a = <selection>5\\6</selection>', 'def x = "<caret> "', 'def x = "5\\\\6 "'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.annotations.Nullable
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
|
||||
/**
|
||||
* @author Max Medvedev
|
||||
*/
|
||||
class StringValueTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
"${TestUtils.testDataPath}stringValues/"
|
||||
}
|
||||
|
||||
private void doTest(@Nullable String expected) {
|
||||
def file = myFixture.configureByFile("${getTestName(false)}.groovy") as GroovyFile
|
||||
def literal = file.statements[0] as GrLiteral
|
||||
assertEquals expected, literal.value
|
||||
}
|
||||
|
||||
void testString0() {
|
||||
doTest("fo\nabc \r \u1234 \" \' \" ")
|
||||
}
|
||||
|
||||
void testString1() {
|
||||
doTest(null)
|
||||
}
|
||||
|
||||
void testString2() {
|
||||
doTest(null)
|
||||
}
|
||||
|
||||
void testString3() {
|
||||
doTest("fooabc")
|
||||
}
|
||||
|
||||
void testGString() {
|
||||
doTest("abc \' \" ")
|
||||
}
|
||||
|
||||
void testSlashString() {
|
||||
doTest("abc \\a \\n / abc \u1234 \$ \\\$ ")
|
||||
}
|
||||
|
||||
void _testDollarSlashString() {
|
||||
doTest("/abc \\n \\o \u1234 abc \$ / \\\$ /")
|
||||
}
|
||||
}
|
||||
+7
@@ -151,7 +151,14 @@ public class ExpressionsParsingTest extends GroovyParsingTestCase {
|
||||
public void testregex$regex12() throws Throwable { doTest(); }
|
||||
public void testregex$regex13() throws Throwable { doTest(); }
|
||||
public void testregex$regex14() throws Throwable { doTest(); }
|
||||
public void testregex$regex15() throws Throwable { doTest(); }
|
||||
public void testregex$regex16() throws Throwable { doTest(); }
|
||||
public void testregex$regex17() throws Throwable { doTest(); }
|
||||
public void testregex$regex18() throws Throwable { doTest(); }
|
||||
public void testregex$regex19() throws Throwable { doTest(); }
|
||||
public void testregex$regex2() throws Throwable { doTest(); }
|
||||
public void testregex$regex20() throws Throwable { doTest(); }
|
||||
public void testregex$regex21() throws Throwable { doTest(); }
|
||||
public void testregex$regex3() throws Throwable { doTest(); }
|
||||
public void testregex$regex33() throws Throwable { doTest(); }
|
||||
public void testregex$regex4() throws Throwable { doTest(); }
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
print '\n'
|
||||
print <error descr="Illegal escape character in string literal">'\y'</error>
|
||||
ptint <error descr="Illegal escape character in string literal">"\n\a\t"</error>
|
||||
print "\n\a${x}\t"
|
||||
print <error descr="Illegal escape character in string literal">"\n\a${x}\t"</error>
|
||||
print "\n${x}\t"
|
||||
print "\n${x}\"<EOLError descr="String end expected"></EOLError>
|
||||
print "\n\"<EOLError descr="String end expected"></EOLError>
|
||||
print '''\n'''
|
||||
print <error descr="Illegal escape character in string literal">'''\y'''</error>
|
||||
print """\n\a${x}\t"""
|
||||
ptint """""\n\a\t"""
|
||||
print <error descr="Illegal escape character in string literal">"""\n\a${x}\t"""</error>
|
||||
ptint <error descr="Illegal escape character in string literal">"""""\n\a\t"""</error>
|
||||
print """\n${x}\t"""
|
||||
print "dfg\$fg"
|
||||
print 'fg\$fg'
|
||||
print """\n${x}\"""<EOLError descr="String end expected"></EOLError>
|
||||
print (<error descr="Illegal escape character in string literal">/abc\n\r\y\o \u12 /</error>)
|
||||
print (/abc\n\r\y\o \u1234 /)
|
||||
print """\n${x}\"""
|
||||
<EOLError descr="String end expected"></EOLError>
|
||||
+8
-4
@@ -2,7 +2,11 @@
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/aaaa $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('str')
|
||||
PsiElement(regex end)('... bbb/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('aaaa ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('str')
|
||||
PsiElement(regex content)('... bbb')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -2,6 +2,7 @@
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/$1\/')
|
||||
PsiErrorElement:Identifier or code block expected
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$1\/')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
+2
-1
@@ -2,5 +2,6 @@
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/$1\/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$1\/')
|
||||
PsiElement(regex end)('/')
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
/\//
|
||||
-----
|
||||
Groovy script
|
||||
Literal
|
||||
PsiElement(regexp)('/\//')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('\/')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -17,8 +17,10 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=~)('=~')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/[;\/\?:@&=\+\$,%-\.]/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('[;\/\?:@&=\+\$,%-\.]')
|
||||
PsiElement(regex end)('/')
|
||||
PsiElement())(')')
|
||||
PsiElement(.)('.')
|
||||
PsiElement(identifier)('replaceAll')
|
||||
@@ -26,7 +28,4 @@ Groovy script
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(string)('''')
|
||||
PsiElement())(')')
|
||||
|
||||
|
||||
|
||||
PsiElement())(')')
|
||||
+17
-14
@@ -19,18 +19,21 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/\n Hello $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('name')
|
||||
PsiElement(regex content)(',\n today we're $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('\n Hello ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('date')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('\n $ dollar-sign\n $$ dollar-sign\n \ backslash\n / slash\n $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('/')
|
||||
PsiElement(regex end)(' slash\n/$')
|
||||
PsiElement(identifier)('name')
|
||||
PsiElement($/ regex content)(',\n today we're ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Reference expression
|
||||
PsiElement(identifier)('date')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)('\n $ dollar-sign\n $$ dollar-sign\n \ backslash\n / slash\n $/ slash\n')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+17
-14
@@ -18,18 +18,21 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/\n Hello $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('name')
|
||||
PsiElement(regex content)(',\n today we're $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('\n Hello ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('date')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('\n $ dollar-sign\n $$ dollar-sign\n \ backslash\n / slash\n $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('/')
|
||||
PsiElement(regex end)(' slash/$')
|
||||
PsiElement(identifier)('name')
|
||||
PsiElement($/ regex content)(',\n today we're ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Reference expression
|
||||
PsiElement(identifier)('date')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)('\n $ dollar-sign\n $$ dollar-sign\n \ backslash\n / slash\n $/ slash')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+3
-2
@@ -10,5 +10,6 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('$//$')
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+4
-2
@@ -10,5 +10,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('$/$/$')
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('$')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+8
-4
@@ -17,7 +17,11 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/\n def normal = '\b\t\n\r'\n def slashy = /\b\t\n\r/\n assert '$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('alphabet')
|
||||
PsiElement(regex end)(''.size() == 26\n assert normal.size() == 4\n assert slashy.size() == 8\n/$')
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('\n def normal = '\b\t\n\r'\n def slashy = /\b\t\n\r/\n assert '')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('alphabet')
|
||||
PsiElement($/ regex content)(''.size() == 26\n assert normal.size() == 4\n assert slashy.size() == 8\n')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+9
-83
@@ -15,87 +15,13 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Multiplicative expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('$')
|
||||
PsiElement(/)('/')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiErrorElement:Expression expected
|
||||
<empty list>
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('normal')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(string)(''\b\t\n\r'')
|
||||
PsiElement(new line)('\n ')
|
||||
Variable definitions
|
||||
Modifiers
|
||||
PsiElement(def)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
Variable
|
||||
PsiElement(identifier)('slashy')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/\b\t\n\r/')
|
||||
PsiElement(new line)('\n ')
|
||||
ASSERT statement
|
||||
PsiElement(assert)('assert')
|
||||
PsiWhiteSpace(' ')
|
||||
Relational expression
|
||||
Method call
|
||||
Reference expression
|
||||
Literal
|
||||
PsiElement(string)(''$alphabet'')
|
||||
PsiElement(.)('.')
|
||||
PsiElement(identifier)('size')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(==)('==')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('26')
|
||||
PsiElement(new line)('\n ')
|
||||
ASSERT statement
|
||||
PsiElement(assert)('assert')
|
||||
PsiWhiteSpace(' ')
|
||||
Relational expression
|
||||
Method call
|
||||
Reference expression
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('\n def normal = '\b\t\n\r'\n def slashy = /\b\t\n\r/\n assert '')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('normal')
|
||||
PsiElement(.)('.')
|
||||
PsiElement(identifier)('size')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(==)('==')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('4')
|
||||
PsiElement(new line)('\n ')
|
||||
ASSERT statement
|
||||
PsiElement(assert)('assert')
|
||||
PsiWhiteSpace(' ')
|
||||
Relational expression
|
||||
Method call
|
||||
Reference expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('slashy')
|
||||
PsiElement(.)('.')
|
||||
PsiElement(identifier)('size')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(==)('==')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(Integer)('8')
|
||||
PsiElement(identifier)('alphabet')
|
||||
PsiElement($/ regex content)(''.size() == 26\n assert normal.size() == 4\n assert slashy.size() == 8')
|
||||
PsiErrorElement:Dollar slash ending expected
|
||||
<empty list>
|
||||
+27
-17
@@ -11,20 +11,30 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/ $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Literal
|
||||
PsiElement(regexp)('$/ a /$')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Literal
|
||||
PsiElement(regexp)('$/ b /$')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)(' /$')
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' a ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' b ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)(' ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+3
-5
@@ -10,9 +10,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Multiplicative expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('$')
|
||||
PsiElement(/)('/')
|
||||
PsiErrorElement:Expression expected
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiErrorElement:Dollar slash ending expected
|
||||
<empty list>
|
||||
+4
-2
@@ -16,5 +16,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('$/(?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/$')
|
||||
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)('/$')
|
||||
Vendored
+4
-2
@@ -17,8 +17,10 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Multiplicative expression
|
||||
Literal
|
||||
PsiElement(regexp)('$/(?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/$')
|
||||
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)('/$')
|
||||
PsiElement(/)('/')
|
||||
Reference expression
|
||||
PsiElement(identifier)('$')
|
||||
+5
-141
@@ -15,144 +15,8 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Conditional expression
|
||||
Multiplicative expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('$')
|
||||
PsiElement(/)('/')
|
||||
Parenthesized expression
|
||||
PsiElement(()('(')
|
||||
PsiErrorElement:Expression expected
|
||||
<empty list>
|
||||
PsiElement(?)('?')
|
||||
Reference expression
|
||||
PsiElement(identifier)('x')
|
||||
PsiErrorElement:':' expected
|
||||
<empty list>
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(wrong token)('#')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('enable')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('whitespace')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('and')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('comments')
|
||||
PsiElement(new line)('\n')
|
||||
Parenthesized expression
|
||||
PsiElement(()('(')
|
||||
Elvis expression
|
||||
Parenthesized expression
|
||||
PsiElement(()('(')
|
||||
PsiErrorElement:Expression expected
|
||||
<empty list>
|
||||
PsiElement(?:)('?:')
|
||||
Bitwise expression
|
||||
Literal
|
||||
PsiElement(Integer)('19')
|
||||
PsiElement(|)('|')
|
||||
Literal
|
||||
PsiElement(Integer)('20')
|
||||
PsiElement())(')')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(wrong token)('\')
|
||||
PsiElement(identifier)('d')
|
||||
PsiElement(wrong token)('\')
|
||||
PsiElement(identifier)('d')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(wrong token)('#')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('year')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(()('(')
|
||||
PsiElement(identifier)('group')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Integer)('1')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(()('(')
|
||||
PsiElement(identifier)('non')
|
||||
PsiElement(-)('-')
|
||||
PsiElement(identifier)('capture')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('alternation')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(for)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('century')
|
||||
PsiElement())(')')
|
||||
PsiElement(new line)('\n')
|
||||
Generalized list
|
||||
PsiElement([)('[')
|
||||
Unary expression
|
||||
PsiElement(-)('-')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/.] # seperator\n(0[1-9]|1[012]) # month (group 2)\n[- /')
|
||||
PsiElement(.)('.')
|
||||
PsiErrorElement:Property selector expected
|
||||
<empty list>
|
||||
PsiElement(])(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(wrong token)('#')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('seperator')
|
||||
PsiElement(new line)('\n')
|
||||
Parenthesized expression
|
||||
PsiElement(()('(')
|
||||
Bitwise expression
|
||||
Bitwise expression
|
||||
Property by index
|
||||
Literal
|
||||
PsiElement(Integer)('0')
|
||||
Arguments
|
||||
PsiElement([)('[')
|
||||
Additive expression
|
||||
Literal
|
||||
PsiElement(Integer)('1')
|
||||
PsiElement(-)('-')
|
||||
Literal
|
||||
PsiElement(Integer)('9')
|
||||
PsiElement(])(']')
|
||||
PsiElement(|)('|')
|
||||
Property by index
|
||||
Generalized list
|
||||
PsiElement([)('[')
|
||||
Literal
|
||||
PsiElement(Integer)('12')
|
||||
PsiElement(])(']')
|
||||
Arguments
|
||||
PsiElement([)('[')
|
||||
Additive expression
|
||||
Literal
|
||||
PsiElement(Integer)('0')
|
||||
PsiElement(-)('-')
|
||||
Literal
|
||||
PsiElement(Integer)('9')
|
||||
PsiElement(])(']')
|
||||
PsiElement(|)('|')
|
||||
Property by index
|
||||
Literal
|
||||
PsiElement(Integer)('3')
|
||||
Arguments
|
||||
PsiElement([)('[')
|
||||
Literal
|
||||
PsiElement(Integer)('01')
|
||||
PsiElement(])(']')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(wrong token)('#')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('day')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(()('(')
|
||||
PsiElement(identifier)('group')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Integer)('3')
|
||||
PsiElement())(')')
|
||||
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>
|
||||
+44
-28
@@ -11,31 +11,47 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/ $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Literal
|
||||
PsiElement(regexp)('$/ a /$')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/ $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(regex content)(' $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Literal
|
||||
PsiElement(regexp)('$/ c /$')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)(' /$')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)(' /$')
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' a ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement($/ regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)(' c ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)(' ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)(' ')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+20
-63
@@ -18,66 +18,23 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Multiplicative expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('$')
|
||||
PsiElement(/)('/')
|
||||
PsiElement(new line)('\n ')
|
||||
Reference expression
|
||||
PsiElement(identifier)('Hello')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(identifier)('$name')
|
||||
PsiElement(,)(',')
|
||||
PsiElement(new line)('\n ')
|
||||
Reference expression
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('today')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Reference expression
|
||||
PsiElement(identifier)('we')
|
||||
PsiElement(string)(''re ${date}')
|
||||
PsiElement(new line)('\n ')
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('$')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('dollar')
|
||||
PsiElement(-)('-')
|
||||
Reference expression
|
||||
PsiElement(identifier)('sign')
|
||||
PsiElement(new line)('\n ')
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('$$')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('dollar')
|
||||
PsiElement(-)('-')
|
||||
Reference expression
|
||||
PsiElement(identifier)('sign')
|
||||
PsiElement(new line)('\n ')
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(wrong token)('\')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(identifier)('backslash')
|
||||
PsiElement(new line)('\n ')
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(regexp)('/ slash\n $/')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Reference expression
|
||||
PsiElement(identifier)('slash')
|
||||
PsiElement(new line)('\n')
|
||||
Literal
|
||||
PsiElement(wrong regex)('/')
|
||||
PsiErrorElement:Wrong string literal
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('\n Hello ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('name')
|
||||
PsiElement($/ regex content)(',\n today we're ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Reference expression
|
||||
PsiElement(identifier)('date')
|
||||
PsiElement(})('}')
|
||||
PsiElement($/ regex content)('\n $ dollar-sign\n $$ dollar-sign\n \ backslash\n / slash\n $/ slash\n/')
|
||||
PsiErrorElement:Dollar slash ending expected
|
||||
<empty list>
|
||||
+4
-2
@@ -10,5 +10,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('$/C:\temp\/$')
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('C:\temp\')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+8
-4
@@ -15,7 +15,11 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('$/\n <xml>\n $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('tic')
|
||||
PsiElement(regex end)('\tac\n </xml>\n/$')
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('\n <xml>\n ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('tic')
|
||||
PsiElement($/ regex content)('\tac\n </xml>\n')
|
||||
PsiElement($/ regex end)('/$')
|
||||
+4
-2
@@ -14,5 +14,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/\nto be\nor\nnot to be\n/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('\nto be\nor\nnot to be\n')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -7,5 +7,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/abc/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -8,37 +8,47 @@ Groovy script
|
||||
PsiElement(==~)('==~')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abc \${do "def $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(+)('+')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('} fgh$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(regex content)(' $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Method call
|
||||
Property selection
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc \${do "def ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('frg')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regexp)('/sdf/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement())(')')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)(' /')
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(+)('+')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('} fgh')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Method call
|
||||
Property selection
|
||||
Reference expression
|
||||
PsiElement(identifier)('frg')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('sdf')
|
||||
PsiElement(regex end)('/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement())(')')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' ')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -7,8 +7,10 @@ Groovy script
|
||||
Reference expression
|
||||
PsiElement(identifier)('i')
|
||||
PsiElement(=)('=')
|
||||
Literal
|
||||
PsiElement(regexp)('/ab \\ncd/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('ab \\ncd')
|
||||
PsiElement(regex end)('/')
|
||||
PsiElement(new line)('\n')
|
||||
Assignment expression
|
||||
Reference expression
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
-----
|
||||
Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/abc/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -11,13 +11,19 @@ Groovy script
|
||||
PsiElement(()('(')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/asd $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Literal
|
||||
PsiElement(regexp)('/bugaga/')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)(' asd/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('asd ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('bugaga')
|
||||
PsiElement(regex end)('/')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' asd')
|
||||
PsiElement(regex end)('/')
|
||||
PsiElement())(')')
|
||||
@@ -0,0 +1,7 @@
|
||||
/$/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -0,0 +1,8 @@
|
||||
/$
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement($)('$')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
@@ -0,0 +1,7 @@
|
||||
/sgfdhj$5dhfg/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('sgfdhj$5dhfg')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -0,0 +1,7 @@
|
||||
/gsdfjk$ gsdkf$ $/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('gsdfjk$ gsdkf$ $')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -0,0 +1,22 @@
|
||||
/$${5}$$$$ref$$$/
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('$')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('$$$')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ref')
|
||||
PsiElement(regex content)('$$$')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -30,5 +30,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/abc/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -0,0 +1,14 @@
|
||||
print (/a\${2}/)
|
||||
-----
|
||||
Groovy script
|
||||
Method call
|
||||
Reference expression
|
||||
PsiElement(identifier)('print')
|
||||
PsiWhiteSpace(' ')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('a\${2}')
|
||||
PsiElement(regex end)('/')
|
||||
PsiElement())(')')
|
||||
@@ -0,0 +1,7 @@
|
||||
$/abc/$
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('abc')
|
||||
PsiElement($/ regex end)('/$')
|
||||
@@ -1,5 +1,7 @@
|
||||
/abc/
|
||||
-----
|
||||
Groovy script
|
||||
Literal
|
||||
PsiElement(regexp)('/abc/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -8,5 +8,6 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abs$$$')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abs$$$')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -3,8 +3,10 @@
|
||||
-----
|
||||
Groovy script
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(regexp)('/asd\n/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('asd\n')
|
||||
PsiElement(regex end)('/')
|
||||
Command arguments
|
||||
Reference expression
|
||||
PsiElement(identifier)('abcdef')
|
||||
@@ -13,5 +13,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=~)('=~')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/o(b.*r)f/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('o(b.*r)f')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -13,5 +13,7 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=~)('=~')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/\$(.*)\./')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('\$(.*)\.')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -7,15 +7,19 @@ Groovy script
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/foo$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)('d/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('foo')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('d')
|
||||
PsiElement(regex end)('/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
|
||||
@@ -8,53 +8,63 @@ Groovy script
|
||||
PsiElement(==~)('==~')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abc $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('doo')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Compound Gstring
|
||||
PsiElement(Gstring begin)('"')
|
||||
PsiElement(Gstring content)('def ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(+)('+')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(})('}')
|
||||
PsiElement(Gstring end)('"')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' fgh$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(regex content)(' $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Method call
|
||||
Property selection
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('frg')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regexp)('/sdf/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement())(')')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex end)(' /')
|
||||
PsiElement(identifier)('doo')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Compound Gstring
|
||||
PsiElement(Gstring begin)('"')
|
||||
PsiElement(Gstring content)('def ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(+)('+')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(})('}')
|
||||
PsiElement(Gstring end)('"')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' fgh')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Method call
|
||||
Property selection
|
||||
Reference expression
|
||||
PsiElement(identifier)('frg')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('sdf')
|
||||
PsiElement(regex end)('/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement())(')')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' ')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -9,56 +9,64 @@ Groovy script
|
||||
PsiElement(==~)('==~')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abc $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('doo')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Compound Gstring
|
||||
PsiElement(Gstring begin)('"')
|
||||
PsiElement(Gstring content)('def ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(+)('+')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(})('}')
|
||||
PsiElement(Gstring end)('"')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' fgh$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(regex content)(' $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Method call
|
||||
Property selection
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abc ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('frg')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regexp)('/sdf/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement())(')')
|
||||
PsiElement(})('}')
|
||||
PsiErrorElement:Identifier or code block expected
|
||||
<empty list>
|
||||
PsiErrorElement:';' or new line expected
|
||||
PsiElement(wrong regex)('\ni = 5')
|
||||
PsiElement(identifier)('doo')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Compound Gstring
|
||||
PsiElement(Gstring begin)('"')
|
||||
PsiElement(Gstring content)('def ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Additive expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(+)('+')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
PsiElement(})('}')
|
||||
PsiElement(Gstring end)('"')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' fgh')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('st')
|
||||
PsiElement(regex content)(' ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Method call
|
||||
Property selection
|
||||
Reference expression
|
||||
PsiElement(identifier)('frg')
|
||||
PsiElement(.)('.')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('sdf')
|
||||
PsiElement(regex end)('/')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(Integer)('5')
|
||||
PsiElement())(')')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)('\ni = 5')
|
||||
PsiErrorElement:Regex ending expected
|
||||
<empty list>
|
||||
@@ -1,5 +1,7 @@
|
||||
/temp_regex/
|
||||
-----
|
||||
Groovy script
|
||||
Literal
|
||||
PsiElement(regexp)('/temp_regex/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('temp_regex')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -2,5 +2,7 @@
|
||||
-----
|
||||
Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
PsiElement(regexp)('/temp_regex/')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('temp_regex')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -11,5 +11,6 @@ Groovy script
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/I cost $$@$@$$')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('I cost $$@$@$$')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -2,7 +2,11 @@
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abcde $2 $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident')
|
||||
PsiElement(regex end)(' asd/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abcde $2 ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident')
|
||||
PsiElement(regex content)(' asd')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -2,10 +2,16 @@
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abcde $2$$ $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident')
|
||||
PsiElement(regex content)(' $$ $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident2')
|
||||
PsiElement(regex end)(' asd/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abcde $2$$ ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident')
|
||||
PsiElement(regex content)(' $$ ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident2')
|
||||
PsiElement(regex content)(' asd')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -2,18 +2,28 @@
|
||||
-----
|
||||
Groovy script
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/abcde $2$$ $')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/asdc $$ asdd $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident3')
|
||||
PsiElement(regex end)(' 123/')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' $$ $')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident2')
|
||||
PsiElement(regex end)(' asd/')
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('abcde $2$$ ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Closable block
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('asdc $$ asdd ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident3')
|
||||
PsiElement(regex content)(' 123')
|
||||
PsiElement(regex end)('/')
|
||||
PsiElement(})('}')
|
||||
PsiElement(regex content)(' $$ ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(identifier)('ident2')
|
||||
PsiElement(regex content)(' asd')
|
||||
PsiElement(regex end)('/')
|
||||
@@ -18,8 +18,10 @@ Groovy script
|
||||
PsiWhiteSpace(' ')
|
||||
Unary expression
|
||||
PsiElement(~)('~')
|
||||
Literal
|
||||
PsiElement(regexp)('/..../')
|
||||
Compound regular expression
|
||||
PsiElement(regex begin)('/')
|
||||
PsiElement(regex content)('....')
|
||||
PsiElement(regex end)('/')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(:)(':')
|
||||
PsiElement(new line)('\n')
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
$/abc \n \o \u1234 \
|
||||
abc $ / \$ /$
|
||||
@@ -0,0 +1 @@
|
||||
"abc ' \" "
|
||||
@@ -0,0 +1,2 @@
|
||||
/abc \a \n \/ \
|
||||
abc \u1234 $ \$ /
|
||||
@@ -0,0 +1 @@
|
||||
'fo\nabc \r \u1234 \" \' \" '
|
||||
@@ -0,0 +1 @@
|
||||
'fo\nabc \r \u123'
|
||||
@@ -0,0 +1 @@
|
||||
'fo\nabc \i'
|
||||
@@ -0,0 +1,2 @@
|
||||
'''foo\
|
||||
abc'''
|
||||
Reference in New Issue
Block a user