Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f006199201 | ||
|
|
9553da6a1c | ||
|
|
5ffffb5680 | ||
|
|
fc5e1f6bf7 | ||
|
|
ad3b207362 | ||
|
|
72db8ad8b2 | ||
|
|
82feb8c43c | ||
|
|
3165d99fc2 | ||
|
|
89ecaeb613 | ||
|
|
83d2ca3304 | ||
|
|
a800b13a3e | ||
|
|
d872feeec4 | ||
|
|
884624e833 | ||
|
|
27d9d3c543 |
@@ -36,7 +36,6 @@ it's "good enough" to get started, and I can return to demo coding with its curr
|
||||
|
||||
## Known issues
|
||||
|
||||
- Performance is not optimal yet (no stub index).
|
||||
- No referencing of macro invocations and macro definitions.
|
||||
- `Find Usages` always shows _"Unclassified"_ though it shouldn't.
|
||||
- Macro definitions may cause syntax errors when using backslash arguments.
|
||||
@@ -55,9 +54,14 @@ it's "good enough" to get started, and I can return to demo coding with its curr
|
||||
- Formatter + Code Style Settings
|
||||
- Register use analysis (but this only makes sense after macro evaluation)
|
||||
|
||||
## Recommendations
|
||||
|
||||
Currently, I would suggest using the fabulous [Browse Word at Caret Plugin](https://plugins.jetbrains.com/plugin/201-browsewordatcaret)
|
||||
to highlight the same address and data registers while editing (see new `View -> Highlight Word at Caret` menu item).
|
||||
|
||||
## Development notice
|
||||
|
||||
This plugin has been written in Kotlin 1.5.
|
||||
This plugin has been written in Kotlin 1.5 using Grammar-Kit.
|
||||
|
||||
It is probably the only plugin (besides [Cajon](https://github.com/chrisly42/cajon-plugin) from the same author) that uses JUnit 5 Jupiter for unit testing so
|
||||
far (or at least the only one I'm aware of ;) ). The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to
|
||||
@@ -65,6 +69,14 @@ make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.
|
||||
|
||||
## Changelog
|
||||
|
||||
### V0.1 (20-Jun-21)
|
||||
### V0.2 (27-Jul-21)
|
||||
|
||||
- Cosmetics: Added (same) icon for plugin as for file type.
|
||||
- Performance improvement: Use Word-Index for global labels and symbols instead of iterating over the file.
|
||||
- Performance improvement: Use Stub-Index for global labels and symbols.
|
||||
- Bugfix: No longer reports a syntax error when file lacks terminating End-Of-Line.
|
||||
- Enhancement: Registers are now offered for code completion, making editing less annoying.
|
||||
|
||||
### V0.1 (20-Jul-21)
|
||||
|
||||
- Initial public release.
|
||||
+10
-2
@@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'de.platon42'
|
||||
version = '0.1'
|
||||
version = '0.2'
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
|
||||
@@ -46,7 +46,15 @@ intellij {
|
||||
|
||||
patchPluginXml {
|
||||
setChangeNotes("""
|
||||
<h4>V0.1 (20-Jun-21)</h4>
|
||||
<h4>V0.2 (27-Jul-21)</h4>
|
||||
<ul>
|
||||
<li>Cosmetics: Added (same) icon for plugin as for file type.
|
||||
<li>Performance improvement: Use Word-Index for global labels and symbols instead of iterating over the file.
|
||||
<li>Performance improvement: Use Stub-Index for global labels and symbols.
|
||||
<li>Bugfix: No longer reports a syntax error when file lacks terminating End-Of-Line.
|
||||
<li>Enhancement: Registers are now offered for code completion, making editing less annoying.
|
||||
</ul>
|
||||
<h4>V0.1 (20-Jul-21)</h4>
|
||||
<ul>
|
||||
<li>Initial public release.
|
||||
</ul>
|
||||
|
||||
@@ -37,7 +37,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[]{
|
||||
create_token_set_(GLOBAL_LABEL, LABEL, LOCAL_LABEL),
|
||||
create_token_set_(ADDRESS_REGISTER, DATA_REGISTER, REGISTER, SPECIAL_REGISTER),
|
||||
create_token_set_(ABSOLUTE_ADDRESS_ADDRESSING_MODE, ADDRESSING_MODE, ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_ADDRESSING_MODE,
|
||||
ADDRESS_REGISTER_INDIRECT_POST_INC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE,
|
||||
@@ -567,14 +566,12 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
|
||||
/* ********************************************************** */
|
||||
// LocalLabel | GlobalLabel
|
||||
public static boolean Label(PsiBuilder b, int l) {
|
||||
static boolean Label(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "Label")) return false;
|
||||
if (!nextTokenIs(b, "<label>", GLOBAL_LABEL_DEF, LOCAL_LABEL_DEF)) return false;
|
||||
if (!nextTokenIs(b, "", GLOBAL_LABEL_DEF, LOCAL_LABEL_DEF)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _COLLAPSE_, LABEL, "<label>");
|
||||
r = LocalLabel(b, l + 1);
|
||||
if (!r) r = GlobalLabel(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -1051,14 +1048,14 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// !<<eof>> statement EOL
|
||||
// !<<eof>> statement (<<eof>>|EOL)
|
||||
static boolean line(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "line")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = line_0(b, l + 1);
|
||||
r = r && statement(b, l + 1);
|
||||
r = r && consumeToken(b, EOL);
|
||||
r = r && line_2(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
@@ -1073,6 +1070,17 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
// <<eof>>|EOL
|
||||
private static boolean line_2(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "line_2")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = eof(b, l + 1);
|
||||
if (!r) r = consumeToken(b, EOL);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// Assignment
|
||||
// | PreprocessorDirective
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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 M68kNamedElement, StubBasedPsiElement<M68kGlobalLabelStub> {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// 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 {
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kLocalLabel extends M68kLabel, M68kNamedElement {
|
||||
public interface M68kLocalLabel extends M68kNamedElement {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
// 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();
|
||||
M68kGlobalLabel getGlobalLabel();
|
||||
|
||||
@Nullable
|
||||
M68kLocalLabel getLocalLabel();
|
||||
|
||||
@NotNull
|
||||
List<M68kExpr> getExprList();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
@@ -13,7 +12,10 @@ public interface M68kStatement extends PsiElement {
|
||||
M68kAssignment getAssignment();
|
||||
|
||||
@Nullable
|
||||
M68kLabel getLabel();
|
||||
M68kGlobalLabel getGlobalLabel();
|
||||
|
||||
@Nullable
|
||||
M68kLocalLabel getLocalLabel();
|
||||
|
||||
@Nullable
|
||||
M68kMacroCall getMacroCall();
|
||||
|
||||
@@ -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.M68kSymbolDefinitionStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kSymbolDefinition extends M68kNamedElement {
|
||||
public interface M68kSymbolDefinition extends M68kNamedElement, StubBasedPsiElement<M68kSymbolDefinitionStub> {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,9 +46,8 @@ 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");
|
||||
IElementType LOCAL_LABEL = new M68kElementType("LOCAL_LABEL");
|
||||
IElementType MACRO_CALL = new M68kElementType("MACRO_CALL");
|
||||
@@ -65,7 +65,7 @@ public interface M68kTypes {
|
||||
IElementType SPECIAL_REGISTER = new M68kElementType("SPECIAL_REGISTER");
|
||||
IElementType SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE = new M68kElementType("SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE");
|
||||
IElementType STATEMENT = new M68kElementType("STATEMENT");
|
||||
IElementType SYMBOL_DEFINITION = new M68kElementType("SYMBOL_DEFINITION");
|
||||
IElementType SYMBOL_DEFINITION = M68kStubElementTypeFactory.stubFactory("SYMBOL_DEFINITION");
|
||||
IElementType SYMBOL_REFERENCE = new M68kElementType("SYMBOL_REFERENCE");
|
||||
IElementType UNARY_COMPL_EXPR = new M68kElementType("UNARY_COMPL_EXPR");
|
||||
IElementType UNARY_MINUS_EXPR = new M68kElementType("UNARY_MINUS_EXPR");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -80,21 +79,15 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
}
|
||||
|
||||
public void visitGlobalLabel(@NotNull M68kGlobalLabel o) {
|
||||
visitLabel(o);
|
||||
// visitNamedElement(o);
|
||||
visitNamedElement(o);
|
||||
}
|
||||
|
||||
public void visitImmediateData(@NotNull M68kImmediateData o) {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitLabel(@NotNull M68kLabel o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitLocalLabel(@NotNull M68kLocalLabel o) {
|
||||
visitLabel(o);
|
||||
// visitNamedElement(o);
|
||||
visitNamedElement(o);
|
||||
}
|
||||
|
||||
public void visitMacroCall(@NotNull M68kMacroCall o) {
|
||||
@@ -266,7 +259,7 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitPsiElement(@NotNull PsiElement o) {
|
||||
public void visitPsiElement(@NotNull M68kPsiElement o) {
|
||||
visitElement(o);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-2
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-2
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-4
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-4
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
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 de.platon42.intellij.plugins.m68k.psi.M68kLabel;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class M68kLabelImpl extends ASTWrapperPsiElement implements M68kLabel {
|
||||
|
||||
public M68kLabelImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitLabel(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-6
@@ -5,10 +5,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLabel;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorDirective;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -32,8 +29,14 @@ public class M68kPreprocessorDirectiveImpl extends ASTWrapperPsiElement implemen
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLabel getLabel() {
|
||||
return findChildByClass(M68kLabel.class);
|
||||
public M68kGlobalLabel getGlobalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kGlobalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLocalLabel getLocalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kLocalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-3
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-3
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,37 @@ 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);
|
||||
public M68kGlobalLabel getGlobalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kGlobalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLocalLabel getLocalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kLocalLabel.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.M68kPsiImplUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinitionMixin;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,6 +19,10 @@ public class M68kSymbolDefinitionImpl extends M68kSymbolDefinitionMixin implemen
|
||||
super(node);
|
||||
}
|
||||
|
||||
public M68kSymbolDefinitionImpl(@NotNull M68kSymbolDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitSymbolDefinition(this);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +1,21 @@
|
||||
package de.platon42.intellij.plugins.m68k
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.stubs.DefaultStubBuilder
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.psi.tree.IStubFileElementType
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import com.intellij.psi.tree.ILightStubFileElementType
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kFileStub
|
||||
|
||||
class M68kFileElementType private constructor() : IStubFileElementType<M68kFileStub>("MC68000_FILE", MC68000Language.INSTANCE) {
|
||||
class M68kFileElementType private constructor() : ILightStubFileElementType<PsiFileStub<M68kFile>>("MC68000_FILE", MC68000Language.INSTANCE) {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = M68kFileElementType()
|
||||
|
||||
const val STUB_VERSION = 1
|
||||
const val STUB_VERSION = 3
|
||||
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
||||
const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE"
|
||||
}
|
||||
|
||||
override fun getStubVersion() = STUB_VERSION
|
||||
|
||||
override fun getBuilder() =
|
||||
object : DefaultStubBuilder() {
|
||||
override fun createStubForFile(file: PsiFile): StubElement<*> {
|
||||
return if (file is M68kFile) M68kFileStub(file) else super.createStubForFile(file)
|
||||
}
|
||||
}
|
||||
override fun getExternalId() = EXTERNAL_ID
|
||||
}
|
||||
@@ -1,15 +1,24 @@
|
||||
package de.platon42.intellij.plugins.m68k.asm
|
||||
|
||||
enum class Machine {
|
||||
MC68000
|
||||
MC68000,
|
||||
MC68010,
|
||||
MC68020,
|
||||
MC68030,
|
||||
MC68040,
|
||||
MC68060
|
||||
}
|
||||
|
||||
data class IsaData(
|
||||
val mnemonic: String,
|
||||
val description: String,
|
||||
val machine: Machine = Machine.MC68000,
|
||||
val machine: Set<Machine> = setOf(Machine.MC68000),
|
||||
val altMnemonics: List<String> = emptyList(),
|
||||
val conditionCodes: List<String> = emptyList()
|
||||
val conditionCodes: List<String> = emptyList(),
|
||||
val id: String = mnemonic,
|
||||
val opSize: String = "bWl",
|
||||
val isPrivileged: Boolean = false,
|
||||
val hasOps: Boolean = true
|
||||
)
|
||||
|
||||
object M68kIsa {
|
||||
@@ -18,95 +27,129 @@ object M68kIsa {
|
||||
val conditionCodesBcc = conditionCodes.filterNot { it == "f" || it == "t" }
|
||||
|
||||
val isaData = listOf(
|
||||
IsaData("abcd", "Add Decimal with Extend"),
|
||||
|
||||
// Data Movement Instructions
|
||||
IsaData("move", "Move"),
|
||||
IsaData("movea", "Move Address", altMnemonics = listOf("move"), opSize = "L"),
|
||||
IsaData("movem", "Move Multiple Registers", opSize = "Wl"),
|
||||
IsaData("movep", "Move Peripheral", opSize = ""),
|
||||
IsaData("moveq", "Move Quick", opSize = "L"),
|
||||
|
||||
IsaData("exg", "Exchange Registers", opSize = "L"),
|
||||
IsaData("lea", "Load Effective Address", opSize = ""),
|
||||
IsaData("pea", "Push Effective Address", opSize = ""),
|
||||
IsaData("link", "Link and Allocate", opSize = ""),
|
||||
IsaData("unlk", "Unlink", opSize = ""),
|
||||
|
||||
// Integer Arithmetic Instructions
|
||||
IsaData("add", "Add"),
|
||||
IsaData("adda", "Add Address", altMnemonics = listOf("add")),
|
||||
IsaData("adda", "Add Address", altMnemonics = listOf("add"), opSize = "Wl"),
|
||||
IsaData("addi", "Add Immediate", altMnemonics = listOf("add")),
|
||||
IsaData("addq", "Add Quick"),
|
||||
IsaData("addx", "Add with Extend"),
|
||||
IsaData("and", "Logical AND"),
|
||||
IsaData("andi", "Logical AND Immediate", altMnemonics = listOf("and")),
|
||||
IsaData("andi", "to CCR AND Immediate to Condition Code Register", altMnemonics = listOf("and")),
|
||||
IsaData("andi", "to SR AND Immediate to Status Register", altMnemonics = listOf("and")),
|
||||
IsaData("asl", "Arithmetic Shift Left"),
|
||||
IsaData("asr", "Arithmetic Shift Right"),
|
||||
IsaData("bCC", "Branch Conditionally", conditionCodes = conditionCodesBcc),
|
||||
IsaData("bchg", "Test Bit and Change"),
|
||||
IsaData("bclr", "Test Bit and Clear"),
|
||||
IsaData("bra", "Branch"),
|
||||
IsaData("bset", "Test Bit and Set"),
|
||||
IsaData("bsr", "Branch to Subroutine"),
|
||||
IsaData("btst", "Test Bit"),
|
||||
IsaData("chk", "Check Register Against Bound"),
|
||||
IsaData("clr", "Clear"),
|
||||
IsaData("cmp", "Compare"),
|
||||
IsaData("cmpa", "Compare Address", altMnemonics = listOf("cmp")),
|
||||
IsaData("cmpi", "Compare Immediate", altMnemonics = listOf("cmp")),
|
||||
IsaData("cmpm", "Compare Memory to Memory", altMnemonics = listOf("cmp")),
|
||||
IsaData(
|
||||
"dbCC",
|
||||
"Test Condition, Decrement, and Branch",
|
||||
altMnemonics = listOf("dbra"),
|
||||
conditionCodes = conditionCodes
|
||||
),
|
||||
IsaData("divs", "Signed Divide"),
|
||||
IsaData("divu", "Unsigned Divide"),
|
||||
IsaData("eor", "Logical Exclusive-OR"),
|
||||
IsaData("eori", "Logical Exclusive-OR Immediate", altMnemonics = listOf("eor")),
|
||||
IsaData("eori", "to CCR Exclusive-OR Immediate to Condition Code Register", altMnemonics = listOf("eor")),
|
||||
IsaData("eori", "to SR Exclusive-OR Immediate to Status Register", altMnemonics = listOf("eor")),
|
||||
IsaData("exg", "Exchange Registers"),
|
||||
IsaData("ext", "Sign Extend"),
|
||||
IsaData("illegal", "Take Illegal Instruction Trap"),
|
||||
IsaData("jmp", "Jump"),
|
||||
IsaData("jsr", "Jump to Subroutine"),
|
||||
IsaData("lea", "Load Effective Address"),
|
||||
IsaData("link", "Link and Allocate"),
|
||||
IsaData("lsl", "Logical Shift Left"),
|
||||
IsaData("lsr", "Logical Shift Right"),
|
||||
IsaData("move", "Move"),
|
||||
IsaData("movea", "Move Address", altMnemonics = listOf("move")),
|
||||
IsaData("move", "to CCR Move to Condition Code Register"),
|
||||
IsaData("move", "from SR Move from Status Register"),
|
||||
IsaData("move", "to SR Move to Status Register"),
|
||||
IsaData("move", "USP Move User Stack Pointer"),
|
||||
IsaData("movem", "Move Multiple Registers"),
|
||||
IsaData("movep", "Move Peripheral"),
|
||||
IsaData("moveq", "Move Quick"),
|
||||
IsaData("muls", "Signed Multiply"),
|
||||
IsaData("mulu", "Unsigned Multiply"),
|
||||
IsaData("nbcd", "Negate Decimal with Extend"),
|
||||
IsaData("neg", "Negate"),
|
||||
IsaData("negx", "Negate with Extend"),
|
||||
IsaData("nop", "No Operation"),
|
||||
IsaData("not", "Logical Complement"),
|
||||
IsaData("or", "Logical Inclusive-OR"),
|
||||
IsaData("ori", "Logical Inclusive-OR Immediate", altMnemonics = listOf("or")),
|
||||
IsaData("ori", "to CCR Inclusive-OR Immediate to Condition Code Register", altMnemonics = listOf("or")),
|
||||
IsaData("ori", "to SR Inclusive-OR Immediate to Status Register", altMnemonics = listOf("or")),
|
||||
IsaData("pea", "Push Effective Address"),
|
||||
IsaData("reset", "Reset External Devices"),
|
||||
IsaData("rol", "Rotate Left"),
|
||||
IsaData("ror", "Rotate Right"),
|
||||
IsaData("roxl", "Rotate with Extend Left"),
|
||||
IsaData("roxr", "Rotate with Extend Right"),
|
||||
IsaData("rte", "Return from Exception"),
|
||||
IsaData("rtr", "Return and Restore"),
|
||||
IsaData("rts", "Return from Subroutine"),
|
||||
IsaData("sbcd", "Subtract Decimal with Extend"),
|
||||
IsaData("sCC", "Set Conditionally", conditionCodes = conditionCodes),
|
||||
IsaData("stop", "Stop"),
|
||||
|
||||
IsaData("sub", "Subtract"),
|
||||
IsaData("suba", "Subtract Address", altMnemonics = listOf("sub")),
|
||||
IsaData("subi", "Subtract Immediate", altMnemonics = listOf("sub")),
|
||||
IsaData("subq", "Subtract Quick"),
|
||||
IsaData("subx", "Subtract with Extend"),
|
||||
IsaData("swap", "Swap Register Words"),
|
||||
IsaData("tas", "Test Operand and Set"),
|
||||
IsaData("trap", "Trap"),
|
||||
IsaData("trapv", "Trap on Overflow"),
|
||||
|
||||
IsaData("neg", "Negate"),
|
||||
IsaData("negx", "Negate with Extend"),
|
||||
|
||||
IsaData("clr", "Clear"),
|
||||
|
||||
IsaData("cmp", "Compare"),
|
||||
IsaData("cmpa", "Compare Address", altMnemonics = listOf("cmp"), opSize = "Wl"),
|
||||
IsaData("cmpi", "Compare Immediate", altMnemonics = listOf("cmp")),
|
||||
IsaData("cmpm", "Compare Memory to Memory", altMnemonics = listOf("cmp")),
|
||||
|
||||
IsaData("muls", "Signed Multiply", opSize = "W"),
|
||||
IsaData("mulu", "Unsigned Multiply", opSize = "W"),
|
||||
IsaData("divs", "Signed Divide", opSize = "W"),
|
||||
IsaData("divu", "Unsigned Divide", opSize = "W"),
|
||||
|
||||
IsaData("ext", "Sign Extend", opSize = "Wl"),
|
||||
|
||||
// Logical Instructions
|
||||
IsaData("and", "Logical AND"),
|
||||
IsaData("andi", "Logical AND Immediate", altMnemonics = listOf("and")),
|
||||
IsaData("eor", "Logical Exclusive-OR"),
|
||||
IsaData("eori", "Logical Exclusive-OR Immediate", altMnemonics = listOf("eor")),
|
||||
IsaData("not", "Logical Complement"),
|
||||
IsaData("or", "Logical Inclusive-OR"),
|
||||
IsaData("ori", "Logical Inclusive-OR Immediate", altMnemonics = listOf("or")),
|
||||
|
||||
// Shift and Rotate Instructions
|
||||
IsaData("asl", "Arithmetic Shift Left"),
|
||||
IsaData("asr", "Arithmetic Shift Right"),
|
||||
IsaData("lsl", "Logical Shift Left"),
|
||||
IsaData("lsr", "Logical Shift Right"),
|
||||
IsaData("rol", "Rotate Left"),
|
||||
IsaData("ror", "Rotate Right"),
|
||||
IsaData("roxl", "Rotate with Extend Left"),
|
||||
IsaData("roxr", "Rotate with Extend Right"),
|
||||
IsaData("swap", "Swap Register Words", opSize = ""),
|
||||
|
||||
// Bit Manipulation Instructions
|
||||
IsaData("bchg", "Test Bit and Change", opSize = "Bl"),
|
||||
IsaData("bclr", "Test Bit and Clear", opSize = "Bl"),
|
||||
IsaData("bset", "Test Bit and Set", opSize = "Bl"),
|
||||
IsaData("btst", "Test Bit", opSize = "Bl"),
|
||||
|
||||
// Binary-Coded Decimal Instructions
|
||||
IsaData("abcd", "Add Decimal with Extend", opSize = ""),
|
||||
IsaData("sbcd", "Subtract Decimal with Extend", opSize = ""),
|
||||
IsaData("nbcd", "Negate Decimal with Extend", opSize = ""),
|
||||
|
||||
// Program Control Instructions
|
||||
IsaData("bCC", "Branch Conditionally", conditionCodes = conditionCodesBcc, opSize = "bsW"),
|
||||
IsaData("bra", "Branch", opSize = "bsW"),
|
||||
IsaData("bsr", "Branch to Subroutine", opSize = "bsW"),
|
||||
|
||||
IsaData(
|
||||
"dbCC",
|
||||
"Test Condition, Decrement, and Branch",
|
||||
altMnemonics = listOf("dbra"),
|
||||
conditionCodes = conditionCodes, opSize = "W"
|
||||
),
|
||||
IsaData("sCC", "Set Conditionally", conditionCodes = conditionCodes, opSize = ""),
|
||||
|
||||
IsaData("jmp", "Jump", opSize = ""),
|
||||
IsaData("jsr", "Jump to Subroutine", opSize = ""),
|
||||
IsaData("nop", "No Operation", opSize = "", hasOps = false),
|
||||
|
||||
IsaData("rtr", "Return and Restore", hasOps = false),
|
||||
IsaData("rts", "Return from Subroutine", hasOps = false),
|
||||
|
||||
IsaData("tst", "Test Operand"),
|
||||
IsaData("unlk", "Unlink"),
|
||||
|
||||
// System Control Instructions
|
||||
IsaData("andi", "AND Immediate to Status Register", id = "andi to SR", altMnemonics = listOf("and"), isPrivileged = true),
|
||||
IsaData("eori", "Exclusive-OR Immediate to Status Register", id = "eori to SR", altMnemonics = listOf("eor"), isPrivileged = true),
|
||||
IsaData("ori", "Inclusive-OR Immediate to Status Register", id = "ori to SR", altMnemonics = listOf("or"), isPrivileged = true),
|
||||
IsaData("move", "Move from Status Register", id = "move from SR"),
|
||||
IsaData("move", "Move to Status Register", id = "move to SR", isPrivileged = true),
|
||||
IsaData("move", "Move User Stack Pointer", id = "move USP", isPrivileged = true),
|
||||
|
||||
IsaData("reset", "Reset External Devices", opSize = "", isPrivileged = true, hasOps = false),
|
||||
IsaData("rte", "Return from Exception", isPrivileged = true, hasOps = false),
|
||||
IsaData("stop", "Stop", opSize = "", isPrivileged = true),
|
||||
|
||||
IsaData("chk", "Check Register Against Bound"),
|
||||
IsaData("illegal", "Take Illegal Instruction Trap", opSize = "", hasOps = false),
|
||||
IsaData("trap", "Trap", opSize = ""),
|
||||
IsaData("trapv", "Trap on Overflow", opSize = ""),
|
||||
|
||||
IsaData("andi", "AND Immediate to Condition Code Register", id = "andi to CCR", altMnemonics = listOf("and")),
|
||||
IsaData("eori", "Exclusive-OR Immediate to Condition Code Register", id = "eori to CCR", altMnemonics = listOf("eor")),
|
||||
IsaData("ori", "Inclusive-OR Immediate to Condition Code Register", id = "ori to CCR", altMnemonics = listOf("or")),
|
||||
IsaData("move", "Move to Condition Code Register", id = "move to CCR"),
|
||||
|
||||
|
||||
// Multiprocessor Instructions
|
||||
IsaData("tas", "Test Operand and Set", opSize = "B"),
|
||||
|
||||
)
|
||||
|
||||
val mnemonics =
|
||||
|
||||
@@ -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"
|
||||
@@ -117,7 +118,7 @@
|
||||
|
||||
M68kFile ::= line*
|
||||
|
||||
private line ::= !<<eof>> statement EOL
|
||||
private line ::= !<<eof>> statement (<<eof>>|EOL)
|
||||
|
||||
statement ::= (Assignment
|
||||
| PreprocessorDirective
|
||||
@@ -129,6 +130,8 @@ private statement_recover ::= !(EOL)
|
||||
SymbolDefinition ::= SYMBOLDEF {
|
||||
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
|
||||
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinitionMixin"
|
||||
elementTypeFactory = "de.platon42.intellij.plugins.m68k.stubs.M68kStubElementTypeFactory.stubFactory"
|
||||
stubClass = "de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStub"
|
||||
methods = [getName setName getNameIdentifier]
|
||||
}
|
||||
|
||||
@@ -142,7 +145,6 @@ private InstructionOnly ::= Instruction
|
||||
|
||||
LocalLabel ::= LOCAL_LABEL_DEF COLON? {
|
||||
name = "local label"
|
||||
extends = Label
|
||||
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
|
||||
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kLocalLabelMixin"
|
||||
methods = [getName setName getNameIdentifier]
|
||||
@@ -150,15 +152,14 @@ LocalLabel ::= LOCAL_LABEL_DEF COLON? {
|
||||
|
||||
GlobalLabel ::= GLOBAL_LABEL_DEF COLON* {
|
||||
name = "global label"
|
||||
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]
|
||||
}
|
||||
|
||||
Label ::= LocalLabel | GlobalLabel
|
||||
private Label ::= LocalLabel | GlobalLabel
|
||||
|
||||
OperandSize ::= (OPSIZE_BS|OPSIZE_W|OPSIZE_L) { name = ".s|.b|.w|.l" }
|
||||
AddressSize ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,46 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.search.FileTypeIndex
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.stubs.StubIndex
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import de.platon42.intellij.plugins.m68k.M68kFileType
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStubIndex
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStubIndex
|
||||
|
||||
object M68kLookupUtil {
|
||||
|
||||
fun findAllGlobalLabels(project: Project): List<M68kGlobalLabel> {
|
||||
return getFiles(project)
|
||||
.flatMap(::findAllGlobalLabels)
|
||||
.toList()
|
||||
val results: MutableList<M68kGlobalLabel> = ArrayList()
|
||||
StubIndex.getInstance().processAllKeys(M68kGlobalLabelStubIndex.KEY, project)
|
||||
{
|
||||
results.addAll(StubIndex.getElements(M68kGlobalLabelStubIndex.KEY, it, project, GlobalSearchScope.allScope(project), M68kGlobalLabel::class.java))
|
||||
true
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
fun findAllGlobalLabels(file: M68kFile): List<M68kGlobalLabel> {
|
||||
val results: MutableList<M68kGlobalLabel> = ArrayList()
|
||||
var currentStatement = file.firstChild
|
||||
while (currentStatement != null) {
|
||||
val child = currentStatement.firstChild
|
||||
if (child is M68kGlobalLabel) results.add(child)
|
||||
currentStatement = PsiTreeUtil.getNextSiblingOfType(currentStatement, M68kStatement::class.java)
|
||||
}
|
||||
StubIndex.getInstance().processAllKeys(
|
||||
M68kGlobalLabelStubIndex.KEY,
|
||||
{
|
||||
results.addAll(
|
||||
StubIndex.getElements(
|
||||
M68kGlobalLabelStubIndex.KEY,
|
||||
it,
|
||||
file.project,
|
||||
GlobalSearchScope.fileScope(file),
|
||||
M68kGlobalLabel::class.java
|
||||
)
|
||||
)
|
||||
true
|
||||
}, GlobalSearchScope.fileScope(file), null
|
||||
)
|
||||
return results
|
||||
}
|
||||
|
||||
fun findAllGlobalLabelNames(project: Project): Collection<String> = StubIndex.getInstance().getAllKeys(M68kGlobalLabelStubIndex.KEY, project).toList()
|
||||
|
||||
fun findAllLocalLabels(globalLabel: M68kGlobalLabel): List<M68kLocalLabel> {
|
||||
val statement = PsiTreeUtil.getStubOrPsiParentOfType(globalLabel, M68kStatement::class.java)!!
|
||||
val results: MutableList<M68kLocalLabel> = ArrayList()
|
||||
@@ -40,23 +55,42 @@ object M68kLookupUtil {
|
||||
}
|
||||
|
||||
fun findAllSymbolDefinitions(project: Project): List<M68kSymbolDefinition> {
|
||||
return getFiles(project)
|
||||
.flatMap(::findAllSymbolDefinitions)
|
||||
.toList()
|
||||
}
|
||||
|
||||
fun findAllSymbolDefinitions(file: M68kFile): List<M68kSymbolDefinition> {
|
||||
val results: MutableList<M68kSymbolDefinition> = ArrayList()
|
||||
var currentStatement = file.firstChild
|
||||
while (currentStatement != null) {
|
||||
val child = currentStatement.firstChild
|
||||
if (child is M68kAssignment) results.add(child.firstChild as M68kSymbolDefinition)
|
||||
currentStatement = PsiTreeUtil.getNextSiblingOfType(currentStatement, M68kStatement::class.java)
|
||||
StubIndex.getInstance().processAllKeys(M68kSymbolDefinitionStubIndex.KEY, project)
|
||||
{
|
||||
results.addAll(
|
||||
StubIndex.getElements(
|
||||
M68kSymbolDefinitionStubIndex.KEY,
|
||||
it,
|
||||
project,
|
||||
GlobalSearchScope.allScope(project),
|
||||
M68kSymbolDefinition::class.java
|
||||
)
|
||||
)
|
||||
true
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
private fun getFiles(project: Project) =
|
||||
FileTypeIndex.getFiles(M68kFileType.INSTANCE, GlobalSearchScope.allScope(project)).asSequence()
|
||||
.map { PsiManager.getInstance(project).findFile(it) as M68kFile }
|
||||
fun findAllSymbolDefinitions(file: M68kFile): List<M68kSymbolDefinition> {
|
||||
val results: MutableList<M68kSymbolDefinition> = ArrayList()
|
||||
StubIndex.getInstance().processAllKeys(
|
||||
M68kSymbolDefinitionStubIndex.KEY,
|
||||
{
|
||||
results.addAll(
|
||||
StubIndex.getElements(
|
||||
M68kSymbolDefinitionStubIndex.KEY,
|
||||
it,
|
||||
file.project,
|
||||
GlobalSearchScope.fileScope(file),
|
||||
M68kSymbolDefinition::class.java
|
||||
)
|
||||
)
|
||||
true
|
||||
}, GlobalSearchScope.fileScope(file), null
|
||||
)
|
||||
return results
|
||||
}
|
||||
|
||||
fun findAllSymbolDefinitionNames(project: Project): Collection<String> = StubIndex.getInstance().getAllKeys(M68kSymbolDefinitionStubIndex.KEY, project)
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
interface M68kPsiElement : PsiElement
|
||||
@@ -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.M68kSymbolDefinitionStub
|
||||
import javax.swing.Icon
|
||||
|
||||
abstract class M68kSymbolDefinitionMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kSymbolDefinition {
|
||||
abstract class M68kSymbolDefinitionMixin : StubBasedPsiElementBase<M68kSymbolDefinitionStub>, M68kSymbolDefinition {
|
||||
|
||||
constructor(node: ASTNode) : super(node)
|
||||
|
||||
constructor(stub: M68kSymbolDefinitionStub, 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.SYMBOL_DEF
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return javaClass.simpleName + "(SYMBOL_DEFINITION)"
|
||||
}
|
||||
}
|
||||
+29
-14
@@ -1,24 +1,39 @@
|
||||
package de.platon42.intellij.plugins.m68k.refs
|
||||
|
||||
import com.intellij.navigation.ChooseByNameContributor
|
||||
import com.intellij.navigation.ChooseByNameContributorEx2
|
||||
import com.intellij.navigation.NavigationItem
|
||||
import com.intellij.openapi.project.Project
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil.findAllGlobalLabels
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil.findAllSymbolDefinitions
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.stubs.StubIndex
|
||||
import com.intellij.util.Processor
|
||||
import com.intellij.util.indexing.FindSymbolParameters
|
||||
import com.intellij.util.indexing.IdFilter
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStubIndex
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStubIndex
|
||||
|
||||
class M68kChooseByNameContributor : ChooseByNameContributor {
|
||||
override fun getNames(project: Project, includeNonProjectItems: Boolean): Array<String> {
|
||||
return listOf(findAllGlobalLabels(project), findAllSymbolDefinitions(project))
|
||||
.asSequence()
|
||||
.flatten()
|
||||
.mapNotNull { it.name }
|
||||
.toList()
|
||||
.toTypedArray()
|
||||
class M68kChooseByNameContributor : ChooseByNameContributorEx2 {
|
||||
|
||||
override fun processNames(processor: Processor<in String>, parameters: FindSymbolParameters) {
|
||||
processNames(processor, parameters.searchScope, parameters.idFilter)
|
||||
}
|
||||
|
||||
override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array<NavigationItem> {
|
||||
return listOf(findAllGlobalLabels(project), findAllSymbolDefinitions(project))
|
||||
.flatten()
|
||||
.toTypedArray()
|
||||
val result: MutableList<NavigationItem> = ArrayList()
|
||||
processElementsWithName(name, result::add, FindSymbolParameters.wrap(pattern, project, includeNonProjectItems))
|
||||
return result.toTypedArray()
|
||||
}
|
||||
|
||||
override fun processNames(processor: Processor<in String>, scope: GlobalSearchScope, filter: IdFilter?) {
|
||||
StubIndex.getInstance().processAllKeys(M68kGlobalLabelStubIndex.KEY, processor, scope, filter)
|
||||
StubIndex.getInstance().processAllKeys(M68kSymbolDefinitionStubIndex.KEY, processor, scope, filter)
|
||||
}
|
||||
|
||||
override fun processElementsWithName(name: String, processor: Processor<in NavigationItem>, parameters: FindSymbolParameters) {
|
||||
StubIndex.getInstance()
|
||||
.processElements(M68kGlobalLabelStubIndex.KEY, name, parameters.project, parameters.searchScope, M68kGlobalLabel::class.java, processor)
|
||||
StubIndex.getInstance()
|
||||
.processElements(M68kSymbolDefinitionStubIndex.KEY, name, parameters.project, parameters.searchScope, M68kSymbolDefinition::class.java, processor)
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package de.platon42.intellij.plugins.m68k.refs
|
||||
|
||||
import com.intellij.codeInsight.completion.*
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.patterns.PlatformPatterns
|
||||
import com.intellij.util.ProcessingContext
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||
|
||||
class M68kGlobalLabelSymbolCompletionContributor : CompletionContributor() {
|
||||
|
||||
companion object {
|
||||
val REGISTER_SUGGESTIONS: List<LookupElement> =
|
||||
listOf(
|
||||
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
|
||||
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",
|
||||
"pc"
|
||||
)
|
||||
.map { PrioritizedLookupElement.withPriority(LookupElementBuilder.create(it).withIcon(AllIcons.Nodes.Record).withBoldness(true), 2.0) }
|
||||
}
|
||||
|
||||
init {
|
||||
extend(CompletionType.BASIC, PlatformPatterns.psiElement(M68kTypes.SYMBOL), object : CompletionProvider<CompletionParameters>() {
|
||||
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, resultSet: CompletionResultSet) {
|
||||
resultSet.addAllElements(REGISTER_SUGGESTIONS)
|
||||
resultSet.addAllElements(M68kLookupUtil.findAllGlobalLabels(parameters.originalFile.project).map(LookupElementBuilder::createWithIcon))
|
||||
resultSet.addAllElements(M68kLookupUtil.findAllSymbolDefinitions(parameters.originalFile.project).map(LookupElementBuilder::createWithIcon))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
+20
-34
@@ -1,6 +1,5 @@
|
||||
package de.platon42.intellij.plugins.m68k.refs
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementResolveResult
|
||||
@@ -8,8 +7,10 @@ import com.intellij.psi.PsiPolyVariantReferenceBase
|
||||
import com.intellij.psi.ResolveResult
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.PsiSearchHelper
|
||||
import com.intellij.psi.search.UsageSearchContext
|
||||
import com.intellij.util.SmartList
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
||||
|
||||
@@ -18,49 +19,34 @@ class M68kGlobalLabelSymbolReference(element: M68kSymbolReference) :
|
||||
|
||||
companion object {
|
||||
val INSTANCE = Resolver()
|
||||
|
||||
fun findGlobalLabels(element: M68kSymbolReference, predicate: (M68kGlobalLabel) -> Boolean): List<M68kGlobalLabel> {
|
||||
return M68kLookupUtil.findAllGlobalLabels(element.project).filter(predicate)
|
||||
}
|
||||
|
||||
fun findSymbolDefinitions(element: M68kSymbolReference, predicate: (M68kSymbolDefinition) -> Boolean): List<M68kSymbolDefinition> {
|
||||
return M68kLookupUtil.findAllSymbolDefinitions(element.project).filter(predicate)
|
||||
}
|
||||
|
||||
private fun getCurrentFileSearchScope(element: PsiElement): GlobalSearchScope {
|
||||
return GlobalSearchScope.fileScope(element.containingFile.originalFile)
|
||||
}
|
||||
}
|
||||
|
||||
class Resolver : ResolveCache.PolyVariantResolver<M68kGlobalLabelSymbolReference> {
|
||||
override fun resolve(ref: M68kGlobalLabelSymbolReference, incompleteCode: Boolean): Array<ResolveResult> {
|
||||
val refName = ref.element.symbolName
|
||||
|
||||
val globalLabelMatches: Array<ResolveResult> = findGlobalLabels(ref.myElement) { it.name == refName }
|
||||
.map { PsiElementResolveResult(it) }
|
||||
.toTypedArray()
|
||||
if (globalLabelMatches.isNotEmpty()) return globalLabelMatches
|
||||
return findSymbolDefinitions(ref.myElement) { it.name == refName }
|
||||
.map { PsiElementResolveResult(it) }
|
||||
val project = ref.element.project
|
||||
val targets: MutableList<PsiElement> = SmartList()
|
||||
PsiSearchHelper.getInstance(project).processElementsWithWord(
|
||||
{ elem, _ ->
|
||||
when (elem) {
|
||||
is M68kGlobalLabel, is M68kSymbolDefinition -> targets.add(elem)
|
||||
}
|
||||
true
|
||||
}, GlobalSearchScope.allScope(project),
|
||||
refName, UsageSearchContext.IN_CODE, true
|
||||
)
|
||||
return targets
|
||||
.map(::PsiElementResolveResult)
|
||||
.toTypedArray()
|
||||
}
|
||||
}
|
||||
|
||||
override fun multiResolve(incompleteCode: Boolean): Array<ResolveResult> {
|
||||
return ResolveCache.getInstance(element.project)
|
||||
override fun multiResolve(incompleteCode: Boolean): Array<ResolveResult> =
|
||||
ResolveCache.getInstance(element.project)
|
||||
.resolveWithCaching(this, INSTANCE, false, incompleteCode)
|
||||
}
|
||||
|
||||
override fun resolve(): PsiElement? {
|
||||
val resolveResults = multiResolve(false)
|
||||
return resolveResults.singleOrNull()?.element
|
||||
}
|
||||
override fun resolve(): PsiElement? = multiResolve(false).singleOrNull()?.element
|
||||
|
||||
override fun getVariants(): Array<Any> {
|
||||
return listOf(findGlobalLabels(element) { true }, findSymbolDefinitions(element) { true }).asSequence()
|
||||
.flatten()
|
||||
.map { LookupElementBuilder.createWithIcon(it) }
|
||||
.toList()
|
||||
.toTypedArray()
|
||||
}
|
||||
override fun getVariants(): Array<Any> = emptyArray()
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package de.platon42.intellij.plugins.m68k.refs
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementResolveResult
|
||||
import com.intellij.psi.PsiPolyVariantReferenceBase
|
||||
import com.intellij.psi.ResolveResult
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
||||
|
||||
class M68kSymbolDefinitionReference(element: M68kSymbolReference) :
|
||||
PsiPolyVariantReferenceBase<M68kSymbolReference>(element, TextRange(0, element.textLength)) {
|
||||
|
||||
companion object {
|
||||
val INSTANCE = Resolver()
|
||||
|
||||
fun findSymbolDefinitions(element: M68kSymbolReference, predicate: (M68kSymbolDefinition) -> Boolean): List<M68kSymbolDefinition> {
|
||||
return M68kLookupUtil.findAllSymbolDefinitions(element.project).filter(predicate)
|
||||
}
|
||||
|
||||
private fun getCurrentFileSearchScope(element: PsiElement): GlobalSearchScope {
|
||||
return GlobalSearchScope.fileScope(element.containingFile.originalFile)
|
||||
}
|
||||
}
|
||||
|
||||
class Resolver : ResolveCache.PolyVariantResolver<M68kSymbolDefinitionReference> {
|
||||
override fun resolve(ref: M68kSymbolDefinitionReference, incompleteCode: Boolean): Array<ResolveResult> {
|
||||
val refName = ref.element.symbolName
|
||||
|
||||
return findSymbolDefinitions(ref.myElement) { it.name == refName }
|
||||
.map { PsiElementResolveResult(it) }
|
||||
.toTypedArray()
|
||||
}
|
||||
}
|
||||
|
||||
override fun multiResolve(incompleteCode: Boolean): Array<ResolveResult> {
|
||||
return ResolveCache.getInstance(element.project)
|
||||
.resolveWithCaching(this, INSTANCE, false, incompleteCode)
|
||||
}
|
||||
|
||||
override fun resolve(): PsiElement? {
|
||||
val resolveResults = multiResolve(false)
|
||||
return resolveResults.singleOrNull()?.element
|
||||
}
|
||||
|
||||
override fun getVariants(): Array<Any> {
|
||||
return findSymbolDefinitions(element) { true }
|
||||
.map { LookupElementBuilder.createWithIcon(it) }
|
||||
.toTypedArray()
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.intellij.lang.cacheBuilder.DefaultWordsScanner
|
||||
import com.intellij.lang.cacheBuilder.WordsScanner
|
||||
import com.intellij.lang.findUsages.FindUsagesProvider
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexer
|
||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
||||
@@ -14,23 +13,18 @@ import org.jetbrains.annotations.NonNls
|
||||
|
||||
class M68kFindUsagesProvider : FindUsagesProvider {
|
||||
|
||||
override fun getWordsScanner(): WordsScanner {
|
||||
return DefaultWordsScanner(
|
||||
override fun getWordsScanner(): WordsScanner =
|
||||
DefaultWordsScanner(
|
||||
M68kLexer(M68kLexerPrefs()), // FIXME Oh no! More Prefs!
|
||||
TokenSet.create(M68kTypes.SYMBOLDEF, M68kTypes.GLOBAL_LABEL_DEF, M68kTypes.LOCAL_LABEL_DEF, M68kTypes.SYMBOL),
|
||||
TokenSet.create(M68kTypes.COMMENT),
|
||||
TokenSet.create(M68kTypes.STRINGLIT),
|
||||
TokenSet.create(M68kTypes.STRINGLIT, M68kTypes.DECIMAL, M68kTypes.HEXADECIMAL, M68kTypes.OCTAL, M68kTypes.BINARY),
|
||||
TokenSet.EMPTY
|
||||
)
|
||||
}
|
||||
|
||||
override fun canFindUsagesFor(psiElement: PsiElement): Boolean {
|
||||
return psiElement is PsiNamedElement
|
||||
}
|
||||
override fun canFindUsagesFor(psiElement: PsiElement): Boolean = psiElement is M68kNamedElement
|
||||
|
||||
override fun getHelpId(psiElement: PsiElement): @NonNls String? {
|
||||
return null
|
||||
}
|
||||
override fun getHelpId(psiElement: PsiElement): @NonNls String? = null
|
||||
|
||||
override fun getType(element: PsiElement): @Nls String {
|
||||
return when (element) {
|
||||
@@ -38,6 +32,8 @@ class M68kFindUsagesProvider : FindUsagesProvider {
|
||||
is M68kLocalLabel -> "local label"
|
||||
is M68kSymbolDefinition -> "symbol definition"
|
||||
is M68kSymbolReference -> "symbol reference"
|
||||
is M68kRegister -> "register"
|
||||
is M68kRefExpr -> "reference expression"
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
@@ -48,11 +44,11 @@ class M68kFindUsagesProvider : FindUsagesProvider {
|
||||
is M68kLocalLabel -> element.name!!
|
||||
is M68kSymbolDefinition -> element.parent.text
|
||||
is M68kSymbolReference -> element.symbolName
|
||||
is M68kRefExpr -> element.symbolReference?.symbolName ?: ""
|
||||
is M68kRegister -> element.text
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
override fun getNodeText(element: PsiElement, useFullName: Boolean): @Nls String {
|
||||
return getDescriptiveName(element)
|
||||
}
|
||||
override fun getNodeText(element: PsiElement, useFullName: Boolean): @Nls String = getDescriptiveName(element)
|
||||
}
|
||||
+5
-2
@@ -4,6 +4,7 @@ import com.intellij.ide.structureView.StructureViewTreeElement
|
||||
import com.intellij.ide.util.treeView.smartTree.TreeElement
|
||||
import com.intellij.navigation.ItemPresentation
|
||||
import com.intellij.psi.NavigatablePsiElement
|
||||
import com.intellij.refactoring.suggested.startOffset
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||
@@ -18,8 +19,10 @@ class M68kStructureViewElement(private val myElement: NavigatablePsiElement) : S
|
||||
return when (myElement) {
|
||||
is M68kFile -> {
|
||||
listOf(
|
||||
M68kLookupUtil.findAllSymbolDefinitions(myElement),
|
||||
M68kLookupUtil.findAllGlobalLabels(myElement)
|
||||
M68kLookupUtil.findAllSymbolDefinitions(myElement).sortedBy { it.startOffset },
|
||||
M68kLookupUtil.findAllGlobalLabels(myElement).sortedBy { it.startOffset },
|
||||
// M68kLookupUtil.findAllSymbolDefinitions(myElement).sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name!! }),
|
||||
// M68kLookupUtil.findAllGlobalLabels(myElement).sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name!! })
|
||||
)
|
||||
.flatten()
|
||||
.map(::M68kStructureViewElement)
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
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.M68kSymbolDefinition
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||
import de.platon42.intellij.plugins.m68k.psi.impl.M68kGlobalLabelImpl
|
||||
import de.platon42.intellij.plugins.m68k.psi.impl.M68kSymbolDefinitionImpl
|
||||
import de.platon42.intellij.plugins.m68k.stubs.impl.M68kGlobalLabelStubImpl
|
||||
import de.platon42.intellij.plugins.m68k.stubs.impl.M68kSymbolDefinitionStubImpl
|
||||
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!!)
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val SYMBOL_DEFINITION: IStubElementType<M68kSymbolDefinitionStub, M68kSymbolDefinition> =
|
||||
object : M68kStubElementType<M68kSymbolDefinitionStub, M68kSymbolDefinition>("SYMBOL_DEFINITION") {
|
||||
override fun createPsi(stub: M68kSymbolDefinitionStub): M68kSymbolDefinition = M68kSymbolDefinitionImpl(stub, this)
|
||||
|
||||
override fun createStub(psi: M68kSymbolDefinition, parentStub: StubElement<out PsiElement>): M68kSymbolDefinitionStub =
|
||||
M68kSymbolDefinitionStubImpl(parentStub, this, psi.name!!)
|
||||
|
||||
override fun createStub(tree: LighterAST, node: LighterASTNode, parentStub: StubElement<*>): M68kSymbolDefinitionStub {
|
||||
val idNode = LightTreeUtil.requiredChildOfType(tree, node, M68kTypes.SYMBOLDEF)
|
||||
return M68kSymbolDefinitionStubImpl(parentStub, this, LightTreeUtil.toFilteredString(tree, idNode, null))
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun serialize(stub: M68kSymbolDefinitionStub, dataStream: StubOutputStream) = dataStream.writeName(stub.name)
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>): M68kSymbolDefinitionStub =
|
||||
M68kSymbolDefinitionStubImpl(parentStub, this, dataStream.readName()!!)
|
||||
|
||||
override fun indexStub(stub: M68kSymbolDefinitionStub, sink: IndexSink) = sink.occurrence(M68kSymbolDefinitionStubIndex.KEY, stub.name!!)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,4 @@ package de.platon42.intellij.plugins.m68k.stubs
|
||||
import com.intellij.psi.stubs.PsiFileStubImpl
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
||||
|
||||
class M68kFileStub(file: M68kFile?) : PsiFileStubImpl<M68kFile?>(file)
|
||||
class M68kFileStub(file: M68kFile) : PsiFileStubImpl<M68kFile>(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>
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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> {
|
||||
return when (name) {
|
||||
"GLOBAL_LABEL" -> M68kElementTypes.GLOBAL_LABEL
|
||||
"SYMBOL_DEFINITION" -> M68kElementTypes.SYMBOL_DEFINITION
|
||||
else -> throw RuntimeException("Unknown element type '$name'")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.platon42.intellij.plugins.m68k.stubs
|
||||
|
||||
import com.intellij.psi.stubs.NamedStub
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||
|
||||
interface M68kSymbolDefinitionStub : NamedStub<M68kSymbolDefinition>
|
||||
+16
@@ -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.M68kSymbolDefinition
|
||||
|
||||
class M68kSymbolDefinitionStubIndex : StringStubIndexExtension<M68kSymbolDefinition>() {
|
||||
override fun getKey(): StubIndexKey<String, M68kSymbolDefinition> = KEY
|
||||
|
||||
override fun getVersion(): Int = M68kFileElementType.STUB_VERSION
|
||||
|
||||
companion object {
|
||||
val KEY = StubIndexKey.createIndexKey<String, M68kSymbolDefinition>("mc68000.symboldef.index")
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
+13
@@ -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.M68kSymbolDefinition
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStub
|
||||
|
||||
class M68kSymbolDefinitionStubImpl : NamedStubBase<M68kSymbolDefinition>, M68kSymbolDefinitionStub {
|
||||
constructor(parent: StubElement<*>, elementType: IStubElementType<*, *>, name: StringRef) : super(parent, elementType, name)
|
||||
constructor(parent: StubElement<*>, elementType: IStubElementType<*, *>, name: String) : super(parent, elementType, name)
|
||||
}
|
||||
@@ -5,11 +5,12 @@
|
||||
</vendor>
|
||||
|
||||
<description><![CDATA[
|
||||
MC68000 Assembly Language Plugin adds language support for Motorola 68000 (M68k) assembly language files.
|
||||
MC68000 Assembly Language Plugin adds language support for Motorola 68000 (M68k) assembly language files (asm).
|
||||
It provides syntax highlighting and refactoring possibilities among other things.
|
||||
<p>
|
||||
<a href="https://github.com/chrisly42/mc68000-asm-plugin/blob/main/README.md">Full documentation here...</a>
|
||||
]]></description>
|
||||
<idea-version since-build="193.7288.26"/>
|
||||
<idea-version since-build="193.7288.0"/>
|
||||
|
||||
<depends>com.intellij.modules.lang</depends>
|
||||
|
||||
@@ -22,13 +23,16 @@
|
||||
implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighterFactory"/>
|
||||
<colorSettingsPage implementation="de.platon42.intellij.plugins.m68k.syntax.M68kColorSettingsPage"/>
|
||||
<completion.contributor language="MC68000" implementationClass="de.platon42.intellij.plugins.m68k.asm.M68kMnemonicCompletionContributor"/>
|
||||
<completion.contributor language="MC68000" implementationClass="de.platon42.intellij.plugins.m68k.refs.M68kGlobalLabelSymbolCompletionContributor"/>
|
||||
<lang.braceMatcher language="MC68000" implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kPairedBraceMatcher"/>
|
||||
<lang.quoteHandler language="MC68000" implementationClass="de.platon42.intellij.plugins.m68k.M68kStringQuoteHandler"/>
|
||||
<lang.findUsagesProvider language="MC68000" implementationClass="de.platon42.intellij.plugins.m68k.scanner.M68kFindUsagesProvider"/>
|
||||
<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"/>
|
||||
<stubIndex implementation="de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStubIndex"/>
|
||||
<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"/>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<svg viewBox="0 0 16 16" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<polygon fill="#40B6E0" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
|
||||
<polygon fill="#9AA7B0" fill-opacity=".8" points="7 1 3 5 7 5"/>
|
||||
<polygon fill="#9AA7B0" fill-opacity=".8" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
|
||||
<path fill="#231F20" fill-opacity=".7"
|
||||
d="M 2.433 12.819 C 2.433 11.779 2.636 10.996 3.043 10.469 C 3.45 9.949 4.053 9.689 4.853 9.689 C 5.12 9.689 5.336 9.712 5.503 9.759 L 5.503 10.279 C 5.323 10.219 5.11 10.189 4.863 10.189 C 4.283 10.189 3.843 10.369 3.543 10.729 C 3.25 11.089 3.086 11.646 3.053 12.399 L 3.103 12.399 C 3.37 11.979 3.79 11.769 4.363 11.769 C 4.843 11.769 5.223 11.916 5.503 12.209 C 5.776 12.496 5.913 12.902 5.913 13.429 C 5.913 13.949 5.763 14.369 5.463 14.689 C 5.156 15.002 4.736 15.159 4.203 15.159 C 3.676 15.159 3.25 14.952 2.923 14.539 C 2.596 14.126 2.433 13.552 2.433 12.819 Z M 5.033 14.319 C 5.22 14.106 5.313 13.806 5.313 13.419 C 5.313 13.032 5.223 12.742 5.043 12.549 C 4.863 12.349 4.6 12.249 4.253 12.249 C 3.933 12.236 3.653 12.336 3.413 12.549 C 3.173 12.756 3.053 12.989 3.053 13.249 C 3.053 13.629 3.166 13.959 3.393 14.239 C 3.613 14.526 3.89 14.662 4.223 14.649 C 4.57 14.649 4.84 14.539 5.033 14.319 ZM 7.256 10.029 C 7.542 9.802 7.926 9.689 8.406 9.689 C 8.892 9.689 9.276 9.802 9.556 10.029 C 9.836 10.256 9.976 10.566 9.976 10.959 C 9.976 11.499 9.636 11.936 8.956 12.269 C 9.382 12.469 9.689 12.686 9.876 12.919 C 10.056 13.152 10.146 13.416 10.146 13.709 C 10.146 14.156 9.996 14.509 9.696 14.769 C 9.389 15.029 8.959 15.159 8.406 15.159 C 7.846 15.159 7.416 15.036 7.116 14.789 C 6.809 14.542 6.656 14.189 6.656 13.729 C 6.656 13.122 7.026 12.649 7.766 12.309 C 7.439 12.122 7.202 11.919 7.056 11.699 C 6.902 11.479 6.826 11.232 6.826 10.959 C 6.826 10.572 6.969 10.262 7.256 10.029 Z M 9.166 11.579 C 9.312 11.406 9.386 11.202 9.386 10.969 C 9.386 10.736 9.299 10.546 9.126 10.399 C 8.946 10.252 8.702 10.179 8.396 10.179 C 8.096 10.179 7.859 10.252 7.686 10.399 C 7.506 10.546 7.416 10.736 7.416 10.969 C 7.416 11.202 7.489 11.399 7.636 11.559 C 7.782 11.719 8.049 11.879 8.436 12.039 C 8.776 11.899 9.019 11.746 9.166 11.579 Z M 7.496 13.069 C 7.329 13.256 7.246 13.489 7.246 13.769 C 7.246 14.042 7.349 14.262 7.556 14.429 C 7.756 14.589 8.039 14.669 8.406 14.669 C 8.766 14.669 9.049 14.586 9.256 14.419 C 9.456 14.252 9.556 14.019 9.556 13.719 C 9.556 13.486 9.459 13.276 9.266 13.089 C 9.079 12.909 8.752 12.732 8.286 12.559 C 7.919 12.712 7.656 12.882 7.496 13.069 ZM 11.888 12.999 L 11.888 15.089 L 11.268 15.089 L 11.268 9.769 L 11.888 9.769 L 11.888 12.409 L 14.308 9.769 L 15.028 9.769 L 12.888 12.079 L 15.108 15.089 L 14.388 15.089 L 12.448 12.509 L 11.888 12.999 Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
@@ -20,6 +20,7 @@ internal class BasicAsmInstTest : AbstractParsingTest() {
|
||||
+ "; comment\n"
|
||||
+ " jmp\tresetcode ; unreachable\n"
|
||||
+ " \n"
|
||||
+ "eoflabel"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,11 @@ internal class ExpressionsTest : AbstractParsingTest() {
|
||||
testGoodSyntax(testCase, "FOO = -(~(!!(+(1//~WIDTH^@123+%100101*4/2+(NARF%10|32!21))<<2)>>1)&$1f)\n")
|
||||
}
|
||||
|
||||
@Test
|
||||
internal fun comparing_expressions(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
|
||||
testGoodSyntax(testCase, "FOO = ((WIDTH<20)&&(HEIGHT<=10))||((WIDTH>=40)&&(HEIGHT>128))&&(WIDTH!=0)&&(HEIGHT<>0)=1\n")
|
||||
}
|
||||
|
||||
@Test
|
||||
internal fun current_pc_symbol_relative_expression(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
|
||||
testGoodSyntax(testCase, " dc.w *-.label\n")
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package de.platon42.intellij.plugins.m68k.refs
|
||||
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||
import de.platon42.intellij.jupiter.LightCodeInsightExtension
|
||||
import de.platon42.intellij.jupiter.MyFixture
|
||||
import de.platon42.intellij.jupiter.TestDataPath
|
||||
import de.platon42.intellij.jupiter.TestDataSubPath
|
||||
import de.platon42.intellij.plugins.m68k.AbstractM68kTest
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
|
||||
@TestDataPath("src/test/resources/references")
|
||||
@TestDataSubPath("completion")
|
||||
@ExtendWith(LightCodeInsightExtension::class)
|
||||
internal class M68kGlobalLabelSymbolCompletionContributorTest : AbstractM68kTest() {
|
||||
|
||||
@Test
|
||||
internal fun completion_shows_fitting_symbols_and_labels_after_first_letter(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByText(
|
||||
"completeme.asm", """
|
||||
PIC_WIDTH = 100
|
||||
PIC_HEIGHT = 100
|
||||
platon = 42
|
||||
HURZ = 220
|
||||
NP equ 10
|
||||
|
||||
Irrelevant_Label:
|
||||
Problem_solver:
|
||||
move.l P<caret>
|
||||
"""
|
||||
)
|
||||
myFixture.completeBasic()
|
||||
assertThat(myFixture.lookupElementStrings).containsExactlyInAnyOrder("PIC_HEIGHT", "PIC_WIDTH", "Problem_solver", "NP")
|
||||
}
|
||||
|
||||
@Test
|
||||
internal fun completion_shows_all_symbols_and_labels_inside_expr(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByText(
|
||||
"completeme.asm", """
|
||||
PIC_WIDTH = 100
|
||||
HURZ = 220
|
||||
NP equ 10
|
||||
|
||||
Problem_solver:
|
||||
move.l 145+<caret>
|
||||
"""
|
||||
)
|
||||
myFixture.completeBasic()
|
||||
assertThat(myFixture.lookupElementStrings).containsExactlyInAnyOrder(
|
||||
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",
|
||||
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
|
||||
"pc",
|
||||
"HURZ", "NP", "PIC_WIDTH", "Problem_solver"
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
internal fun completion_puts_register_on_top(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByText(
|
||||
"completeme.asm", """
|
||||
PIC_WIDTH = 320
|
||||
PIC_HEIGHT equ 256
|
||||
DEBUG_LEVEL set 10
|
||||
double_buffer_1 = 1
|
||||
auto_complete_2 = 1
|
||||
|
||||
entry:
|
||||
bsr init
|
||||
bsr main
|
||||
bsr exit
|
||||
move.l d1<caret>
|
||||
rts
|
||||
"""
|
||||
)
|
||||
myFixture.completeBasic()
|
||||
assertThat(myFixture.lookupElementStrings).containsExactly("d1", "double_buffer_1")
|
||||
}
|
||||
|
||||
@Test
|
||||
internal fun complete_several_basic_symbols_or_labels(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByFile("basic_completion.asm")
|
||||
myFixture.completeBasicAllCarets(null)
|
||||
myFixture.checkResultByFile("basic_completion_after_op.asm")
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -17,11 +17,11 @@ import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
|
||||
@TestDataPath("src/test/resources/references")
|
||||
@TestDataSubPath("labels")
|
||||
@ExtendWith(LightCodeInsightExtension::class)
|
||||
internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||
|
||||
@Test
|
||||
@TestDataSubPath("labels")
|
||||
internal fun reference_to_dot_local_label_can_be_renamed(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByFile("dot_local_label.asm")
|
||||
assertThat(myFixture.elementAtCaret).isInstanceOf(M68kLocalLabel::class.java)
|
||||
@@ -31,6 +31,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestDataSubPath("labels")
|
||||
internal fun reference_to_multiple_conditional_local_label_dollar_and_variants(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
val reference = myFixture.getReferenceAtCaretPositionWithAssertion("multiple_conditional_local_label_dollar.asm")
|
||||
assertThat(reference.element).isInstanceOf(M68kSymbolReference::class.java)
|
||||
@@ -40,6 +41,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestDataSubPath("labels")
|
||||
internal fun reference_to_global_label_can_be_renamed(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
val file = myFixture.configureByFile("global_labels.asm")
|
||||
assertThat(myFixture.elementAtCaret).isInstanceOf(M68kGlobalLabel::class.java)
|
||||
@@ -47,9 +49,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||
|
||||
val reference = file.findReferenceAt(myFixture.editor.caretModel.offset - 1)!!
|
||||
assertThat(reference).isInstanceOf(M68kGlobalLabelSymbolReference::class.java)
|
||||
assertThat(reference.variants).hasOnlyElementsOfType(LookupElementBuilder::class.java)
|
||||
.extracting<String> { (it as LookupElementBuilder).lookupString }
|
||||
.containsExactlyInAnyOrder("main", "init", "exit")
|
||||
assertThat(reference.variants).isEmpty()
|
||||
|
||||
myFixture.renameElementAtCaret("intro_main")
|
||||
|
||||
@@ -57,6 +57,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestDataSubPath("symbols")
|
||||
internal fun reference_to_symbol_can_be_renamed(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
val file = myFixture.configureByFile("symbol_assignment.asm")
|
||||
assertThat(myFixture.elementAtCaret).isInstanceOf(M68kSymbolDefinition::class.java)
|
||||
@@ -66,9 +67,7 @@ internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||
|
||||
val reference = file.findReferenceAt(myFixture.editor.caretModel.offset)!!
|
||||
assertThat(reference).isInstanceOf(M68kGlobalLabelSymbolReference::class.java)
|
||||
assertThat(reference.variants).hasOnlyElementsOfType(LookupElementBuilder::class.java)
|
||||
.extracting<String> { (it as LookupElementBuilder).lookupString }
|
||||
.containsExactlyInAnyOrder("main", "init", "exit", "PIC_WIDTH", "PIC_HEIGHT")
|
||||
assertThat(reference.variants).isEmpty()
|
||||
|
||||
myFixture.checkResultByFile("symbol_assignment_after_rename.asm")
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package de.platon42.intellij.plugins.m68k.structureview
|
||||
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||
import de.platon42.intellij.jupiter.LightCodeInsightExtension
|
||||
import de.platon42.intellij.jupiter.MyFixture
|
||||
import de.platon42.intellij.jupiter.TestDataPath
|
||||
import de.platon42.intellij.plugins.m68k.AbstractM68kTest
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
|
||||
@TestDataPath("src/test/resources/structureview")
|
||||
@ExtendWith(LightCodeInsightExtension::class)
|
||||
internal class M68kStructureViewTest : AbstractM68kTest() {
|
||||
|
||||
@Test
|
||||
internal fun do_basic_verification_of_resulting_structure_view(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||
myFixture.configureByFile("basic_example.asm")
|
||||
myFixture.testStructureView {
|
||||
val tree = it.tree
|
||||
PlatformTestUtil.waitWhileBusy(tree)
|
||||
PlatformTestUtil.assertTreeEqual(
|
||||
tree, """-basic_example.asm
|
||||
PIC_WIDTH
|
||||
PIC_HEIGHT
|
||||
DEBUG_LEVEL
|
||||
entry
|
||||
-init
|
||||
.looph
|
||||
.loopw
|
||||
main
|
||||
exit
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,3 +54,6 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace('\n')
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kGlobalLabelImpl(GLOBAL_LABEL)
|
||||
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('eoflabel')
|
||||
@@ -0,0 +1,89 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
M68kBinaryLogicalOrExprImpl(BINARY_LOGICAL_OR_EXPR)
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryLogicalAndExprImpl(BINARY_LOGICAL_AND_EXPR)
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryCmpLtExprImpl(BINARY_CMP_LT_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
PsiElement(M68kTokenType.OP_CMP_LT)('<')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('20')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.OP_LOGICAL_AND)('&&')
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryCmpLeExprImpl(BINARY_CMP_LE_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('HEIGHT')
|
||||
PsiElement(M68kTokenType.OP_CMP_LT_EQ)('<=')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('10')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.OP_LOGICAL_OR)('||')
|
||||
M68kBinaryLogicalAndExprImpl(BINARY_LOGICAL_AND_EXPR)
|
||||
M68kBinaryLogicalAndExprImpl(BINARY_LOGICAL_AND_EXPR)
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryLogicalAndExprImpl(BINARY_LOGICAL_AND_EXPR)
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryCmpGeExprImpl(BINARY_CMP_GE_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
PsiElement(M68kTokenType.OP_CMP_GT_EQ)('>=')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('40')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.OP_LOGICAL_AND)('&&')
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryCmpGtExprImpl(BINARY_CMP_GT_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('HEIGHT')
|
||||
PsiElement(M68kTokenType.OP_CMP_GT)('>')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('128')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.OP_LOGICAL_AND)('&&')
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryCmpNeExprImpl(BINARY_CMP_NE_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
PsiElement(M68kTokenType.OP_CMP_NOT_EQ)('!=')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('0')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.OP_LOGICAL_AND)('&&')
|
||||
M68kBinaryCmpEqExprImpl(BINARY_CMP_EQ_EXPR)
|
||||
M68kParenExprImpl(PAREN_EXPR)
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryCmpNeExprImpl(BINARY_CMP_NE_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('HEIGHT')
|
||||
PsiElement(M68kTokenType.OP_CMP_NOT_EQ)('<>')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('0')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.OP_CMP_EQ)('=')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('1')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
@@ -0,0 +1,36 @@
|
||||
PIC_WIDTH = 320
|
||||
PIC_HEIGHT equ 256
|
||||
DEBUG_LEVEL set 10
|
||||
DOUBLE_BUFFER_1 = 1
|
||||
AUTO_COMPLETE_2 = 1
|
||||
dood2 = 1
|
||||
|
||||
entry:
|
||||
bsr init
|
||||
bsr main
|
||||
bsr exit
|
||||
rts
|
||||
|
||||
init
|
||||
move.w #PIC_HEIGHT,d1
|
||||
.looph move.w #PIC_WIDTH,d0
|
||||
.loopw clr.b (a0)+
|
||||
subq.w #1,d0
|
||||
bne.s .loopw
|
||||
subq.w #1,d1
|
||||
bne.s .looph
|
||||
move.w a1,d2<caret>
|
||||
move.w e<caret>
|
||||
move.w ex<caret>
|
||||
move.w PW<caret>
|
||||
move.w A<caret>
|
||||
move.w DEB<caret>
|
||||
move.w A2<caret>
|
||||
move.w D1<caret>
|
||||
rts
|
||||
|
||||
main moveq.l #0,d0
|
||||
rts
|
||||
|
||||
exit illegal
|
||||
rts
|
||||
@@ -0,0 +1,36 @@
|
||||
PIC_WIDTH = 320
|
||||
PIC_HEIGHT equ 256
|
||||
DEBUG_LEVEL set 10
|
||||
DOUBLE_BUFFER_1 = 1
|
||||
AUTO_COMPLETE_2 = 1
|
||||
dood2 = 1
|
||||
|
||||
entry:
|
||||
bsr init
|
||||
bsr main
|
||||
bsr exit
|
||||
rts
|
||||
|
||||
init
|
||||
move.w #PIC_HEIGHT,d1
|
||||
.looph move.w #PIC_WIDTH,d0
|
||||
.loopw clr.b (a0)+
|
||||
subq.w #1,d0
|
||||
bne.s .loopw
|
||||
subq.w #1,d1
|
||||
bne.s .looph
|
||||
move.w a1,d2
|
||||
move.w e
|
||||
move.w exit
|
||||
move.w PIC_WIDTH
|
||||
move.w AUTO_COMPLETE_2
|
||||
move.w DEBUG_LEVEL
|
||||
move.w AUTO_COMPLETE_2
|
||||
move.w DOUBLE_BUFFER_1
|
||||
rts
|
||||
|
||||
main moveq.l #0,d0
|
||||
rts
|
||||
|
||||
exit illegal
|
||||
rts
|
||||
@@ -0,0 +1,25 @@
|
||||
PIC_WIDTH = 320
|
||||
PIC_HEIGHT equ 256
|
||||
DEBUG_LEVEL set 10
|
||||
|
||||
entry:
|
||||
bsr init
|
||||
bsr main
|
||||
bsr exit
|
||||
rts
|
||||
|
||||
init
|
||||
move.w #PIC_HEIGHT,d1
|
||||
.looph move.w #PIC_WIDTH,d0
|
||||
.loopw clr.b (a0)+
|
||||
subq.w #1,d0
|
||||
bne.s .loopw
|
||||
subq.w #1,d1
|
||||
bne.s .looph
|
||||
rts
|
||||
|
||||
main moveq.l #0,d0
|
||||
rts
|
||||
|
||||
exit illegal
|
||||
rts
|
||||
Reference in New Issue
Block a user