From 25c755d729e73cebaf2377c5b6857bb8485971e0 Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Sun, 18 Jul 2021 15:05:59 +0200 Subject: [PATCH] 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. --- .../plugins/m68k/parser/M68kParser.java | 46 ++++++++++++-- .../plugins/m68k/psi/M68kAssignment.java | 3 + .../m68k/psi/M68kProgramCounterReference.java | 8 +++ .../plugins/m68k/psi/M68kRefExpr.java | 8 +++ .../m68k/psi/M68kSymbolDefinition.java | 19 ++++++ .../plugins/m68k/psi/M68kSymbolReference.java | 8 +++ .../intellij/plugins/m68k/psi/M68kTypes.java | 9 +++ .../plugins/m68k/psi/M68kVisitor.java | 16 +++++ .../m68k/psi/impl/M68kAssignmentImpl.java | 7 +++ .../impl/M68kProgramCounterReferenceImpl.java | 27 +++++++++ .../m68k/psi/impl/M68kRefExprImpl.java | 15 +++++ .../psi/impl/M68kSymbolDefinitionImpl.java | 48 +++++++++++++++ .../psi/impl/M68kSymbolReferenceImpl.java | 27 +++++++++ .../platon42/intellij/plugins/m68k/m68k.bnf | 13 +++- .../plugins/m68k/psi/M68kElementFactory.kt | 9 ++- .../plugins/m68k/psi/M68kPsiImplUtil.kt | 23 +++++++ .../m68k/psi/M68kRenameInputValidator.kt | 31 ++++++++++ .../m68k/psi/M68kSymbolDefinitionMixin.kt | 8 +++ .../m68k/refs/M68kReferenceContributor.kt | 28 +++++++++ .../m68k/scanner/M68kFindUsagesProvider.java | 60 +++++++++++++++++++ .../m68k/syntax/M68kColorSettingsPage.kt | 8 ++- .../m68k/syntax/M68kPairedBraceMatcher.kt | 22 +++++++ .../m68k/syntax/M68kSyntaxHighlighter.kt | 16 ++--- src/main/resources/META-INF/plugin.xml | 4 ++ ...omplex_math_expression_in_displacement.txt | 12 ++-- .../parser/addressingmodes/immediate_data.txt | 3 +- ...irect_with_index_and_offset_new_syntax.txt | 3 +- ...irect_with_index_and_offset_old_syntax.txt | 3 +- .../pc_indirect_with_offset_new_syntax.txt | 3 +- ...irect_with_index_and_offset_new_syntax.txt | 3 +- ...irect_with_index_and_offset_old_syntax.txt | 3 +- ...gister_indirect_with_offset_new_syntax.txt | 3 +- ...gister_indirect_with_offset_old_syntax.txt | 3 +- .../parser/assignment/assignment_via_equ.txt | 6 +- .../assignment_via_equals_with_spaces.txt | 3 +- .../assignment_via_equals_without_spaces.txt | 3 +- .../parser/assignment/assignment_via_set.txt | 6 +- .../assignment/assignment_with_colon.txt | 3 +- .../assignment_with_colon_and_set.txt | 3 +- .../assignment_with_local_label.txt | 9 ++- .../parser/basic/basic_block_of_code.txt | 3 +- ...t_with_space_introduces_comment_option.txt | 3 +- .../parser/comments/end_of_line_comments.txt | 3 +- ...ithout_space_introduces_comment_option.txt | 3 +- .../parser/directives/if_defined_block.txt | 3 +- .../directives/include_file_unquoted.txt | 3 +- .../current_pc_symbol_relative_expression.txt | 6 +- .../if_with_single_equals_comparison.txt | 3 +- .../parser/expressions/math_expression.txt | 9 ++- .../pure_binary_number_literal.txt | 3 +- .../pure_decimal_number_literal.txt | 3 +- .../pure_hexadecimal_number_literal.txt | 3 +- .../expressions/pure_octal_number_literal.txt | 3 +- .../expressions/pure_string_literal.txt | 6 +- .../parser/labels/complex_label_test.txt | 6 +- 55 files changed, 531 insertions(+), 61 deletions(-) create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterReference.java create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinition.java create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolReference.java create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterReferenceImpl.java create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolDefinitionImpl.java create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolReferenceImpl.java create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kRenameInputValidator.kt create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinitionMixin.kt create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributor.kt create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/scanner/M68kFindUsagesProvider.java create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kPairedBraceMatcher.kt diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java b/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java index 750fe5c..7503922 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java @@ -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; + } + /* ********************************************************** */ // !<> 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, ""); - 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; } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAssignment.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAssignment.java index 3ff52d1..a48d5e3 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAssignment.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAssignment.java @@ -6,6 +6,9 @@ import org.jetbrains.annotations.NotNull; public interface M68kAssignment extends PsiElement { + @NotNull + M68kSymbolDefinition getSymbolDefinition(); + @NotNull M68kExpr getExpr(); diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterReference.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterReference.java new file mode 100644 index 0000000..13c3211 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterReference.java @@ -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 { + +} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRefExpr.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRefExpr.java index 32bc2b9..6285f94 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRefExpr.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRefExpr.java @@ -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(); + } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinition.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinition.java new file mode 100644 index 0000000..42efbe0 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinition.java @@ -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(); + +} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolReference.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolReference.java new file mode 100644 index 0000000..165c520 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kSymbolReference.java @@ -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 { + +} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java index d361140..d72218b 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java @@ -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) { diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java index ee44a0b..5059f40 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kVisitor.java @@ -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); } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAssignmentImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAssignmentImpl.java index 87d7d24..b4311b3 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAssignmentImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAssignmentImpl.java @@ -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() { diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterReferenceImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterReferenceImpl.java new file mode 100644 index 0000000..f15b8d5 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterReferenceImpl.java @@ -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); + } + +} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kRefExprImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kRefExprImpl.java index 73aead1..02d9dce 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kRefExprImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kRefExprImpl.java @@ -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); + } + } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolDefinitionImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolDefinitionImpl.java new file mode 100644 index 0000000..d45da81 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolDefinitionImpl.java @@ -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); + } + +} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolReferenceImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolReferenceImpl.java new file mode 100644 index 0000000..51ff280 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kSymbolReferenceImpl.java @@ -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); + } + +} diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf index 59119ee..3404a34 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf +++ b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf @@ -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" diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kElementFactory.kt b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kElementFactory.kt index 57c2629..f3bc6ea 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kElementFactory.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kElementFactory.kt @@ -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 } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kPsiImplUtil.kt b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kPsiImplUtil.kt index 8555aab..d70a148 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kPsiImplUtil.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kPsiImplUtil.kt @@ -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 + } \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kRenameInputValidator.kt b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kRenameInputValidator.kt new file mode 100644 index 0000000..ca7f6b8 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kRenameInputValidator.kt @@ -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 = 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}|_)*\\$)") + } +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinitionMixin.kt b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinitionMixin.kt new file mode 100644 index 0000000..2da37d8 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/psi/M68kSymbolDefinitionMixin.kt @@ -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 { + +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributor.kt b/src/main/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributor.kt new file mode 100644 index 0000000..2f92964 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/refs/M68kReferenceContributor.kt @@ -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 { + return emptyArray() + } + }) + registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kGlobalLabel::class.java), object : PsiReferenceProvider() { + override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array { + return emptyArray() + } + }) + registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kLocalLabel::class.java), object : PsiReferenceProvider() { + override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array { + return emptyArray() + } + }) + } +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/scanner/M68kFindUsagesProvider.java b/src/main/java/de/platon42/intellij/plugins/m68k/scanner/M68kFindUsagesProvider.java new file mode 100644 index 0000000..a2764b4 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/scanner/M68kFindUsagesProvider.java @@ -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); + } +} diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kColorSettingsPage.kt b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kColorSettingsPage.kt index 5739122..f5569cc 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kColorSettingsPage.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kColorSettingsPage.kt @@ -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) diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kPairedBraceMatcher.kt b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kPairedBraceMatcher.kt new file mode 100644 index 0000000..f012d5a --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kPairedBraceMatcher.kt @@ -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 = bracePairs + + override fun isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType?) = true + + override fun getCodeConstructStart(file: PsiFile, openingBraceOffset: Int) = openingBraceOffset +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt index 32d8f94..c03d14e 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt @@ -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) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 9257a72..f74bc92 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -22,7 +22,11 @@ implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighterFactory"/> + + + + diff --git a/src/test/resources/parser/addressingmodes/complex_math_expression_in_displacement.txt b/src/test/resources/parser/addressingmodes/complex_math_expression_in_displacement.txt index 1941f77..ce27e5f 100644 --- a/src/test/resources/parser/addressingmodes/complex_math_expression_in_displacement.txt +++ b/src/test/resources/parser/addressingmodes/complex_math_expression_in_displacement.txt @@ -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) diff --git a/src/test/resources/parser/addressingmodes/immediate_data.txt b/src/test/resources/parser/addressingmodes/immediate_data.txt index f003071..d5df8b5 100644 --- a/src/test/resources/parser/addressingmodes/immediate_data.txt +++ b/src/test/resources/parser/addressingmodes/immediate_data.txt @@ -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) diff --git a/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_new_syntax.txt b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_new_syntax.txt index 9140212..84d08aa 100644 --- a/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_new_syntax.txt +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_new_syntax.txt @@ -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)(',') diff --git a/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_old_syntax.txt b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_old_syntax.txt index 7ba59dc..bda3476 100644 --- a/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_old_syntax.txt +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_old_syntax.txt @@ -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)(',') diff --git a/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_new_syntax.txt b/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_new_syntax.txt index 7ef8c2f..c3f21f1 100644 --- a/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_new_syntax.txt +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_new_syntax.txt @@ -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') diff --git a/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_new_syntax.txt b/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_new_syntax.txt index 368e2ba..017939f 100644 --- a/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_new_syntax.txt +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_new_syntax.txt @@ -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') diff --git a/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_old_syntax.txt b/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_old_syntax.txt index dcbf7a7..9133df2 100644 --- a/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_old_syntax.txt +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_old_syntax.txt @@ -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') diff --git a/src/test/resources/parser/addressingmodes/register_indirect_with_offset_new_syntax.txt b/src/test/resources/parser/addressingmodes/register_indirect_with_offset_new_syntax.txt index 6e2d409..4ebe77b 100644 --- a/src/test/resources/parser/addressingmodes/register_indirect_with_offset_new_syntax.txt +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_offset_new_syntax.txt @@ -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') diff --git a/src/test/resources/parser/addressingmodes/register_indirect_with_offset_old_syntax.txt b/src/test/resources/parser/addressingmodes/register_indirect_with_offset_old_syntax.txt index 60c2912..2999ab7 100644 --- a/src/test/resources/parser/addressingmodes/register_indirect_with_offset_old_syntax.txt +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_offset_old_syntax.txt @@ -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') diff --git a/src/test/resources/parser/assignment/assignment_via_equ.txt b/src/test/resources/parser/assignment/assignment_via_equ.txt index 5af058c..2f12b8d 100644 --- a/src/test/resources/parser/assignment/assignment_via_equ.txt +++ b/src/test/resources/parser/assignment/assignment_via_equ.txt @@ -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') \ No newline at end of file diff --git a/src/test/resources/parser/assignment/assignment_via_equals_with_spaces.txt b/src/test/resources/parser/assignment/assignment_via_equals_with_spaces.txt index 7689929..e37dab5 100644 --- a/src/test/resources/parser/assignment/assignment_via_equals_with_spaces.txt +++ b/src/test/resources/parser/assignment/assignment_via_equals_with_spaces.txt @@ -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(' ') diff --git a/src/test/resources/parser/assignment/assignment_via_equals_without_spaces.txt b/src/test/resources/parser/assignment/assignment_via_equals_without_spaces.txt index 16405b2..6de3ffe 100644 --- a/src/test/resources/parser/assignment/assignment_via_equals_without_spaces.txt +++ b/src/test/resources/parser/assignment/assignment_via_equals_without_spaces.txt @@ -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) diff --git a/src/test/resources/parser/assignment/assignment_via_set.txt b/src/test/resources/parser/assignment/assignment_via_set.txt index 44b62ed..68ebd59 100644 --- a/src/test/resources/parser/assignment/assignment_via_set.txt +++ b/src/test/resources/parser/assignment/assignment_via_set.txt @@ -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') \ No newline at end of file diff --git a/src/test/resources/parser/assignment/assignment_with_colon.txt b/src/test/resources/parser/assignment/assignment_with_colon.txt index 72df188..ca2fe0c 100644 --- a/src/test/resources/parser/assignment/assignment_with_colon.txt +++ b/src/test/resources/parser/assignment/assignment_with_colon.txt @@ -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)('=') diff --git a/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt b/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt index 42b543d..deaf2c0 100644 --- a/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt +++ b/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt @@ -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') diff --git a/src/test/resources/parser/assignment/assignment_with_local_label.txt b/src/test/resources/parser/assignment/assignment_with_local_label.txt index 2c1218d..e1e48d6 100644 --- a/src/test/resources/parser/assignment/assignment_with_local_label.txt +++ b/src/test/resources/parser/assignment/assignment_with_local_label.txt @@ -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') \ No newline at end of file diff --git a/src/test/resources/parser/basic/basic_block_of_code.txt b/src/test/resources/parser/basic/basic_block_of_code.txt index fc7c8dd..f088839 100644 --- a/src/test/resources/parser/basic/basic_block_of_code.txt +++ b/src/test/resources/parser/basic/basic_block_of_code.txt @@ -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') diff --git a/src/test/resources/parser/comments/comment_after_assignment_with_space_introduces_comment_option.txt b/src/test/resources/parser/comments/comment_after_assignment_with_space_introduces_comment_option.txt index d7d921a..94aa199 100644 --- a/src/test/resources/parser/comments/comment_after_assignment_with_space_introduces_comment_option.txt +++ b/src/test/resources/parser/comments/comment_after_assignment_with_space_introduces_comment_option.txt @@ -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(' ') diff --git a/src/test/resources/parser/comments/end_of_line_comments.txt b/src/test/resources/parser/comments/end_of_line_comments.txt index 086054e..1dbf44e 100644 --- a/src/test/resources/parser/comments/end_of_line_comments.txt +++ b/src/test/resources/parser/comments/end_of_line_comments.txt @@ -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(' ') diff --git a/src/test/resources/parser/comments/space_does_not_start_comment_within_assignment_without_space_introduces_comment_option.txt b/src/test/resources/parser/comments/space_does_not_start_comment_within_assignment_without_space_introduces_comment_option.txt index 8d8da99..8562b5a 100644 --- a/src/test/resources/parser/comments/space_does_not_start_comment_within_assignment_without_space_introduces_comment_option.txt +++ b/src/test/resources/parser/comments/space_does_not_start_comment_within_assignment_without_space_introduces_comment_option.txt @@ -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(' ') diff --git a/src/test/resources/parser/directives/if_defined_block.txt b/src/test/resources/parser/directives/if_defined_block.txt index 2b22e29..09de4ee 100644 --- a/src/test/resources/parser/directives/if_defined_block.txt +++ b/src/test/resources/parser/directives/if_defined_block.txt @@ -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') diff --git a/src/test/resources/parser/directives/include_file_unquoted.txt b/src/test/resources/parser/directives/include_file_unquoted.txt index 7292cc2..4f82fa3 100644 --- a/src/test/resources/parser/directives/include_file_unquoted.txt +++ b/src/test/resources/parser/directives/include_file_unquoted.txt @@ -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') \ No newline at end of file diff --git a/src/test/resources/parser/expressions/current_pc_symbol_relative_expression.txt b/src/test/resources/parser/expressions/current_pc_symbol_relative_expression.txt index a60c633..76db0b5 100644 --- a/src/test/resources/parser/expressions/current_pc_symbol_relative_expression.txt +++ b/src/test/resources/parser/expressions/current_pc_symbol_relative_expression.txt @@ -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') \ No newline at end of file diff --git a/src/test/resources/parser/expressions/if_with_single_equals_comparison.txt b/src/test/resources/parser/expressions/if_with_single_equals_comparison.txt index 3d65b95..eacac77 100644 --- a/src/test/resources/parser/expressions/if_with_single_equals_comparison.txt +++ b/src/test/resources/parser/expressions/if_with_single_equals_comparison.txt @@ -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') diff --git a/src/test/resources/parser/expressions/math_expression.txt b/src/test/resources/parser/expressions/math_expression.txt index e4ed9fe..eb42d94 100644 --- a/src/test/resources/parser/expressions/math_expression.txt +++ b/src/test/resources/parser/expressions/math_expression.txt @@ -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) diff --git a/src/test/resources/parser/expressions/pure_binary_number_literal.txt b/src/test/resources/parser/expressions/pure_binary_number_literal.txt index 7458e6d..be95016 100644 --- a/src/test/resources/parser/expressions/pure_binary_number_literal.txt +++ b/src/test/resources/parser/expressions/pure_binary_number_literal.txt @@ -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(' ') diff --git a/src/test/resources/parser/expressions/pure_decimal_number_literal.txt b/src/test/resources/parser/expressions/pure_decimal_number_literal.txt index f51a965..ec6cafd 100644 --- a/src/test/resources/parser/expressions/pure_decimal_number_literal.txt +++ b/src/test/resources/parser/expressions/pure_decimal_number_literal.txt @@ -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(' ') diff --git a/src/test/resources/parser/expressions/pure_hexadecimal_number_literal.txt b/src/test/resources/parser/expressions/pure_hexadecimal_number_literal.txt index 773b998..e817466 100644 --- a/src/test/resources/parser/expressions/pure_hexadecimal_number_literal.txt +++ b/src/test/resources/parser/expressions/pure_hexadecimal_number_literal.txt @@ -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(' ') diff --git a/src/test/resources/parser/expressions/pure_octal_number_literal.txt b/src/test/resources/parser/expressions/pure_octal_number_literal.txt index 3ca6664..9ffcece 100644 --- a/src/test/resources/parser/expressions/pure_octal_number_literal.txt +++ b/src/test/resources/parser/expressions/pure_octal_number_literal.txt @@ -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(' ') diff --git a/src/test/resources/parser/expressions/pure_string_literal.txt b/src/test/resources/parser/expressions/pure_string_literal.txt index 3607691..9a8e32e 100644 --- a/src/test/resources/parser/expressions/pure_string_literal.txt +++ b/src/test/resources/parser/expressions/pure_string_literal.txt @@ -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"') diff --git a/src/test/resources/parser/labels/complex_label_test.txt b/src/test/resources/parser/labels/complex_label_test.txt index b1685dd..713440c 100644 --- a/src/test/resources/parser/labels/complex_label_test.txt +++ b/src/test/resources/parser/labels/complex_label_test.txt @@ -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')