mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] module declaration parsing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.psi;
|
||||
import com.intellij.psi.javadoc.*;
|
||||
|
||||
public abstract class JavaElementVisitor extends PsiElementVisitor {
|
||||
|
||||
public void visitAnonymousClass(PsiAnonymousClass aClass) {
|
||||
visitClass(aClass);
|
||||
}
|
||||
@@ -387,4 +386,28 @@ public abstract class JavaElementVisitor extends PsiElementVisitor {
|
||||
public void visitLambdaExpression(PsiLambdaExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitModule(PsiJavaModule module) {
|
||||
visitElement(module);
|
||||
}
|
||||
|
||||
public void visitModuleReference(PsiJavaModuleReference moduleRef) {
|
||||
visitElement(moduleRef);
|
||||
}
|
||||
|
||||
public void visitRequiresStatement(PsiRequiresStatement statement) {
|
||||
visitElement(statement);
|
||||
}
|
||||
|
||||
public void visitExportsStatement(PsiExportsStatement statement) {
|
||||
visitElement(statement);
|
||||
}
|
||||
|
||||
public void visitUsesStatement(PsiUsesStatement statement) {
|
||||
visitElement(statement);
|
||||
}
|
||||
|
||||
public void visitProvidesStatement(PsiProvidesStatement statement) {
|
||||
visitElement(statement);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -139,4 +139,12 @@ public interface JavaTokenType extends TokenType {
|
||||
|
||||
IElementType DOUBLE_COLON = new IJavaElementType("DOUBLE_COLON");
|
||||
IElementType ARROW = new IJavaElementType("ARROW");
|
||||
}
|
||||
|
||||
IElementType MODULE_KEYWORD = new IJavaElementType("MODULE");
|
||||
IElementType REQUIRES_KEYWORD = new IJavaElementType("REQUIRES");
|
||||
IElementType EXPORTS_KEYWORD = new IJavaElementType("EXPORTS");
|
||||
IElementType USES_KEYWORD = new IJavaElementType("USES");
|
||||
IElementType PROVIDES_KEYWORD = new IJavaElementType("PROVIDES");
|
||||
IElementType TO_KEYWORD = new IJavaElementType("TO");
|
||||
IElementType WITH_KEYWORD = new IJavaElementType("WITH");
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi;
|
||||
|
||||
/**
|
||||
* Represents an {@code exports} statement of a Java module declaration.
|
||||
*
|
||||
* @since 2016.3
|
||||
*/
|
||||
public interface PsiExportsStatement extends PsiElement {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a Java module declaration.
|
||||
*
|
||||
* @since 2016.3
|
||||
*/
|
||||
public interface PsiJavaModule extends PsiElement {
|
||||
@Nullable PsiJavaModuleReference getNameElement();
|
||||
@Nullable String getModuleName();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a reference to some module inside a Java module declaration.
|
||||
*
|
||||
* @since 2016.3
|
||||
*/
|
||||
public interface PsiJavaModuleReference extends PsiElement {
|
||||
@NotNull String getReferenceText();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -19,7 +19,6 @@ package com.intellij.psi;
|
||||
* Represents a Java keyword. Constants defined in this interface represent all
|
||||
* keywords of the Java language.
|
||||
*/
|
||||
@SuppressWarnings({"HardCodedStringLiteral", "JavaDoc"})
|
||||
public interface PsiKeyword extends PsiJavaToken {
|
||||
String ABSTRACT = "abstract";
|
||||
String ASSERT = "assert";
|
||||
@@ -75,4 +74,11 @@ public interface PsiKeyword extends PsiJavaToken {
|
||||
String TRUE = "true";
|
||||
String FALSE = "false";
|
||||
String NULL = "null";
|
||||
}
|
||||
|
||||
String REQUIRES = "requires";
|
||||
String EXPORTS = "exports";
|
||||
String USES = "uses";
|
||||
String PROVIDES = "provides";
|
||||
String TO = "to";
|
||||
String WITH = "with";
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi;
|
||||
|
||||
/**
|
||||
* Represents a {@code provides} statement of a Java module declaration.
|
||||
*
|
||||
* @since 2016.3
|
||||
*/
|
||||
public interface PsiProvidesStatement extends PsiElement {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi;
|
||||
|
||||
/**
|
||||
* Represents a {@code requires} statement of a Java module declaration.
|
||||
*
|
||||
* @since 2016.3
|
||||
*/
|
||||
public interface PsiRequiresStatement extends PsiElement {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi;
|
||||
|
||||
/**
|
||||
* Represents a {@code uses} statement of a Java module declaration.
|
||||
*
|
||||
* @since 2016.3
|
||||
*/
|
||||
public interface PsiUsesStatement extends PsiElement {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -53,6 +53,11 @@ public class FileParser {
|
||||
@NotNull final TokenSet importListStoppers,
|
||||
@NotNull final AbstractBundle bundle,
|
||||
@NotNull final String errorMessageKey) {
|
||||
if ("module".equals(builder.getTokenText())) {
|
||||
ModuleParser.parseModule(builder);
|
||||
return;
|
||||
}
|
||||
|
||||
parsePackageStatement(builder);
|
||||
|
||||
Pair<PsiBuilder.Marker, Boolean> impListInfo = parseImportList(builder, importListStoppers);
|
||||
@@ -189,4 +194,4 @@ public class FileParser {
|
||||
done(statement, type);
|
||||
return statement;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.lang.java.parser;
|
||||
|
||||
import com.intellij.codeInsight.daemon.JavaErrorMessages;
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiKeyword;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.lang.PsiBuilderUtil.expect;
|
||||
import static com.intellij.lang.java.parser.JavaParserUtil.error;
|
||||
import static com.intellij.lang.java.parser.JavaParserUtil.semicolon;
|
||||
|
||||
public class ModuleParser {
|
||||
public static void parseModule(@NotNull PsiBuilder builder) {
|
||||
PsiBuilder.Marker module = builder.mark();
|
||||
mapAndAdvance(builder, JavaTokenType.MODULE_KEYWORD);
|
||||
|
||||
if (parseName(builder) == null) {
|
||||
module.drop();
|
||||
if (builder.getTokenType() != null) {
|
||||
parseExtras(builder, JavaErrorMessages.message("expected.module.declaration"));
|
||||
}
|
||||
else {
|
||||
error(builder, JavaErrorMessages.message("expected.identifier"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!expect(builder, JavaTokenType.LBRACE)) {
|
||||
if (builder.getTokenType() != null) {
|
||||
parseExtras(builder, JavaErrorMessages.message("expected.module.declaration"));
|
||||
}
|
||||
else {
|
||||
error(builder, JavaErrorMessages.message("expected.lbrace"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
parseModuleContent(builder);
|
||||
}
|
||||
|
||||
module.done(JavaElementType.MODULE);
|
||||
|
||||
if (builder.getTokenType() != null) {
|
||||
parseExtras(builder, JavaErrorMessages.message("unexpected.tokens"));
|
||||
}
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseName(PsiBuilder builder) {
|
||||
PsiBuilder.Marker nameElement = builder.mark();
|
||||
boolean empty = true;
|
||||
|
||||
boolean idExpected = true;
|
||||
while (true) {
|
||||
IElementType t = builder.getTokenType();
|
||||
if (t == JavaTokenType.IDENTIFIER) {
|
||||
if (!idExpected) error(builder, JavaErrorMessages.message("expected.dot"));
|
||||
idExpected = false;
|
||||
}
|
||||
else if (t == JavaTokenType.DOT) {
|
||||
if (idExpected) error(builder, JavaErrorMessages.message("expected.identifier"));
|
||||
idExpected = true;
|
||||
}
|
||||
else break;
|
||||
builder.advanceLexer();
|
||||
empty = false;
|
||||
}
|
||||
|
||||
if (!empty) {
|
||||
if (idExpected) error(builder, JavaErrorMessages.message("expected.identifier"));
|
||||
nameElement.done(JavaElementType.MODULE_REFERENCE);
|
||||
return nameElement;
|
||||
}
|
||||
else {
|
||||
nameElement.drop();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseModuleContent(PsiBuilder builder) {
|
||||
IElementType token;
|
||||
PsiBuilder.Marker invalid = null;
|
||||
|
||||
while ((token = builder.getTokenType()) != null) {
|
||||
if (token == JavaTokenType.RBRACE) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (token == JavaTokenType.SEMICOLON) {
|
||||
if (invalid != null) {
|
||||
invalid.error(JavaErrorMessages.message("expected.module.statement"));
|
||||
invalid = null;
|
||||
}
|
||||
builder.advanceLexer();
|
||||
continue;
|
||||
}
|
||||
|
||||
PsiBuilder.Marker statement = parseStatement(builder);
|
||||
if (statement == null) {
|
||||
if (invalid == null) invalid = builder.mark();
|
||||
builder.advanceLexer();
|
||||
}
|
||||
else if (invalid != null) {
|
||||
invalid.errorBefore(JavaErrorMessages.message("expected.module.statement"), statement);
|
||||
invalid = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (invalid != null) {
|
||||
invalid.error(JavaErrorMessages.message("expected.module.statement"));
|
||||
}
|
||||
|
||||
if (!expect(builder, JavaTokenType.RBRACE) && invalid == null) {
|
||||
error(builder, JavaErrorMessages.message("expected.rbrace"));
|
||||
}
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseStatement(PsiBuilder builder) {
|
||||
String kw = builder.getTokenText();
|
||||
if (PsiKeyword.REQUIRES.equals(kw)) return parseRequiresStatement(builder);
|
||||
if (PsiKeyword.EXPORTS.equals(kw)) return parseExportsStatement(builder);
|
||||
if (PsiKeyword.USES.equals(kw)) return parseUsesStatement(builder);
|
||||
if (PsiKeyword.PROVIDES.equals(kw)) return parseProvidesStatement(builder);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseRequiresStatement(PsiBuilder builder) {
|
||||
PsiBuilder.Marker statement = builder.mark();
|
||||
mapAndAdvance(builder, JavaTokenType.REQUIRES_KEYWORD);
|
||||
|
||||
expect(builder, JavaTokenType.PUBLIC_KEYWORD);
|
||||
|
||||
if (parseNameRef(builder) != null) {
|
||||
semicolon(builder);
|
||||
}
|
||||
else {
|
||||
expect(builder, JavaTokenType.SEMICOLON);
|
||||
}
|
||||
|
||||
statement.done(JavaElementType.REQUIRES_STATEMENT);
|
||||
return statement;
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseExportsStatement(PsiBuilder builder) {
|
||||
PsiBuilder.Marker statement = builder.mark();
|
||||
boolean hasError = false;
|
||||
mapAndAdvance(builder, JavaTokenType.EXPORTS_KEYWORD);
|
||||
|
||||
if (parseClassOrPackageRef(builder) != null) {
|
||||
if (PsiKeyword.TO.equals(builder.getTokenText())) {
|
||||
mapAndAdvance(builder, JavaTokenType.TO_KEYWORD);
|
||||
|
||||
while (true) {
|
||||
PsiBuilder.Marker ref = parseNameRef(builder);
|
||||
if (!expect(builder, JavaTokenType.COMMA)) {
|
||||
if (ref == null) hasError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
error(builder, JavaErrorMessages.message("expected.package.reference"));
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (!hasError) {
|
||||
semicolon(builder);
|
||||
}
|
||||
else {
|
||||
expect(builder, JavaTokenType.SEMICOLON);
|
||||
}
|
||||
|
||||
statement.done(JavaElementType.EXPORTS_STATEMENT);
|
||||
return statement;
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseUsesStatement(PsiBuilder builder) {
|
||||
PsiBuilder.Marker statement = builder.mark();
|
||||
mapAndAdvance(builder, JavaTokenType.USES_KEYWORD);
|
||||
|
||||
if (parseClassOrPackageRef(builder) != null) {
|
||||
semicolon(builder);
|
||||
}
|
||||
else {
|
||||
error(builder, JavaErrorMessages.message("expected.class.reference"));
|
||||
expect(builder, JavaTokenType.SEMICOLON);
|
||||
}
|
||||
|
||||
statement.done(JavaElementType.USES_STATEMENT);
|
||||
return statement;
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseProvidesStatement(PsiBuilder builder) {
|
||||
PsiBuilder.Marker statement = builder.mark();
|
||||
boolean hasError = false;
|
||||
mapAndAdvance(builder, JavaTokenType.PROVIDES_KEYWORD);
|
||||
|
||||
if (parseClassOrPackageRef(builder) == null) {
|
||||
error(builder, JavaErrorMessages.message("expected.class.reference"));
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (PsiKeyword.WITH.equals(builder.getTokenText())) {
|
||||
mapAndAdvance(builder, JavaTokenType.WITH_KEYWORD);
|
||||
if (parseClassOrPackageRef(builder) == null) {
|
||||
error(builder, JavaErrorMessages.message("expected.class.reference"));
|
||||
hasError = true;
|
||||
}
|
||||
}
|
||||
else if (!hasError) {
|
||||
error(builder, JavaErrorMessages.message("expected.with"));
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (!hasError) {
|
||||
semicolon(builder);
|
||||
}
|
||||
else {
|
||||
expect(builder, JavaTokenType.SEMICOLON);
|
||||
}
|
||||
|
||||
statement.done(JavaElementType.PROVIDES_STATEMENT);
|
||||
return statement;
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseNameRef(PsiBuilder builder) {
|
||||
PsiBuilder.Marker name = parseName(builder);
|
||||
if (name == null) {
|
||||
error(builder, JavaErrorMessages.message("expected.identifier"));
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private static void mapAndAdvance(PsiBuilder builder, IElementType keyword) {
|
||||
builder.remapCurrentToken(keyword);
|
||||
builder.advanceLexer();
|
||||
}
|
||||
|
||||
private static void parseExtras(PsiBuilder builder, String message) {
|
||||
PsiBuilder.Marker extras = builder.mark();
|
||||
while (builder.getTokenType() != null) builder.advanceLexer();
|
||||
extras.error(message);
|
||||
}
|
||||
|
||||
private static PsiBuilder.Marker parseClassOrPackageRef(PsiBuilder builder) {
|
||||
return JavaParser.INSTANCE.getReferenceParser().parseJavaCodeReference(builder, true, false, false, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiExportsStatement;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiExportsStatementImpl extends CompositePsiElement implements PsiExportsStatement {
|
||||
public PsiExportsStatementImpl() {
|
||||
super(JavaElementType.EXPORTS_STATEMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitExportsStatement(this);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiExportsStatement";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PsiJavaModuleImpl extends CompositePsiElement implements PsiJavaModule {
|
||||
public PsiJavaModuleImpl() {
|
||||
super(JavaElementType.MODULE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiJavaModuleReference getNameElement() {
|
||||
return PsiTreeUtil.getChildOfType(this, PsiJavaModuleReference.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
PsiJavaModuleReference nameElement = getNameElement();
|
||||
return nameElement != null ? nameElement.getReferenceText() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitModule(this);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiJavaModule:" + getModuleName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiJavaModuleReferenceImpl extends CompositePsiElement implements PsiJavaModuleReference {
|
||||
public PsiJavaModuleReferenceImpl() {
|
||||
super(JavaElementType.MODULE_REFERENCE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getReferenceText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PsiElement e = getFirstChild(); e != null; e = e.getNextSibling()) {
|
||||
if (!(e instanceof PsiWhiteSpace) && !(e instanceof PsiComment)) {
|
||||
sb.append(e.getText());
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitModuleReference(this);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiJavaModuleReference";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiProvidesStatement;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiProvidesStatementImpl extends CompositePsiElement implements PsiProvidesStatement {
|
||||
public PsiProvidesStatementImpl() {
|
||||
super(JavaElementType.PROVIDES_STATEMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitProvidesStatement(this);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiProvidesStatement";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiRequiresStatement;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiRequiresStatementImpl extends CompositePsiElement implements PsiRequiresStatement {
|
||||
public PsiRequiresStatementImpl() {
|
||||
super(JavaElementType.REQUIRES_STATEMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitRequiresStatement(this);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiRequiresStatement";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiUsesStatement;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiUsesStatementImpl extends CompositePsiElement implements PsiUsesStatement {
|
||||
public PsiUsesStatementImpl() {
|
||||
super(JavaElementType.USES_STATEMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitUsesStatement(this);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiUsesStatement";
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,13 @@ public interface JavaElementType {
|
||||
IElementType ANNOTATION_ARRAY_INITIALIZER = new JavaCompositeElementType("ANNOTATION_ARRAY_INITIALIZER", PsiArrayInitializerMemberValueImpl.class);
|
||||
IElementType RECEIVER_PARAMETER = new JavaCompositeElementType("RECEIVER", PsiReceiverParameterImpl.class);
|
||||
|
||||
IElementType MODULE = new JavaCompositeElementType("MODULE", PsiJavaModuleImpl.class);
|
||||
IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_NAME", PsiJavaModuleReferenceImpl.class);
|
||||
IElementType REQUIRES_STATEMENT = new JavaCompositeElementType("REQUIRES_STATEMENT", PsiRequiresStatementImpl.class);
|
||||
IElementType EXPORTS_STATEMENT = new JavaCompositeElementType("EXPORTS_STATEMENT", PsiExportsStatementImpl.class);
|
||||
IElementType USES_STATEMENT = new JavaCompositeElementType("USES_STATEMENT", PsiUsesStatementImpl.class);
|
||||
IElementType PROVIDES_STATEMENT = new JavaCompositeElementType("PROVIDES_STATEMENT", PsiProvidesStatementImpl.class);
|
||||
|
||||
class ICodeBlockElementType extends IErrorCounterReparseableElementType implements ICompositeElementType, ILightLazyParseableElementType {
|
||||
private ICodeBlockElementType() {
|
||||
super("CODE_BLOCK", JavaLanguage.INSTANCE);
|
||||
|
||||
@@ -336,6 +336,7 @@ expected.rbracket=']' expected
|
||||
expected.expression=Expression expected
|
||||
expected.semicolon=';' expected
|
||||
expected.class.reference=Class reference expected
|
||||
expected.package.reference=Package reference expected
|
||||
expected.lparen='(' expected
|
||||
expected.rparen=')' expected
|
||||
expected.eq='=' expected
|
||||
@@ -351,6 +352,7 @@ expected.type.parameter=Type parameter expected
|
||||
expected.comma=',' expected
|
||||
expected.comma.or.rparen=',' or ')' expected
|
||||
expected.colon=':' expected
|
||||
expected.dot='.' expected
|
||||
expected.type=Type expected
|
||||
expected.lbracket='[' expected
|
||||
expected.lparen.or.lbracket='(' or '[' expected
|
||||
@@ -365,6 +367,10 @@ expected.statement=Statement expected
|
||||
expected.while='while' expected
|
||||
expected.catch.or.finally='catch' or 'finally' expected
|
||||
expected.boolean.expression=Boolean expression expected
|
||||
expected.with='with' expected
|
||||
expected.module.declaration=Module declaration expected
|
||||
expected.module.statement=Module statement expected
|
||||
|
||||
error.cannot.resolve.class=Cannot resolve class ''{0}''
|
||||
error.cannot.resolve.class.or.package=Cannot resolve class or package ''{0}''
|
||||
expected.class.or.package=Expected class or package
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
PsiJavaFile:BadContent.java
|
||||
PsiJavaModule:X
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiErrorElement:Module statement expected
|
||||
PsiIdentifier:some('some')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:junk('junk')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,15 @@
|
||||
PsiJavaFile:Exports0.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiErrorElement:Package reference expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,20 @@
|
||||
PsiJavaFile:Exports1.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,19 @@
|
||||
PsiJavaFile:Exports2.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,22 @@
|
||||
PsiJavaFile:Exports3.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:TO('to')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,24 @@
|
||||
PsiJavaFile:Exports4.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:TO('to')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,25 @@
|
||||
PsiJavaFile:Exports5.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:TO('to')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,26 @@
|
||||
PsiJavaFile:Exports6.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:TO('to')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,28 @@
|
||||
PsiJavaFile:Exports7.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:TO('to')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,28 @@
|
||||
PsiJavaFile:Exports8.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExportsStatement
|
||||
PsiJavaToken:EXPORTS('exports')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:pkg
|
||||
PsiIdentifier:pkg('pkg')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:TO('to')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:B('B')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,19 @@
|
||||
PsiJavaFile:Extras.java
|
||||
PsiJavaModule:one
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:one('one')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Unexpected tokens
|
||||
PsiIdentifier:module('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:another('another')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,4 @@
|
||||
PsiJavaFile:Incomplete0.java
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
@@ -0,0 +1,8 @@
|
||||
PsiJavaFile:Incomplete1.java
|
||||
PsiJavaModule:X
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiErrorElement:'{' expected
|
||||
<empty list>
|
||||
@@ -0,0 +1,5 @@
|
||||
PsiJavaFile:Incomplete2.java
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Module declaration expected
|
||||
PsiJavaToken:LBRACE('{')
|
||||
@@ -0,0 +1,10 @@
|
||||
PsiJavaFile:Incomplete3.java
|
||||
PsiJavaModule:X
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiErrorElement:'}' expected
|
||||
<empty list>
|
||||
@@ -0,0 +1,11 @@
|
||||
PsiJavaFile:Incomplete4.java
|
||||
PsiJavaModule:X
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Module statement expected
|
||||
PsiIdentifier:junk('junk')
|
||||
@@ -0,0 +1,13 @@
|
||||
PsiJavaFile:Name0.java
|
||||
PsiJavaModule:A.
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,15 @@
|
||||
PsiJavaFile:Name1.java
|
||||
PsiJavaModule:A..B
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:B('B')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,14 @@
|
||||
PsiJavaFile:Name2.java
|
||||
PsiJavaModule:AB
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiErrorElement:'.' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:B('B')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,15 @@
|
||||
PsiJavaFile:Provides0.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiErrorElement:Class reference expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,20 @@
|
||||
PsiJavaFile:Provides1.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Spi
|
||||
PsiIdentifier:Spi('Spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiErrorElement:'with' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,22 @@
|
||||
PsiJavaFile:Provides2.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Spi
|
||||
PsiIdentifier:Spi('Spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiErrorElement:'with' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,22 @@
|
||||
PsiJavaFile:Provides3.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Spi
|
||||
PsiIdentifier:Spi('Spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:WITH('with')
|
||||
PsiErrorElement:Class reference expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,24 @@
|
||||
PsiJavaFile:Provides4.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Spi
|
||||
PsiIdentifier:Spi('Spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:WITH('with')
|
||||
PsiErrorElement:Class reference expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,27 @@
|
||||
PsiJavaFile:Provides5.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Spi
|
||||
PsiIdentifier:Spi('Spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:WITH('with')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Impl
|
||||
PsiIdentifier:Impl('Impl')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,26 @@
|
||||
PsiJavaFile:Provides6.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiProvidesStatement
|
||||
PsiJavaToken:PROVIDES('provides')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Spi
|
||||
PsiIdentifier:Spi('Spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:WITH('with')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Impl
|
||||
PsiIdentifier:Impl('Impl')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,15 @@
|
||||
PsiJavaFile:Requires0.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiRequiresStatement
|
||||
PsiJavaToken:REQUIRES('requires')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,18 @@
|
||||
PsiJavaFile:Requires1.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiRequiresStatement
|
||||
PsiJavaToken:REQUIRES('requires')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,19 @@
|
||||
PsiJavaFile:Requires2.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiRequiresStatement
|
||||
PsiJavaToken:REQUIRES('requires')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,21 @@
|
||||
PsiJavaFile:Requires3.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiRequiresStatement
|
||||
PsiJavaToken:REQUIRES('requires')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Module statement expected
|
||||
PsiKeyword:private('private')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:X('X')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,23 @@
|
||||
PsiJavaFile:Requires4.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiRequiresStatement
|
||||
PsiJavaToken:REQUIRES('requires')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:A('A')
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiErrorElement:Module statement expected
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:B('B')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,14 @@
|
||||
PsiJavaFile:Semicolons.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,10 @@
|
||||
PsiJavaFile:Simple0.java
|
||||
PsiJavaModule:M1
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M1('M1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,17 @@
|
||||
PsiJavaFile:Simple1.java
|
||||
PsiJavaModule:a.b.c
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:a('a')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:b('b')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(C_STYLE_COMMENT)('/*here!*/')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:c('c')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,12 @@
|
||||
PsiJavaFile:Simple2.java
|
||||
PsiComment(C_STYLE_COMMENT)('/* comment */')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaModule:X
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:X('X')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,15 @@
|
||||
PsiJavaFile:Uses0.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiUsesStatement
|
||||
PsiJavaToken:USES('uses')
|
||||
PsiErrorElement:Class reference expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,20 @@
|
||||
PsiJavaFile:Uses1.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiUsesStatement
|
||||
PsiJavaToken:USES('uses')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:C
|
||||
PsiIdentifier:C('C')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,39 @@
|
||||
PsiJavaFile:Uses2.java
|
||||
PsiJavaModule:M
|
||||
PsiJavaToken:MODULE('module')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaModuleReference
|
||||
PsiIdentifier:M('M')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiUsesStatement
|
||||
PsiJavaToken:USES('uses')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:java.nio.file.spi.FileSystemProvider
|
||||
PsiJavaCodeReferenceElement:java.nio.file.spi
|
||||
PsiJavaCodeReferenceElement:java.nio.file
|
||||
PsiJavaCodeReferenceElement:java.nio
|
||||
PsiJavaCodeReferenceElement:java
|
||||
PsiIdentifier:java('java')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:nio('nio')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:file('file')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:spi('spi')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:FileSystemProvider('FileSystemProvider')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.lang.java.parser.partial;
|
||||
|
||||
import com.intellij.lang.java.parser.JavaParser;
|
||||
import com.intellij.lang.java.parser.JavaParsingTestCase;
|
||||
|
||||
public class ModuleParserTest extends JavaParsingTestCase {
|
||||
public ModuleParserTest() {
|
||||
super("parser-partial/modules");
|
||||
}
|
||||
|
||||
public void testSimple0() { doParserTest("module M1 { }"); }
|
||||
public void testSimple1() { doParserTest("module a.b. /*here!*/ c { }"); }
|
||||
public void testSimple2() { doParserTest("/* comment */\nmodule X { }"); }
|
||||
|
||||
public void testName0() { doParserTest("module A. { }"); }
|
||||
public void testName1() { doParserTest("module A..B { }"); }
|
||||
public void testName2() { doParserTest("module A B { }"); }
|
||||
|
||||
public void testIncomplete0() { doParserTest("module"); }
|
||||
public void testIncomplete1() { doParserTest("module X"); }
|
||||
public void testIncomplete2() { doParserTest("module {"); }
|
||||
public void testIncomplete3() { doParserTest("module X {"); }
|
||||
public void testIncomplete4() { doParserTest("module X { junk"); }
|
||||
|
||||
public void testBadContent() { doParserTest("module X {\n some junk\n}"); }
|
||||
public void testExtras() { doParserTest("module one { }\nmodule another { }"); }
|
||||
public void testSemicolons() { doParserTest("module M { ;;; }"); }
|
||||
|
||||
public void testRequires0() { doParserTest("module M { requires }"); }
|
||||
public void testRequires1() { doParserTest("module M { requires X }"); }
|
||||
public void testRequires2() { doParserTest("module M { requires public X; }"); }
|
||||
public void testRequires3() { doParserTest("module M { requires private X; }"); }
|
||||
public void testRequires4() { doParserTest("module M { requires A, B; }"); }
|
||||
|
||||
public void testExports0() { doParserTest("module M { exports }"); }
|
||||
public void testExports1() { doParserTest("module M { exports pkg }"); }
|
||||
public void testExports2() { doParserTest("module M { exports pkg; }"); }
|
||||
public void testExports3() { doParserTest("module M { exports pkg to }"); }
|
||||
public void testExports4() { doParserTest("module M { exports pkg to ; }"); }
|
||||
public void testExports5() { doParserTest("module M { exports pkg to A }"); }
|
||||
public void testExports6() { doParserTest("module M { exports pkg to A, }"); }
|
||||
public void testExports7() { doParserTest("module M { exports pkg to A, ; }"); }
|
||||
public void testExports8() { doParserTest("module M { exports pkg to , B; }"); }
|
||||
|
||||
public void testUses0() { doParserTest("module M { uses }"); }
|
||||
public void testUses1() { doParserTest("module M { uses C }"); }
|
||||
public void testUses2() { doParserTest("module M { uses java.nio.file.spi.FileSystemProvider; }"); }
|
||||
|
||||
public void testProvides0() { doParserTest("module M { provides }"); }
|
||||
public void testProvides1() { doParserTest("module M { provides Spi }"); }
|
||||
public void testProvides2() { doParserTest("module M { provides Spi ; }"); }
|
||||
public void testProvides3() { doParserTest("module M { provides Spi with }"); }
|
||||
public void testProvides4() { doParserTest("module M { provides Spi with ; }"); }
|
||||
public void testProvides5() { doParserTest("module M { provides Spi with Impl }"); }
|
||||
public void testProvides6() { doParserTest("module M { provides Spi with Impl; }"); }
|
||||
|
||||
private void doParserTest(String text) {
|
||||
doParserTest(text, builder -> JavaParser.INSTANCE.getFileParser().parse(builder));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user