Skip to content
Snippets Groups Projects
Commit 62cbe6c6 authored by Johannes Mey's avatar Johannes Mey
Browse files

more injections

parent f43460b2
Branches
Tags
No related merge requests found
...@@ -78,6 +78,10 @@ aspect_body_declaration ::= ( aspect_refine_inh_equation ...@@ -78,6 +78,10 @@ aspect_body_declaration ::= ( aspect_refine_inh_equation
| aspect_cache_declaration ) | aspect_cache_declaration )
aspect_class_declaration ::= modifiers class_declaration aspect_class_declaration ::= modifiers class_declaration
{
implements="org.jastadd.tooling.aspect.psi.JastAddAspectJavaExtension"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectJavaImplExtension"
}
aspect_interface_declaration ::= modifiers INTERFACE IDENTIFIER type_parameters? (EXTENDS type_name_list)? LBRACE aspect_interface_member_declaration* RBRACE aspect_interface_declaration ::= modifiers INTERFACE IDENTIFIER type_parameters? (EXTENDS type_name_list)? LBRACE aspect_interface_member_declaration* RBRACE
...@@ -208,6 +212,10 @@ name_name ::= java_identifier (DOT java_identifier)* ...@@ -208,6 +212,10 @@ name_name ::= java_identifier (DOT java_identifier)*
name_list ::= name_name (COMMA name_name)* name_list ::= name_name (COMMA name_name)*
expression ::= lambda_expression | ( conditional_expression (assignment_operator expression)? ) expression ::= lambda_expression | ( conditional_expression (assignment_operator expression)? )
{
implements="org.jastadd.tooling.aspect.psi.JastAddAspectJavaExtension"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectJavaImplExtension"
}
assignment_operator ::= ASSIGN | STARASSIGN | SLASHASSIGN | REMASSIGN | PLUSASSIGN | MINUSASSIGN | LSHIFTASSIGN | RSIGNEDSHIFTASSIGN | RUNSIGNEDSHIFTASSIGN | ANDASSIGN | XORASSIGN | ORASSIGN assignment_operator ::= ASSIGN | STARASSIGN | SLASHASSIGN | REMASSIGN | PLUSASSIGN | MINUSASSIGN | LSHIFTASSIGN | RSIGNEDSHIFTASSIGN | RUNSIGNEDSHIFTASSIGN | ANDASSIGN | XORASSIGN | ORASSIGN
...@@ -305,6 +313,10 @@ annotation ::= ( normal_annotation | single_member_annotation | marker_annotatio ...@@ -305,6 +313,10 @@ annotation ::= ( normal_annotation | single_member_annotation | marker_annotatio
// should be parsed after circular and in collection attributes // should be parsed after circular and in collection attributes
expression_in_brackets ::= LBRACKET_ANYTHING_RBRACKET // LBRACKET expression RBRACKET expression_in_brackets ::= LBRACKET_ANYTHING_RBRACKET // LBRACKET expression RBRACKET
{
implements="org.jastadd.tooling.aspect.psi.JastAddAspectJavaExtension"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectJavaImplExtension"
}
// at symbol only in these rules // at symbol only in these rules
marker_annotation ::= AT_NAME marker_annotation ::= AT_NAME
......
...@@ -22,14 +22,10 @@ public class JavaLanguageInjector implements LanguageInjector { ...@@ -22,14 +22,10 @@ public class JavaLanguageInjector implements LanguageInjector {
@Override @Override
public void getLanguagesToInject(@NotNull PsiLanguageInjectionHost host, @NotNull InjectedLanguagePlaces injectionPlacesRegistrar) { public void getLanguagesToInject(@NotNull PsiLanguageInjectionHost host, @NotNull InjectedLanguagePlaces injectionPlacesRegistrar) {
if (host.isValidHost()) { if (host.isValidHost()) {
if (host instanceof JastAddAspectExpressionInBrackets) { if (host instanceof JastAddAspectNormalAnnotation) {
// TODO
} else if (host instanceof JastAddAspectNormalAnnotation) {
// TODO // TODO
} else if (host instanceof JastAddAspectSingleMemberAnnotation) { } else if (host instanceof JastAddAspectSingleMemberAnnotation) {
// TODO // TODO
} else if (host instanceof JastAddAspectClassDeclaration) {
// TODO
} else if (host instanceof JastAddAspectInterfaceDeclaration) { } else if (host instanceof JastAddAspectInterfaceDeclaration) {
// TODO // TODO
} else if (host instanceof JastAddAspectEnumDeclaration) { } else if (host instanceof JastAddAspectEnumDeclaration) {
...@@ -37,7 +33,13 @@ public class JavaLanguageInjector implements LanguageInjector { ...@@ -37,7 +33,13 @@ public class JavaLanguageInjector implements LanguageInjector {
} else if (host instanceof JastAddAspectAnnotationTypeDeclaration) { } else if (host instanceof JastAddAspectAnnotationTypeDeclaration) {
// TODO // TODO
} else if (host instanceof JastAddAspectBlock) { } else if (host instanceof JastAddAspectBlock) {
injectionPlacesRegistrar.addPlace(JavaLanguage.INSTANCE, new TextRange(0, host.getTextLength()), "class X { public void m()", "}"); injectionPlacesRegistrar.addPlace(JavaLanguage.INSTANCE, new TextRange(1, host.getTextLength() - 1), "class X { public void m() {", "}}");
} else if (host instanceof JastAddAspectExpression) {
injectionPlacesRegistrar.addPlace(JavaLanguage.INSTANCE, new TextRange(0, host.getTextLength()), "class X { public void m() {Object x = ", ";}}");
} else if (host instanceof JastAddAspectExpressionInBrackets) {
injectionPlacesRegistrar.addPlace(JavaLanguage.INSTANCE, new TextRange(1, host.getTextLength() - 1), "class X { public void m() {Object x = ", ";}}");
} else if (host instanceof JastAddAspectAspectClassDeclaration) {
injectionPlacesRegistrar.addPlace(JavaLanguage.INSTANCE, new TextRange(0, host.getTextLength()), "", "");
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment