Reworked BNF for symbol references and program counter. Enhanced syntax highlighting. Continued work on referencing (not yet working). Fixed renaming of Labels and Symbols. Added M68kRenameInputValidator for correct renaming of symbols and labels (allow local labels with dot or dollar). Added UsagesProvider (not sure if working). Added PairedBraceMatcher.
This commit is contained in:
parent
349372f6b3
commit
25c755d729
@ -411,13 +411,13 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// SYMBOLDEF COLON? (OP_ASSIGN|EQU) expr
|
||||
// SymbolDefinition COLON? (OP_ASSIGN|EQU) expr
|
||||
public static boolean Assignment(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "Assignment")) return false;
|
||||
if (!nextTokenIs(b, SYMBOLDEF)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, SYMBOLDEF);
|
||||
r = SymbolDefinition(b, l + 1);
|
||||
r = r && Assignment_1(b, l + 1);
|
||||
r = r && Assignment_2(b, l + 1);
|
||||
r = r && expr(b, l + 1, -1);
|
||||
@ -902,6 +902,18 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// CURRENT_PC_SYMBOL
|
||||
public static boolean ProgramCounterReference(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "ProgramCounterReference")) return false;
|
||||
if (!nextTokenIs(b, CURRENT_PC_SYMBOL)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, CURRENT_PC_SYMBOL);
|
||||
exit_section_(b, m, PROGRAM_COUNTER_REFERENCE, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// DataRegister | AddressRegister | SpecialRegister
|
||||
public static boolean Register(PsiBuilder b, int l) {
|
||||
@ -1016,6 +1028,30 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// SYMBOLDEF
|
||||
public static boolean SymbolDefinition(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "SymbolDefinition")) return false;
|
||||
if (!nextTokenIs(b, SYMBOLDEF)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, SYMBOLDEF);
|
||||
exit_section_(b, m, SYMBOL_DEFINITION, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// SYMBOL
|
||||
public static boolean SymbolReference(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "SymbolReference")) return false;
|
||||
if (!nextTokenIs(b, SYMBOL)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, SYMBOL);
|
||||
exit_section_(b, m, SYMBOL_REFERENCE, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// !<<eof>> statement EOL
|
||||
static boolean line(PsiBuilder b, int l) {
|
||||
@ -1222,14 +1258,14 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r || p;
|
||||
}
|
||||
|
||||
// SYMBOL|CURRENT_PC_SYMBOL
|
||||
// SymbolReference|ProgramCounterReference
|
||||
public static boolean ref_expr(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "ref_expr")) return false;
|
||||
if (!nextTokenIsSmart(b, CURRENT_PC_SYMBOL, SYMBOL)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, REF_EXPR, "<expression>");
|
||||
r = consumeTokenSmart(b, SYMBOL);
|
||||
if (!r) r = consumeTokenSmart(b, CURRENT_PC_SYMBOL);
|
||||
r = SymbolReference(b, l + 1);
|
||||
if (!r) r = ProgramCounterReference(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAssignment extends PsiElement {
|
||||
|
||||
@NotNull
|
||||
M68kSymbolDefinition getSymbolDefinition();
|
||||
|
||||
@NotNull
|
||||
M68kExpr getExpr();
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
// 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 {
|
||||
|
||||
}
|
@ -1,6 +1,14 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kRefExpr extends M68kExpr {
|
||||
|
||||
@Nullable
|
||||
M68kProgramCounterReference getProgramCounterReference();
|
||||
|
||||
@Nullable
|
||||
M68kSymbolReference getSymbolReference();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
// 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;
|
||||
|
||||
public interface M68kSymbolDefinition extends M68kNamedElement {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@NotNull
|
||||
PsiElement setName(@NotNull String name);
|
||||
|
||||
@NotNull
|
||||
PsiElement getNameIdentifier();
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kSymbolReference extends PsiElement {
|
||||
|
||||
}
|
@ -58,12 +58,15 @@ public interface M68kTypes {
|
||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE");
|
||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE");
|
||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE");
|
||||
IElementType PROGRAM_COUNTER_REFERENCE = new M68kElementType("PROGRAM_COUNTER_REFERENCE");
|
||||
IElementType REF_EXPR = new M68kElementType("REF_EXPR");
|
||||
IElementType REGISTER = new M68kElementType("REGISTER");
|
||||
IElementType REGISTER_LIST_ADDRESSING_MODE = new M68kElementType("REGISTER_LIST_ADDRESSING_MODE");
|
||||
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_REFERENCE = new M68kElementType("SYMBOL_REFERENCE");
|
||||
IElementType UNARY_COMPL_EXPR = new M68kElementType("UNARY_COMPL_EXPR");
|
||||
IElementType UNARY_MINUS_EXPR = new M68kElementType("UNARY_MINUS_EXPR");
|
||||
IElementType UNARY_NOT_EXPR = new M68kElementType("UNARY_NOT_EXPR");
|
||||
@ -220,6 +223,8 @@ public interface M68kTypes {
|
||||
return new M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(node);
|
||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
||||
return new M68kProgramCounterIndirectWithIndexOldAddressingModeImpl(node);
|
||||
} else if (type == PROGRAM_COUNTER_REFERENCE) {
|
||||
return new M68kProgramCounterReferenceImpl(node);
|
||||
} else if (type == REF_EXPR) {
|
||||
return new M68kRefExprImpl(node);
|
||||
} else if (type == REGISTER_LIST_ADDRESSING_MODE) {
|
||||
@ -230,6 +235,10 @@ public interface M68kTypes {
|
||||
return new M68kSpecialRegisterDirectAddressingModeImpl(node);
|
||||
} else if (type == STATEMENT) {
|
||||
return new M68kStatementImpl(node);
|
||||
} else if (type == SYMBOL_DEFINITION) {
|
||||
return new M68kSymbolDefinitionImpl(node);
|
||||
} else if (type == SYMBOL_REFERENCE) {
|
||||
return new M68kSymbolReferenceImpl(node);
|
||||
} else if (type == UNARY_COMPL_EXPR) {
|
||||
return new M68kUnaryComplExprImpl(node);
|
||||
} else if (type == UNARY_MINUS_EXPR) {
|
||||
|
@ -125,6 +125,10 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterReference(@NotNull M68kProgramCounterReference o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitRegister(@NotNull M68kRegister o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
@ -141,6 +145,14 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitSymbolDefinition(@NotNull M68kSymbolDefinition o) {
|
||||
visitNamedElement(o);
|
||||
}
|
||||
|
||||
public void visitSymbolReference(@NotNull M68kSymbolReference o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitBinaryAddExpr(@NotNull M68kBinaryAddExpr o) {
|
||||
visitExpr(o);
|
||||
}
|
||||
@ -250,6 +262,10 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitExpr(o);
|
||||
}
|
||||
|
||||
public void visitNamedElement(@NotNull M68kNamedElement o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitPsiElement(@NotNull PsiElement o) {
|
||||
visitElement(o);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAssignment;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -25,6 +26,12 @@ public class M68kAssignmentImpl extends ASTWrapperPsiElement implements M68kAssi
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kSymbolDefinition getSymbolDefinition() {
|
||||
return findNotNullChildByClass(M68kSymbolDefinition.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
|
@ -0,0 +1,27 @@
|
||||
// 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.M68kProgramCounterReference;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class M68kProgramCounterReferenceImpl extends ASTWrapperPsiElement implements M68kProgramCounterReference {
|
||||
|
||||
public M68kProgramCounterReferenceImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitProgramCounterReference(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
}
|
@ -3,9 +3,12 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterReference;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kRefExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class M68kRefExprImpl extends M68kExprImpl implements M68kRefExpr {
|
||||
|
||||
@ -24,4 +27,16 @@ public class M68kRefExprImpl extends M68kExprImpl implements M68kRefExpr {
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kProgramCounterReference getProgramCounterReference() {
|
||||
return findChildByClass(M68kProgramCounterReference.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kSymbolReference getSymbolReference() {
|
||||
return findChildByClass(M68kSymbolReference.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
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 org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class M68kSymbolDefinitionImpl extends M68kSymbolDefinitionMixin implements M68kSymbolDefinition {
|
||||
|
||||
public M68kSymbolDefinitionImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitSymbolDefinition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getName() {
|
||||
return M68kPsiImplUtil.getName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement setName(@NotNull String name) {
|
||||
return M68kPsiImplUtil.setName(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement getNameIdentifier() {
|
||||
return M68kPsiImplUtil.getNameIdentifier(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// 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.M68kSymbolReference;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class M68kSymbolReferenceImpl extends ASTWrapperPsiElement implements M68kSymbolReference {
|
||||
|
||||
public M68kSymbolReferenceImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitSymbolReference(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
}
|
@ -126,7 +126,13 @@ statement ::= (Assignment
|
||||
|
||||
private statement_recover ::= !(EOL)
|
||||
|
||||
Assignment ::= SYMBOLDEF COLON? (OP_ASSIGN|EQU) expr
|
||||
SymbolDefinition ::= SYMBOLDEF {
|
||||
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
|
||||
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinitionMixin"
|
||||
methods = [getName setName getNameIdentifier]
|
||||
}
|
||||
|
||||
Assignment ::= SymbolDefinition COLON? (OP_ASSIGN|EQU) expr
|
||||
|
||||
private LabelInsts ::= LabelWithInstruction | LabelOnly | InstructionOnly
|
||||
|
||||
@ -173,6 +179,9 @@ private PreprocessorOperand ::= expr
|
||||
|
||||
private PlainOperands ::= STRINGLIT (SEPARATOR STRINGLIT)*
|
||||
|
||||
SymbolReference ::= SYMBOL // TODO This should probably be a ILazyParseableElementType, no idea how to implement that yet
|
||||
ProgramCounterReference ::= CURRENT_PC_SYMBOL
|
||||
|
||||
DataRegister ::= DREG {
|
||||
name = "data register"
|
||||
extends = Register
|
||||
@ -280,7 +289,7 @@ binary_logical_or_expr ::= expr OP_LOGICAL_OR expr
|
||||
|
||||
//macrobrace_expr ::= OP_CMP_LT expr OP_CMP_GT
|
||||
paren_expr ::= ROUND_L expr ROUND_R //{pin=1 recoverWhile=statement_recover}
|
||||
ref_expr ::= SYMBOL|CURRENT_PC_SYMBOL
|
||||
ref_expr ::= SymbolReference|ProgramCounterReference
|
||||
literal_expr ::= BINARY|DECIMAL|HEXADECIMAL|OCTAL|STRINGLIT {
|
||||
implements = "com.intellij.psi.PsiLiteralValue"
|
||||
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kLiteralExprMixin"
|
||||
|
@ -8,15 +8,20 @@ import de.platon42.intellij.plugins.m68k.M68kFileType.Companion.INSTANCE
|
||||
object M68kElementFactory {
|
||||
|
||||
fun createGlobalLabel(project: Project, label: String): M68kGlobalLabel {
|
||||
val file = createFile(project, label)
|
||||
val file = createFile(project, "$label\n")
|
||||
return PsiTreeUtil.findChildOfType(file, M68kGlobalLabel::class.java)!!
|
||||
}
|
||||
|
||||
fun createLocalLabel(project: Project, label: String): M68kLocalLabel {
|
||||
val file = createFile(project, label)
|
||||
val file = createFile(project, "$label\n")
|
||||
return PsiTreeUtil.findChildOfType(file, M68kLocalLabel::class.java)!!
|
||||
}
|
||||
|
||||
fun createSymbolDefinition(project: Project, label: String): M68kSymbolDefinition {
|
||||
val file = createFile(project, "$label=0\n")
|
||||
return PsiTreeUtil.findChildOfType(file, M68kSymbolDefinition::class.java)!!
|
||||
}
|
||||
|
||||
fun createFile(project: Project, content: String): M68kFile {
|
||||
return PsiFileFactory.getInstance(project).createFileFromText("dummy.m68k", INSTANCE, content) as M68kFile
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.util.IncorrectOperationException
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kElementFactory.createGlobalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kElementFactory.createLocalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kElementFactory.createSymbolDefinition
|
||||
|
||||
object M68kPsiImplUtil {
|
||||
|
||||
// Global Label
|
||||
@JvmStatic
|
||||
fun getName(element: M68kGlobalLabel): String? = element.firstChild.text
|
||||
|
||||
@ -23,6 +25,7 @@ object M68kPsiImplUtil {
|
||||
@JvmStatic
|
||||
fun getNameIdentifier(element: M68kGlobalLabel): PsiElement = element.firstChild
|
||||
|
||||
// Local Label
|
||||
@JvmStatic
|
||||
fun getName(element: M68kLocalLabel): String? = element.firstChild.text
|
||||
|
||||
@ -39,4 +42,24 @@ object M68kPsiImplUtil {
|
||||
|
||||
@JvmStatic
|
||||
fun getNameIdentifier(element: M68kLocalLabel): PsiElement = element.firstChild
|
||||
|
||||
|
||||
// Symbol Definition
|
||||
|
||||
@JvmStatic
|
||||
fun getName(element: M68kSymbolDefinition): String? = element.firstChild.text
|
||||
|
||||
@JvmStatic
|
||||
fun setName(element: M68kSymbolDefinition, name: String): PsiElement {
|
||||
val nameNode = element.node.findChildByType(M68kTypes.SYMBOLDEF)
|
||||
if (nameNode != null) {
|
||||
val newSymbolDefinition = createSymbolDefinition(element.project, name)
|
||||
element.node.replaceChild(nameNode, newSymbolDefinition.firstChild.node)
|
||||
}
|
||||
return element
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getNameIdentifier(element: M68kSymbolDefinition): PsiElement = element.firstChild
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi
|
||||
|
||||
import com.intellij.patterns.ElementPattern
|
||||
import com.intellij.patterns.PlatformPatterns
|
||||
import com.intellij.patterns.StandardPatterns
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.refactoring.rename.RenameInputValidator
|
||||
import com.intellij.util.ProcessingContext
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class M68kRenameInputValidator : RenameInputValidator {
|
||||
|
||||
override fun getPattern(): ElementPattern<out PsiElement?> = StandardPatterns.or(
|
||||
PlatformPatterns.psiElement(M68kGlobalLabel::class.java),
|
||||
PlatformPatterns.psiElement(M68kLocalLabel::class.java),
|
||||
PlatformPatterns.psiElement(M68kSymbolDefinition::class.java)
|
||||
)
|
||||
|
||||
override fun isInputValid(newName: String, element: PsiElement, context: ProcessingContext): Boolean {
|
||||
return when (element) {
|
||||
is M68kGlobalLabel, is M68kSymbolDefinition -> SYMBOL_PATTERN.matcher(newName).matches()
|
||||
is M68kLocalLabel -> LOCAL_LABEL_PATTERN.matcher(newName).matches()
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val SYMBOL_PATTERN = Pattern.compile("(\\p{Alpha}|_)(\\p{Alnum}|_)*")
|
||||
private val LOCAL_LABEL_PATTERN = Pattern.compile("(\\.(\\p{Alpha}|_)(\\p{Alnum}|_)*)|((\\p{Alpha}|_)(\\p{Alnum}|_)*\\$)")
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi
|
||||
|
||||
import com.intellij.extapi.psi.ASTWrapperPsiElement
|
||||
import com.intellij.lang.ASTNode
|
||||
|
||||
abstract class M68kSymbolDefinitionMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kSymbolDefinition {
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package de.platon42.intellij.plugins.m68k.refs
|
||||
|
||||
import com.intellij.patterns.PlatformPatterns
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.util.ProcessingContext
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kRefExpr
|
||||
|
||||
class M68kReferenceContributor : PsiReferenceContributor() {
|
||||
override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) {
|
||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kRefExpr::class.java), object : PsiReferenceProvider() {
|
||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
|
||||
return emptyArray()
|
||||
}
|
||||
})
|
||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kGlobalLabel::class.java), object : PsiReferenceProvider() {
|
||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
|
||||
return emptyArray()
|
||||
}
|
||||
})
|
||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kLocalLabel::class.java), object : PsiReferenceProvider() {
|
||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
|
||||
return emptyArray()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package de.platon42.intellij.plugins.m68k.scanner;
|
||||
|
||||
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;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class M68kFindUsagesProvider implements FindUsagesProvider {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public WordsScanner getWordsScanner() {
|
||||
return new DefaultWordsScanner(new M68kLexer(new 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.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFindUsagesFor(@NotNull PsiElement psiElement) {
|
||||
return psiElement instanceof PsiNamedElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable @NonNls String getHelpId(@NotNull PsiElement psiElement) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nls @NotNull String getType(@NotNull PsiElement element) {
|
||||
if (element instanceof M68kGlobalLabel) {
|
||||
return "global label";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nls @NotNull String getDescriptiveName(@NotNull PsiElement element) {
|
||||
if (element instanceof M68kGlobalLabel) {
|
||||
return ((M68kGlobalLabel) element).getName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nls @NotNull String getNodeText(@NotNull PsiElement element, boolean useFullName) {
|
||||
return getDescriptiveName(element);
|
||||
}
|
||||
}
|
@ -22,11 +22,12 @@ import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.MNEMONIC
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.NUMBER
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.OTHER_PREPROCESSOR
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.PROGRAM_COUNTER
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SEPARATOR
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SPECIAL_REG
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.STRING
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SYMBOL
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SYMBOLDEF
|
||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SYMBOLREF
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import javax.swing.Icon
|
||||
|
||||
@ -55,6 +56,7 @@ demo_init ; global label
|
||||
tst.w d1
|
||||
beq.s .skip
|
||||
PUSHM d0-d7/a0-a6 ; this is a macro call
|
||||
lea hello(pc),a1
|
||||
lea pd_ModViewTable(a4,d1.w),a0
|
||||
moveq.l #0,d0
|
||||
move.w #PIC_HEIGHT-1,d7
|
||||
@ -65,6 +67,7 @@ demo_init ; global label
|
||||
|
||||
hello: dc.b 'Hello World!',10,0
|
||||
even
|
||||
dc.w *-hello ; length of string
|
||||
"""
|
||||
}
|
||||
|
||||
@ -91,7 +94,7 @@ hello: dc.b 'Hello World!',10,0
|
||||
AttributesDescriptor("Comma (separator)", SEPARATOR),
|
||||
AttributesDescriptor("Colon", COLON),
|
||||
AttributesDescriptor("Symbol definition", SYMBOLDEF),
|
||||
AttributesDescriptor("Symbol reference", SYMBOL),
|
||||
AttributesDescriptor("Symbol reference", SYMBOLREF),
|
||||
AttributesDescriptor("Assembly mnemonic", MNEMONIC),
|
||||
AttributesDescriptor("Macro invocation", MACRO_CALL),
|
||||
AttributesDescriptor("Byte/short data width", DATA_WIDTH_BS),
|
||||
@ -103,6 +106,7 @@ hello: dc.b 'Hello World!',10,0
|
||||
AttributesDescriptor("Numbers", NUMBER),
|
||||
AttributesDescriptor("Address registers", AREG),
|
||||
AttributesDescriptor("Data registers", DREG),
|
||||
AttributesDescriptor("Program counter", PROGRAM_COUNTER),
|
||||
AttributesDescriptor("Special registers", SPECIAL_REG),
|
||||
AttributesDescriptor("Comments", COMMENT),
|
||||
AttributesDescriptor("Bad characters", BAD_CHARACTER)
|
||||
|
@ -0,0 +1,22 @@
|
||||
package de.platon42.intellij.plugins.m68k.syntax
|
||||
|
||||
import com.intellij.lang.BracePair
|
||||
import com.intellij.lang.PairedBraceMatcher
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||
|
||||
class M68kPairedBraceMatcher : PairedBraceMatcher {
|
||||
|
||||
companion object {
|
||||
val bracePairs = arrayOf(
|
||||
BracePair(M68kTypes.ROUND_L, M68kTypes.ROUND_R, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getPairs(): Array<BracePair> = bracePairs
|
||||
|
||||
override fun isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType?) = true
|
||||
|
||||
override fun getCodeConstructStart(file: PsiFile, openingBraceOffset: Int) = openingBraceOffset
|
||||
}
|
@ -26,10 +26,11 @@ class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() {
|
||||
return when (tokenType) {
|
||||
M68kTypes.SEPARATOR -> arrayOf(SEPARATOR)
|
||||
M68kTypes.COLON -> arrayOf(COLON)
|
||||
M68kTypes.GLOBAL_LABEL_DEF, M68kTypes.GLOBAL_LABEL -> arrayOf(GLOBAL_LABEL)
|
||||
M68kTypes.LOCAL_LABEL_DEF, M68kTypes.LOCAL_LABEL -> arrayOf(LOCAL_LABEL)
|
||||
M68kTypes.GLOBAL_LABEL_DEF -> arrayOf(GLOBAL_LABEL)
|
||||
M68kTypes.LOCAL_LABEL_DEF -> arrayOf(LOCAL_LABEL)
|
||||
M68kTypes.SYMBOLDEF -> arrayOf(SYMBOLDEF)
|
||||
M68kTypes.SYMBOL -> arrayOf(SYMBOL)
|
||||
M68kTypes.SYMBOL -> arrayOf(SYMBOLREF)
|
||||
M68kTypes.CURRENT_PC_SYMBOL, M68kTypes.PC -> arrayOf(PROGRAM_COUNTER)
|
||||
M68kTypes.MNEMONIC -> arrayOf(MNEMONIC)
|
||||
M68kTypes.MACRO_INVOKATION -> arrayOf(MACRO_CALL)
|
||||
M68kTypes.DATA_DIRECTIVE -> arrayOf(DATA_PREPROCESSOR)
|
||||
@ -37,9 +38,9 @@ class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() {
|
||||
M68kTypes.OPSIZE_BS -> arrayOf(DATA_WIDTH_BS)
|
||||
M68kTypes.OPSIZE_W -> arrayOf(DATA_WIDTH_W)
|
||||
M68kTypes.OPSIZE_L -> arrayOf(DATA_WIDTH_L)
|
||||
M68kTypes.ADDRESS_REGISTER, M68kTypes.AREG -> arrayOf(AREG)
|
||||
M68kTypes.DATA_REGISTER, M68kTypes.DREG -> arrayOf(DREG)
|
||||
M68kTypes.SPECIAL_REGISTER, M68kTypes.REG_USP, M68kTypes.REG_SR, M68kTypes.REG_CCR -> arrayOf(SPECIAL_REG)
|
||||
M68kTypes.AREG -> arrayOf(AREG)
|
||||
M68kTypes.DREG -> arrayOf(DREG)
|
||||
M68kTypes.REG_USP, M68kTypes.REG_SR, M68kTypes.REG_CCR, M68kTypes.REG_VBR -> arrayOf(SPECIAL_REG)
|
||||
M68kTypes.COMMENT -> arrayOf(COMMENT)
|
||||
M68kTypes.DECIMAL, M68kTypes.HEXADECIMAL, M68kTypes.OCTAL -> arrayOf(NUMBER)
|
||||
M68kTypes.STRINGLIT -> arrayOf(STRING)
|
||||
@ -54,7 +55,8 @@ class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() {
|
||||
val SEPARATOR = TextAttributesKey.createTextAttributesKey("M68K_SEPARATOR", DefaultLanguageHighlighterColors.COMMA)
|
||||
val COLON = TextAttributesKey.createTextAttributesKey("M68K_COLON", DefaultLanguageHighlighterColors.DOT)
|
||||
val SYMBOLDEF = TextAttributesKey.createTextAttributesKey("M68K_SYMBOLDEF", DefaultLanguageHighlighterColors.STATIC_FIELD)
|
||||
val SYMBOL = TextAttributesKey.createTextAttributesKey("M68K_SYMBOL", DefaultLanguageHighlighterColors.IDENTIFIER)
|
||||
val SYMBOLREF = TextAttributesKey.createTextAttributesKey("M68K_SYMBOLREF", DefaultLanguageHighlighterColors.IDENTIFIER)
|
||||
val PROGRAM_COUNTER = TextAttributesKey.createTextAttributesKey("M68K_PROGRAM_COUNTER", DefaultLanguageHighlighterColors.IDENTIFIER)
|
||||
val MNEMONIC = TextAttributesKey.createTextAttributesKey("M68K_MNEMONIC", DefaultLanguageHighlighterColors.FUNCTION_CALL)
|
||||
val MACRO_CALL = TextAttributesKey.createTextAttributesKey("M68K_MACRO_CALL", DefaultLanguageHighlighterColors.STATIC_METHOD)
|
||||
val DATA_WIDTH_BS = TextAttributesKey.createTextAttributesKey("M68K_DATA_WIDTH_BS", DefaultLanguageHighlighterColors.DOT)
|
||||
|
@ -22,7 +22,11 @@
|
||||
implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighterFactory"/>
|
||||
<colorSettingsPage implementation="de.platon42.intellij.plugins.m68k.syntax.M68kColorSettingsPage"/>
|
||||
<completion.contributor language="M68k" implementationClass="de.platon42.intellij.plugins.m68k.asm.M68kMnemonicCompletionContributor"/>
|
||||
<lang.braceMatcher language="M68k" implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kPairedBraceMatcher"/>
|
||||
<lang.quoteHandler language="M68k" implementationClass="de.platon42.intellij.plugins.m68k.M68kStringQuoteHandler"/>
|
||||
<psi.referenceContributor implementation="de.platon42.intellij.plugins.m68k.refs.M68kReferenceContributor"/>
|
||||
<lang.findUsagesProvider language="M68k" implementationClass="de.platon42.intellij.plugins.m68k.scanner.M68kFindUsagesProvider"/>
|
||||
<renameInputValidator implementation="de.platon42.intellij.plugins.m68k.psi.M68kRenameInputValidator"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
|
@ -39,7 +39,8 @@ Assembly File: a.asm
|
||||
M68kUnaryComplExprImpl(UNARY_COMPL_EXPR)
|
||||
PsiElement(M68kTokenType.OP_UNARY_COMPL)('~')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
PsiElement(M68kTokenType.OP_BITWISE_XOR)('^')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.OCTAL)('@123')
|
||||
@ -59,7 +60,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryModExprImpl(BINARY_MOD_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('NARF')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('NARF')
|
||||
PsiElement(M68kTokenType.OP_AR_MOD)('%')
|
||||
M68kBinaryBitwiseOrExprImpl(BINARY_BITWISE_OR_EXPR)
|
||||
M68kBinaryBitwiseOrExprImpl(BINARY_BITWISE_OR_EXPR)
|
||||
@ -123,7 +125,8 @@ Assembly File: a.asm
|
||||
M68kUnaryComplExprImpl(UNARY_COMPL_EXPR)
|
||||
PsiElement(M68kTokenType.OP_UNARY_COMPL)('~')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
PsiElement(M68kTokenType.OP_BITWISE_XOR)('^')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.OCTAL)('@123')
|
||||
@ -143,7 +146,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryModExprImpl(BINARY_MOD_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('NARF')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('NARF')
|
||||
PsiElement(M68kTokenType.OP_AR_MOD)('%')
|
||||
M68kBinaryBitwiseOrExprImpl(BINARY_BITWISE_OR_EXPR)
|
||||
M68kBinaryBitwiseOrExprImpl(BINARY_BITWISE_OR_EXPR)
|
||||
|
@ -10,7 +10,8 @@ Assembly File: a.asm
|
||||
M68kImmediateDataImpl(IMMEDIATE_DATA)
|
||||
PsiElement(M68kTokenType.HASH)('#')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('FOO_BAR')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('FOO_BAR')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
|
||||
M68kDataRegisterImpl(DATA_REGISTER)
|
||||
|
@ -16,7 +16,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
PsiElement(M68kTokenType.PC)('pc')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
|
@ -15,7 +15,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
PsiElement(M68kTokenType.PC)('pc')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
|
@ -18,7 +18,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.ROUND_R)(')')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
PsiElement(M68kTokenType.PC)('pc')
|
||||
|
@ -16,7 +16,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
M68kAddressRegisterImpl(ADDRESS_REGISTER)
|
||||
PsiElement(M68kTokenType.AREG)('sp')
|
||||
|
@ -15,7 +15,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kAddressRegisterImpl(ADDRESS_REGISTER)
|
||||
PsiElement(M68kTokenType.AREG)('sp')
|
||||
|
@ -16,7 +16,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
M68kAddressRegisterImpl(ADDRESS_REGISTER)
|
||||
PsiElement(M68kTokenType.AREG)('sp')
|
||||
|
@ -15,7 +15,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.DECIMAL)('4')
|
||||
PsiElement(M68kTokenType.OP_PLUS)('+')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('foo')
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kAddressRegisterImpl(ADDRESS_REGISTER)
|
||||
PsiElement(M68kTokenType.AREG)('sp')
|
||||
|
@ -1,10 +1,12 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.EQU)('equ')
|
||||
PsiWhiteSpace(' ')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('BAR')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('BAR')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
M68kBinaryAddExprImpl(BINARY_ADD_EXPR)
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
|
@ -1,10 +1,12 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.EQU)('set')
|
||||
PsiWhiteSpace(' ')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('BAR')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('BAR')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiElement(M68kTokenType.COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiElement(M68kTokenType.COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.EQU)('set')
|
||||
|
@ -1,13 +1,16 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
M68kBinarySubExprImpl(BINARY_SUB_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.local')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.local')
|
||||
PsiElement(M68kTokenType.OP_MINUS)('-')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.bar')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.bar')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
@ -47,7 +47,8 @@ Assembly File: a.asm
|
||||
PsiWhiteSpace('\t')
|
||||
M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('resetcode')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('resetcode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(M68kTokenType.COMMENT)('; unreachable')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('foo')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -5,7 +5,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.OTHER_DIRECTIVE)('IFD')
|
||||
PsiWhiteSpace(' ')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('DEBUG')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('DEBUG')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(M68kTokenType.COMMENT)('; cause a crash')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
|
@ -7,5 +7,6 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.OTHER_DIRECTIVE)('incbin')
|
||||
PsiWhiteSpace(' ')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('Convertedassets\scroller_howto.raw.BPL')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('Convertedassets\scroller_howto.raw.BPL')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
@ -6,8 +6,10 @@ Assembly File: a.asm
|
||||
PsiWhiteSpace(' ')
|
||||
M68kBinarySubExprImpl(BINARY_SUB_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.CURRENT_PC_SYMBOL)('*')
|
||||
M68kProgramCounterReferenceImpl(PROGRAM_COUNTER_REFERENCE)
|
||||
PsiElement(M68kTokenType.CURRENT_PC_SYMBOL)('*')
|
||||
PsiElement(M68kTokenType.OP_MINUS)('-')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.label')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.label')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
@ -6,7 +6,8 @@ Assembly File: a.asm
|
||||
PsiWhiteSpace(' ')
|
||||
M68kBinaryCmpEqExprImpl(BINARY_CMP_EQ_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('DEBUG')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('DEBUG')
|
||||
PsiElement(M68kTokenType.OP_CMP_EQ)('=')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.DECIMAL)('1')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
@ -36,7 +37,8 @@ Assembly File: a.asm
|
||||
M68kUnaryComplExprImpl(UNARY_COMPL_EXPR)
|
||||
PsiElement(M68kTokenType.OP_UNARY_COMPL)('~')
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('WIDTH')
|
||||
PsiElement(M68kTokenType.OP_BITWISE_XOR)('^')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.OCTAL)('@123')
|
||||
@ -56,7 +58,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.ROUND_L)('(')
|
||||
M68kBinaryModExprImpl(BINARY_MOD_EXPR)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('NARF')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('NARF')
|
||||
PsiElement(M68kTokenType.OP_AR_MOD)('%')
|
||||
M68kBinaryBitwiseOrExprImpl(BINARY_BITWISE_OR_EXPR)
|
||||
M68kBinaryBitwiseOrExprImpl(BINARY_BITWISE_OR_EXPR)
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
|
@ -1,7 +1,8 @@
|
||||
Assembly File: a.asm
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
@ -10,7 +11,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
M68kStatementImpl(STATEMENT)
|
||||
M68kAssignmentImpl(ASSIGNMENT)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
M68kSymbolDefinitionImpl(SYMBOL_DEFINITION)
|
||||
PsiElement(M68kTokenType.SYMBOLDEF)('FOO')
|
||||
PsiElement(M68kTokenType.OP_ASSIGN)('=')
|
||||
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||
PsiElement(M68kTokenType.STRINGLIT)('"bar"')
|
||||
|
@ -69,7 +69,8 @@ Assembly File: a.asm
|
||||
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||
M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('innerloop$')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('innerloop$')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(M68kTokenType.COMMENT)('; copy more')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
@ -87,7 +88,8 @@ Assembly File: a.asm
|
||||
PsiWhiteSpace(' ')
|
||||
M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE)
|
||||
M68kRefExprImpl(REF_EXPR)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.outerloop')
|
||||
M68kSymbolReferenceImpl(SYMBOL_REFERENCE)
|
||||
PsiElement(M68kTokenType.SYMBOL)('.outerloop')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(M68kTokenType.COMMENT)('; end of chunk?')
|
||||
PsiElement(M68kTokenType.EOL)('\n')
|
||||
|
Loading…
Reference in New Issue
Block a user