Added first stubbing and stub index for global labels.

This commit is contained in:
Chris Hodges 2021-07-25 19:53:06 +02:00
parent a800b13a3e
commit 83d2ca3304
60 changed files with 234 additions and 100 deletions

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kAddressSize extends PsiElement {
public interface M68kAddressSize extends M68kPsiElement {
}

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kAddressingMode extends PsiElement {
public interface M68kAddressingMode extends M68kPsiElement {
}

View File

@ -1,12 +1,11 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public interface M68kAsmInstruction extends PsiElement {
public interface M68kAsmInstruction extends M68kPsiElement {
@NotNull
List<M68kAddressingMode> getAddressingModeList();

View File

@ -1,10 +1,9 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
public interface M68kAsmOp extends PsiElement {
public interface M68kAsmOp extends M68kPsiElement {
@Nullable
M68kOperandSize getOperandSize();

View File

@ -1,10 +1,9 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
public interface M68kAssignment extends PsiElement {
public interface M68kAssignment extends M68kPsiElement {
@NotNull
M68kSymbolDefinition getSymbolDefinition();

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kDataWidth extends PsiElement {
public interface M68kDataWidth extends M68kPsiElement {
}

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kExpr extends PsiElement {
public interface M68kExpr extends M68kPsiElement {
}

View File

@ -2,10 +2,12 @@
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import com.intellij.psi.StubBasedPsiElement;
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface M68kGlobalLabel extends M68kLabel, M68kNamedElement {
public interface M68kGlobalLabel extends M68kLabel, M68kNamedElement, StubBasedPsiElement<M68kGlobalLabelStub> {
@Nullable
String getName();

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kLabel extends PsiElement {
public interface M68kLabel extends M68kPsiElement {
}

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kMacroCall extends PsiElement {
public interface M68kMacroCall extends M68kPsiElement {
}

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kOperandSize extends PsiElement {
public interface M68kOperandSize extends M68kPsiElement {
}

View File

@ -1,13 +1,12 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public interface M68kPreprocessorDirective extends PsiElement {
public interface M68kPreprocessorDirective extends M68kPsiElement {
@Nullable
M68kLabel getLabel();

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kProgramCounterReference extends PsiElement {
public interface M68kProgramCounterReference extends M68kPsiElement {
}

View File

@ -1,8 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
public interface M68kRegister extends PsiElement {
public interface M68kRegister extends M68kPsiElement {
}

View File

@ -1,10 +1,9 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
public interface M68kStatement extends PsiElement {
public interface M68kStatement extends M68kPsiElement {
@Nullable
M68kAsmInstruction getAsmInstruction();

View File

@ -1,10 +1,9 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
public interface M68kSymbolReference extends PsiElement {
public interface M68kSymbolReference extends M68kPsiElement {
@NotNull
String getSymbolName();

View File

@ -5,6 +5,7 @@ import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import de.platon42.intellij.plugins.m68k.psi.impl.*;
import de.platon42.intellij.plugins.m68k.stubs.M68kStubElementTypeFactory;
public interface M68kTypes {
@ -45,7 +46,7 @@ public interface M68kTypes {
IElementType DATA_REGISTER_DIRECT_ADDRESSING_MODE = new M68kElementType("DATA_REGISTER_DIRECT_ADDRESSING_MODE");
IElementType DATA_WIDTH = new M68kElementType("DATA_WIDTH");
IElementType EXPR = new M68kElementType("EXPR");
IElementType GLOBAL_LABEL = new M68kElementType("GLOBAL_LABEL");
IElementType GLOBAL_LABEL = M68kStubElementTypeFactory.stubFactory("GLOBAL_LABEL");
IElementType IMMEDIATE_DATA = new M68kElementType("IMMEDIATE_DATA");
IElementType LABEL = new M68kElementType("LABEL");
IElementType LITERAL_EXPR = new M68kElementType("LITERAL_EXPR");

View File

@ -1,7 +1,6 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import org.jetbrains.annotations.NotNull;
@ -266,7 +265,7 @@ public class M68kVisitor extends PsiElementVisitor {
visitPsiElement(o);
}
public void visitPsiElement(@NotNull PsiElement o) {
public void visitPsiElement(@NotNull M68kPsiElement o) {
visitElement(o);
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAbsoluteAddressAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressSize;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
@ -30,13 +31,13 @@ public class M68kAbsoluteAddressAddressingModeImpl extends M68kAddressingModeImp
@Override
@Nullable
public M68kAddressSize getAddressSize() {
return findChildByClass(M68kAddressSize.class);
return PsiTreeUtil.getChildOfType(this, M68kAddressSize.class);
}
@Override
@NotNull
public M68kExpr getExpr() {
return findNotNullChildByClass(M68kExpr.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterDirectAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kAddressRegisterDirectAddressingModeImpl extends M68kAddressingM
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kAddressRegisterIndirectAddressingModeImpl extends M68kAddressin
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectPostIncAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kAddressRegisterIndirectPostIncAddressingModeImpl extends M68kAd
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectPreDecAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kAddressRegisterIndirectPreDecAddressingModeImpl extends M68kAdd
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectWithDisplacementNewAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
@ -29,13 +30,13 @@ public class M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl ex
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
@Override
@NotNull
public M68kExpr getExpr() {
return findNotNullChildByClass(M68kExpr.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectWithDisplacementOldAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
@ -29,13 +30,13 @@ public class M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl ex
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
@Override
@NotNull
public M68kExpr getExpr() {
return findNotNullChildByClass(M68kExpr.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -27,25 +28,25 @@ public class M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl extends M
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
@Override
@Nullable
public M68kDataWidth getDataWidth() {
return findChildByClass(M68kDataWidth.class);
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
}
@Override
@NotNull
public M68kRegister getRegister() {
return findNotNullChildByClass(M68kRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
}
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -27,25 +28,25 @@ public class M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl extends M
@Override
@NotNull
public M68kAddressRegister getAddressRegister() {
return findNotNullChildByClass(M68kAddressRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
}
@Override
@Nullable
public M68kDataWidth getDataWidth() {
return findChildByClass(M68kDataWidth.class);
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
}
@Override
@NotNull
public M68kRegister getRegister() {
return findNotNullChildByClass(M68kRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
}
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -38,7 +38,7 @@ public class M68kAsmInstructionImpl extends ASTWrapperPsiElement implements M68k
@Override
@NotNull
public M68kAsmOp getAsmOp() {
return findNotNullChildByClass(M68kAsmOp.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAsmOp.class));
}
}

View File

@ -4,6 +4,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAsmOp;
import de.platon42.intellij.plugins.m68k.psi.M68kOperandSize;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kAsmOpImpl extends ASTWrapperPsiElement implements M68kAsmOp {
@Override
@Nullable
public M68kOperandSize getOperandSize() {
return findChildByClass(M68kOperandSize.class);
return PsiTreeUtil.getChildOfType(this, M68kOperandSize.class);
}
}

View File

@ -4,6 +4,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kAssignment;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition;
@ -29,13 +30,13 @@ public class M68kAssignmentImpl extends ASTWrapperPsiElement implements M68kAssi
@Override
@NotNull
public M68kSymbolDefinition getSymbolDefinition() {
return findNotNullChildByClass(M68kSymbolDefinition.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kSymbolDefinition.class));
}
@Override
@NotNull
public M68kExpr getExpr() {
return findNotNullChildByClass(M68kExpr.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kDataRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kDataRegisterDirectAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kDataRegisterDirectAddressingModeImpl extends M68kAddressingMode
@Override
@NotNull
public M68kDataRegister getDataRegister() {
return findNotNullChildByClass(M68kDataRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kDataRegister.class));
}
}

View File

@ -4,10 +4,12 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.stubs.IStubElementType;
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel;
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabelMixin;
import de.platon42.intellij.plugins.m68k.psi.M68kPsiImplUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -17,6 +19,10 @@ public class M68kGlobalLabelImpl extends M68kGlobalLabelMixin implements M68kGlo
super(node);
}
public M68kGlobalLabelImpl(@NotNull M68kGlobalLabelStub stub, @NotNull IStubElementType<?, ?> nodeType) {
super(stub, nodeType);
}
public void accept(@NotNull M68kVisitor visitor) {
visitor.visitGlobalLabel(this);
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kImmediateData;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kImmediateDataImpl extends M68kAddressingModeImpl implements M68
@Override
@NotNull
public M68kExpr getExpr() {
return findNotNullChildByClass(M68kExpr.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kParenExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kParenExprImpl extends M68kExprImpl implements M68kParenExpr {
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -33,7 +33,7 @@ public class M68kPreprocessorDirectiveImpl extends ASTWrapperPsiElement implemen
@Override
@Nullable
public M68kLabel getLabel() {
return findChildByClass(M68kLabel.class);
return PsiTreeUtil.getChildOfType(this, M68kLabel.class);
}
@Override

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithDisplacementNewAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl ext
@Override
@NotNull
public M68kExpr getExpr() {
return findNotNullChildByClass(M68kExpr.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithDisplacementOldAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl ext
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -27,19 +28,19 @@ public class M68kProgramCounterIndirectWithIndexNewAddressingModeImpl extends M6
@Override
@Nullable
public M68kDataWidth getDataWidth() {
return findChildByClass(M68kDataWidth.class);
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
}
@Override
@NotNull
public M68kRegister getRegister() {
return findNotNullChildByClass(M68kRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
}
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -27,19 +28,19 @@ public class M68kProgramCounterIndirectWithIndexOldAddressingModeImpl extends M6
@Override
@Nullable
public M68kDataWidth getDataWidth() {
return findChildByClass(M68kDataWidth.class);
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
}
@Override
@NotNull
public M68kRegister getRegister() {
return findNotNullChildByClass(M68kRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
}
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterReference;
import de.platon42.intellij.plugins.m68k.psi.M68kRefExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference;
@ -30,13 +31,13 @@ public class M68kRefExprImpl extends M68kExprImpl implements M68kRefExpr {
@Override
@Nullable
public M68kProgramCounterReference getProgramCounterReference() {
return findChildByClass(M68kProgramCounterReference.class);
return PsiTreeUtil.getChildOfType(this, M68kProgramCounterReference.class);
}
@Override
@Nullable
public M68kSymbolReference getSymbolReference() {
return findChildByClass(M68kSymbolReference.class);
return PsiTreeUtil.getChildOfType(this, M68kSymbolReference.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kSpecialRegister;
import de.platon42.intellij.plugins.m68k.psi.M68kSpecialRegisterDirectAddressingMode;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -28,7 +29,7 @@ public class M68kSpecialRegisterDirectAddressingModeImpl extends M68kAddressingM
@Override
@NotNull
public M68kSpecialRegister getSpecialRegister() {
return findNotNullChildByClass(M68kSpecialRegister.class);
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kSpecialRegister.class));
}
}

View File

@ -4,6 +4,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -27,31 +28,31 @@ public class M68kStatementImpl extends ASTWrapperPsiElement implements M68kState
@Override
@Nullable
public M68kAsmInstruction getAsmInstruction() {
return findChildByClass(M68kAsmInstruction.class);
return PsiTreeUtil.getChildOfType(this, M68kAsmInstruction.class);
}
@Override
@Nullable
public M68kAssignment getAssignment() {
return findChildByClass(M68kAssignment.class);
return PsiTreeUtil.getChildOfType(this, M68kAssignment.class);
}
@Override
@Nullable
public M68kLabel getLabel() {
return findChildByClass(M68kLabel.class);
return PsiTreeUtil.getChildOfType(this, M68kLabel.class);
}
@Override
@Nullable
public M68kMacroCall getMacroCall() {
return findChildByClass(M68kMacroCall.class);
return PsiTreeUtil.getChildOfType(this, M68kMacroCall.class);
}
@Override
@Nullable
public M68kPreprocessorDirective getPreprocessorDirective() {
return findChildByClass(M68kPreprocessorDirective.class);
return PsiTreeUtil.getChildOfType(this, M68kPreprocessorDirective.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryComplExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kUnaryComplExprImpl extends M68kExprImpl implements M68kUnaryCom
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryMinusExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kUnaryMinusExprImpl extends M68kExprImpl implements M68kUnaryMin
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryNotExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kUnaryNotExprImpl extends M68kExprImpl implements M68kUnaryNotEx
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryPlusExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
@ -29,7 +30,7 @@ public class M68kUnaryPlusExprImpl extends M68kExprImpl implements M68kUnaryPlus
@Override
@Nullable
public M68kExpr getExpr() {
return findChildByClass(M68kExpr.class);
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
}
}

View File

@ -13,7 +13,8 @@ class M68kFileElementType private constructor() : IStubFileElementType<M68kFileS
@JvmField
val INSTANCE = M68kFileElementType()
const val STUB_VERSION = 1
const val STUB_VERSION = 2
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
}
override fun getStubVersion() = STUB_VERSION

View File

@ -2,6 +2,7 @@
parserClass="de.platon42.intellij.plugins.m68k.parser.M68kParser"
parserUtilClass="de.platon42.intellij.plugins.m68k.parser.M68kParserUtilBase"
implements = "de.platon42.intellij.plugins.m68k.psi.M68kPsiElement"
extends="com.intellij.extapi.psi.ASTWrapperPsiElement"
psiClassPrefix="M68k"
psiImplClassSuffix="Impl"
@ -153,8 +154,8 @@ GlobalLabel ::= GLOBAL_LABEL_DEF COLON* {
extends = Label
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabelMixin"
// elementTypeFactory = "de.platon42.intellij.plugins.m68k.stubs.M68kStubElementTypeFactory.stubFactory"
// stubClass = "de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub"
elementTypeFactory = "de.platon42.intellij.plugins.m68k.stubs.M68kStubElementTypeFactory.stubFactory"
stubClass = "de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub"
methods = [getName setName getNameIdentifier]
}

View File

@ -6,11 +6,11 @@ import com.intellij.lexer.Lexer
import com.intellij.openapi.project.Project
import com.intellij.psi.FileViewProvider
import com.intellij.psi.tree.TokenSet
import de.platon42.intellij.plugins.m68k.M68kFileElementType
import de.platon42.intellij.plugins.m68k.lexer.M68kLexer
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
import de.platon42.intellij.plugins.m68k.psi.M68kFile
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
import de.platon42.intellij.plugins.m68k.stubs.M68kElementTypes
class M68kParserDefinition : ParserDefinition {
@ -23,7 +23,7 @@ class M68kParserDefinition : ParserDefinition {
override fun createParser(project: Project) = M68kParser()
override fun getFileNodeType() = M68kFileElementType.INSTANCE
override fun getFileNodeType() = M68kElementTypes.FILE
override fun getCommentTokens() = COMMENTS

View File

@ -1,19 +1,29 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.extapi.psi.ASTWrapperPsiElement
import com.intellij.extapi.psi.StubBasedPsiElementBase
import com.intellij.ide.projectView.PresentationData
import com.intellij.lang.ASTNode
import com.intellij.navigation.ItemPresentation
import com.intellij.psi.stubs.IStubElementType
import de.platon42.intellij.plugins.m68k.M68kIcons
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub
import javax.swing.Icon
abstract class M68kGlobalLabelMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kGlobalLabel {
abstract class M68kGlobalLabelMixin : StubBasedPsiElementBase<M68kGlobalLabelStub>, M68kGlobalLabel {
constructor(node: ASTNode) : super(node)
constructor(stub: M68kGlobalLabelStub, nodeType: IStubElementType<*, *>) : super(stub, nodeType)
override fun getPresentation(): ItemPresentation? {
return PresentationData(name, containingFile?.name, getIcon(0), null)
return PresentationData(name, containingFile.name, getIcon(0), null)
}
override fun getIcon(flags: Int): Icon? {
return M68kIcons.GLOBAL_LABEL
}
override fun toString(): String {
return javaClass.simpleName + "(GLOBAL_LABEL)"
}
}

View File

@ -3,4 +3,4 @@ package de.platon42.intellij.plugins.m68k.psi
import com.intellij.psi.NavigatablePsiElement
import com.intellij.psi.PsiNameIdentifierOwner
interface M68kNamedElement : PsiNameIdentifierOwner, NavigatablePsiElement
interface M68kNamedElement : M68kPsiElement, PsiNameIdentifierOwner, NavigatablePsiElement

View File

@ -0,0 +1,5 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.psi.PsiElement
interface M68kPsiElement : PsiElement

View File

@ -36,7 +36,7 @@ class M68kGlobalLabelSymbolReference(element: M68kSymbolReference) :
val project = ref.element.project
val targets: MutableList<PsiElement> = SmartList()
PsiSearchHelper.getInstance(project).processElementsWithWord(
{ elem, offset ->
{ elem, _ ->
when (elem) {
is M68kGlobalLabel, is M68kSymbolDefinition -> targets.add(elem)
}

View File

@ -0,0 +1,44 @@
package de.platon42.intellij.plugins.m68k.stubs
import com.intellij.lang.LighterAST
import com.intellij.lang.LighterASTNode
import com.intellij.psi.PsiElement
import com.intellij.psi.impl.source.tree.LightTreeUtil
import com.intellij.psi.stubs.*
import com.intellij.psi.tree.ILightStubFileElementType
import de.platon42.intellij.plugins.m68k.MC68000Language.Companion.INSTANCE
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
import de.platon42.intellij.plugins.m68k.psi.impl.M68kGlobalLabelImpl
import de.platon42.intellij.plugins.m68k.stubs.impl.M68kGlobalLabelStubImpl
import java.io.IOException
interface M68kElementTypes {
companion object {
@JvmField
val FILE = ILightStubFileElementType<M68kFileStub>(INSTANCE)
@JvmField
val GLOBAL_LABEL: IStubElementType<M68kGlobalLabelStub, M68kGlobalLabel> =
object : M68kStubElementType<M68kGlobalLabelStub, M68kGlobalLabel>("GLOBAL_LABEL") {
override fun createPsi(stub: M68kGlobalLabelStub): M68kGlobalLabel = M68kGlobalLabelImpl(stub, this)
override fun createStub(psi: M68kGlobalLabel, parentStub: StubElement<out PsiElement>): M68kGlobalLabelStub =
M68kGlobalLabelStubImpl(parentStub, this, psi.name!!)
override fun createStub(tree: LighterAST, node: LighterASTNode, parentStub: StubElement<*>): M68kGlobalLabelStub {
val idNode = LightTreeUtil.requiredChildOfType(tree, node, M68kTypes.GLOBAL_LABEL_DEF)
return M68kGlobalLabelStubImpl(parentStub, this, LightTreeUtil.toFilteredString(tree, idNode, null))
}
@Throws(IOException::class)
override fun serialize(stub: M68kGlobalLabelStub, dataStream: StubOutputStream) = dataStream.writeName(stub.name)
@Throws(IOException::class)
override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>): M68kGlobalLabelStub =
M68kGlobalLabelStubImpl(parentStub, this, dataStream.readName()!!)
override fun indexStub(stub: M68kGlobalLabelStub, sink: IndexSink) = sink.occurrence(M68kGlobalLabelStubIndex.KEY, stub.name!!)
}
}
}

View File

@ -0,0 +1,6 @@
package de.platon42.intellij.plugins.m68k.stubs
import com.intellij.psi.stubs.NamedStub
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
interface M68kGlobalLabelStub : NamedStub<M68kGlobalLabel>

View File

@ -0,0 +1,16 @@
package de.platon42.intellij.plugins.m68k.stubs
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndexKey
import de.platon42.intellij.plugins.m68k.M68kFileElementType
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
class M68kGlobalLabelStubIndex : StringStubIndexExtension<M68kGlobalLabel>() {
override fun getKey(): StubIndexKey<String, M68kGlobalLabel> = KEY
override fun getVersion(): Int = M68kFileElementType.STUB_VERSION
companion object {
val KEY = StubIndexKey.createIndexKey<String, M68kGlobalLabel>("mc68000.globallabel.index")
}
}

View File

@ -0,0 +1,13 @@
package de.platon42.intellij.plugins.m68k.stubs
import com.intellij.psi.stubs.ILightStubElementType
import com.intellij.psi.stubs.StubElement
import de.platon42.intellij.plugins.m68k.M68kFileElementType
import de.platon42.intellij.plugins.m68k.MC68000Language.Companion.INSTANCE
import de.platon42.intellij.plugins.m68k.psi.M68kPsiElement
abstract class M68kStubElementType<STUB : StubElement<out M68kPsiElement>, PSI_TYPE : M68kPsiElement>(debugName: String) :
ILightStubElementType<STUB, PSI_TYPE>(debugName, INSTANCE) {
override fun getExternalId(): String = M68kFileElementType.STUB_EXTERNAL_ID_PREFIX + this
}

View File

@ -0,0 +1,15 @@
package de.platon42.intellij.plugins.m68k.stubs
import com.intellij.psi.stubs.IStubElementType
import com.intellij.psi.stubs.StubElement
import de.platon42.intellij.plugins.m68k.psi.M68kPsiElement
object M68kStubElementTypeFactory {
@JvmStatic
fun stubFactory(name: String): IStubElementType<out StubElement<out M68kPsiElement>, out M68kPsiElement> {
when (name) {
"GLOBAL_LABEL" -> return M68kElementTypes.GLOBAL_LABEL
else -> throw RuntimeException("Unknown element type '$name'")
}
}
}

View File

@ -0,0 +1,13 @@
package de.platon42.intellij.plugins.m68k.stubs.impl
import com.intellij.psi.stubs.IStubElementType
import com.intellij.psi.stubs.NamedStubBase
import com.intellij.psi.stubs.StubElement
import com.intellij.util.io.StringRef
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub
class M68kGlobalLabelStubImpl : NamedStubBase<M68kGlobalLabel>, M68kGlobalLabelStub {
constructor(parent: StubElement<*>, elementType: IStubElementType<*, *>, name: StringRef) : super(parent, elementType, name)
constructor(parent: StubElement<*>, elementType: IStubElementType<*, *>, name: String) : super(parent, elementType, name)
}

View File

@ -29,7 +29,8 @@
<lang.psiStructureViewFactory language="MC68000" implementationClass="de.platon42.intellij.plugins.m68k.structureview.M68kStructureViewFactory"/>
<lang.elementManipulator forClass="de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference"
implementationClass="de.platon42.intellij.plugins.m68k.refs.M68kSymbolReferenceElementManipulator"/>
<stubElementTypeHolder class="de.platon42.intellij.plugins.m68k.stubs.M68kElementTypes"/>
<stubIndex implementation="de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStubIndex"/>
<psi.referenceContributor implementation="de.platon42.intellij.plugins.m68k.refs.M68kReferenceContributor"/>
<gotoSymbolContributor implementation="de.platon42.intellij.plugins.m68k.refs.M68kChooseByNameContributor"/>
<renameInputValidator implementation="de.platon42.intellij.plugins.m68k.psi.M68kRenameInputValidator"/>