From 03c11ecef91caf18c9dd942d0107fd034d7f3f0c Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Thu, 15 Jul 2021 12:45:57 +0200 Subject: [PATCH] Fixed addressing modes. Added missing generated class, removed unused one. --- .../plugins/m68k/parser/M68kParser.java | 125 ++++++++++++++---- ...terIndirectWithIndexNewAddressingMode.java | 2 +- ...terIndirectWithIndexOldAddressingMode.java | 2 +- .../plugins/m68k/psi/M68kInstruction.java | 15 --- ...rectWithDisplacementOldAddressingMode.java | 4 +- ...terIndirectWithIndexNewAddressingMode.java | 2 +- ...terIndirectWithIndexOldAddressingMode.java | 2 +- .../psi/M68kRegisterListAddressingMode.java | 13 ++ ...ndirectWithIndexNewAddressingModeImpl.java | 4 +- ...ndirectWithIndexOldAddressingModeImpl.java | 4 +- ...WithDisplacementOldAddressingModeImpl.java | 5 +- ...ndirectWithIndexNewAddressingModeImpl.java | 4 +- ...ndirectWithIndexOldAddressingModeImpl.java | 4 +- .../intellij/plugins/m68k/asm/M68kIsa.kt | 36 ++--- .../platon42/intellij/plugins/m68k/m68k.bnf | 12 +- .../m68k/parser/AddressingModesTest.kt | 101 ++++++++++++++ .../addressingmodes/absolute_address.txt | 20 +++ .../parser/addressingmodes/immediate_data.txt | 19 +++ .../addressingmodes/movem_register_list.txt | 36 +++++ ...c_indirect_special_case_without_offset.txt | 19 +++ ...irect_with_index_and_offset_new_syntax.txt | 51 +++++++ ...irect_with_index_and_offset_old_syntax.txt | 49 +++++++ ...with_index_special_case_without_offset.txt | 28 ++++ .../pc_indirect_with_offset_new_syntax.txt | 46 +++++++ .../pc_indirect_with_offset_old_syntax.txt | 32 +++++ .../addressingmodes/register_direct.txt | 18 +++ .../addressingmodes/register_indirect.txt | 22 +++ ...er_indirect_predecrement_postincrement.txt | 24 ++++ ...irect_with_index_and_offset_new_syntax.txt | 53 ++++++++ ...irect_with_index_and_offset_old_syntax.txt | 51 +++++++ ...with_index_special_case_without_offset.txt | 30 +++++ ...gister_indirect_with_offset_new_syntax.txt | 45 +++++++ ...gister_indirect_with_offset_old_syntax.txt | 43 ++++++ .../addressingmodes/special_register_move.txt | 35 +++++ 34 files changed, 878 insertions(+), 78 deletions(-) delete mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kInstruction.java create mode 100644 src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRegisterListAddressingMode.java create mode 100644 src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt create mode 100644 src/test/resources/parser/addressingmodes/absolute_address.txt create mode 100644 src/test/resources/parser/addressingmodes/immediate_data.txt create mode 100644 src/test/resources/parser/addressingmodes/movem_register_list.txt create mode 100644 src/test/resources/parser/addressingmodes/pc_indirect_special_case_without_offset.txt create mode 100644 src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_new_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_old_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/pc_indirect_with_index_special_case_without_offset.txt create mode 100644 src/test/resources/parser/addressingmodes/pc_indirect_with_offset_new_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/pc_indirect_with_offset_old_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/register_direct.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect_predecrement_postincrement.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_new_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_old_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect_with_index_special_case_without_offset.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect_with_offset_new_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/register_indirect_with_offset_old_syntax.txt create mode 100644 src/test/resources/parser/addressingmodes/special_register_move.txt 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 d2eb1db..403d49d 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 @@ -211,38 +211,55 @@ public class M68kParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // ROUND_L expr SEPARATOR AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R + // ROUND_L (expr SEPARATOR)? AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R public static boolean AddressRegisterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode")) return false; if (!nextTokenIsFast(b, ROUND_L)) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE, ""); r = consumeTokenFast(b, ROUND_L); - r = r && expr(b, l + 1, -1); - r = r && consumeToken(b, SEPARATOR); + r = r && AddressRegisterIndirectWithIndexNewAddressingMode_1(b, l + 1); r = r && AddressRegister(b, l + 1); r = r && consumeToken(b, SEPARATOR); r = r && DataOrAddressRegister(b, l + 1); - r = r && AddressRegisterIndirectWithIndexNewAddressingMode_6(b, l + 1); + r = r && AddressRegisterIndirectWithIndexNewAddressingMode_5(b, l + 1); r = r && consumeToken(b, ROUND_R); exit_section_(b, l, m, r, false, null); return r; } + // (expr SEPARATOR)? + private static boolean AddressRegisterIndirectWithIndexNewAddressingMode_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode_1")) return false; + AddressRegisterIndirectWithIndexNewAddressingMode_1_0(b, l + 1); + return true; + } + + // expr SEPARATOR + private static boolean AddressRegisterIndirectWithIndexNewAddressingMode_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = expr(b, l + 1, -1); + r = r && consumeToken(b, SEPARATOR); + exit_section_(b, m, null, r); + return r; + } + // DataWidth? - private static boolean AddressRegisterIndirectWithIndexNewAddressingMode_6(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode_6")) return false; + private static boolean AddressRegisterIndirectWithIndexNewAddressingMode_5(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode_5")) return false; DataWidth(b, l + 1); return true; } /* ********************************************************** */ - // expr ROUND_L AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R + // expr? ROUND_L AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R public static boolean AddressRegisterIndirectWithIndexOldAddressingMode(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexOldAddressingMode")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE, ""); - r = expr(b, l + 1, -1); + r = AddressRegisterIndirectWithIndexOldAddressingMode_0(b, l + 1); r = r && consumeToken(b, ROUND_L); r = r && AddressRegister(b, l + 1); r = r && consumeToken(b, SEPARATOR); @@ -253,6 +270,13 @@ public class M68kParser implements PsiParser, LightPsiParser { return r; } + // expr? + private static boolean AddressRegisterIndirectWithIndexOldAddressingMode_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexOldAddressingMode_0")) return false; + expr(b, l + 1, -1); + return true; + } + // DataWidth? private static boolean AddressRegisterIndirectWithIndexOldAddressingMode_5(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexOldAddressingMode_5")) return false; @@ -754,48 +778,87 @@ public class M68kParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // expr ROUND_L PC ROUND_R + // (ROUND_L PC ROUND_R) | (expr ROUND_L PC ROUND_R) public static boolean ProgramCounterIndirectWithDisplacementOldAddressingMode(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ProgramCounterIndirectWithDisplacementOldAddressingMode")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE, ""); - r = expr(b, l + 1, -1); - r = r && consumeTokens(b, 0, ROUND_L, PC, ROUND_R); + r = ProgramCounterIndirectWithDisplacementOldAddressingMode_0(b, l + 1); + if (!r) r = ProgramCounterIndirectWithDisplacementOldAddressingMode_1(b, l + 1); exit_section_(b, l, m, r, false, null); return r; } + // ROUND_L PC ROUND_R + private static boolean ProgramCounterIndirectWithDisplacementOldAddressingMode_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ProgramCounterIndirectWithDisplacementOldAddressingMode_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeTokens(b, 0, ROUND_L, PC, ROUND_R); + exit_section_(b, m, null, r); + return r; + } + + // expr ROUND_L PC ROUND_R + private static boolean ProgramCounterIndirectWithDisplacementOldAddressingMode_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ProgramCounterIndirectWithDisplacementOldAddressingMode_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = expr(b, l + 1, -1); + r = r && consumeTokens(b, 0, ROUND_L, PC, ROUND_R); + exit_section_(b, m, null, r); + return r; + } + /* ********************************************************** */ - // ROUND_L expr SEPARATOR PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R + // ROUND_L (expr SEPARATOR)? PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R public static boolean ProgramCounterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode")) return false; if (!nextTokenIsFast(b, ROUND_L)) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE, ""); r = consumeTokenFast(b, ROUND_L); - r = r && expr(b, l + 1, -1); - r = r && consumeTokens(b, 0, SEPARATOR, PC, SEPARATOR); + r = r && ProgramCounterIndirectWithIndexNewAddressingMode_1(b, l + 1); + r = r && consumeTokens(b, 0, PC, SEPARATOR); r = r && DataOrAddressRegister(b, l + 1); - r = r && ProgramCounterIndirectWithIndexNewAddressingMode_6(b, l + 1); + r = r && ProgramCounterIndirectWithIndexNewAddressingMode_5(b, l + 1); r = r && consumeToken(b, ROUND_R); exit_section_(b, l, m, r, false, null); return r; } + // (expr SEPARATOR)? + private static boolean ProgramCounterIndirectWithIndexNewAddressingMode_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode_1")) return false; + ProgramCounterIndirectWithIndexNewAddressingMode_1_0(b, l + 1); + return true; + } + + // expr SEPARATOR + private static boolean ProgramCounterIndirectWithIndexNewAddressingMode_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = expr(b, l + 1, -1); + r = r && consumeToken(b, SEPARATOR); + exit_section_(b, m, null, r); + return r; + } + // DataWidth? - private static boolean ProgramCounterIndirectWithIndexNewAddressingMode_6(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode_6")) return false; + private static boolean ProgramCounterIndirectWithIndexNewAddressingMode_5(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode_5")) return false; DataWidth(b, l + 1); return true; } /* ********************************************************** */ - // expr ROUND_L PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R + // expr? ROUND_L PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R public static boolean ProgramCounterIndirectWithIndexOldAddressingMode(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexOldAddressingMode")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE, ""); - r = expr(b, l + 1, -1); + r = ProgramCounterIndirectWithIndexOldAddressingMode_0(b, l + 1); r = r && consumeTokens(b, 0, ROUND_L, PC, SEPARATOR); r = r && DataOrAddressRegister(b, l + 1); r = r && ProgramCounterIndirectWithIndexOldAddressingMode_5(b, l + 1); @@ -804,6 +867,13 @@ public class M68kParser implements PsiParser, LightPsiParser { return r; } + // expr? + private static boolean ProgramCounterIndirectWithIndexOldAddressingMode_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexOldAddressingMode_0")) return false; + expr(b, l + 1, -1); + return true; + } + // DataWidth? private static boolean ProgramCounterIndirectWithIndexOldAddressingMode_5(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexOldAddressingMode_5")) return false; @@ -825,7 +895,7 @@ public class M68kParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // (DataOrAddressRegister|RegisterRange) (OP_AR_DIV (DataOrAddressRegister|RegisterRange))* + // (DataOrAddressRegister|RegisterRange) ((OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange))* public static boolean RegisterListAddressingMode(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "RegisterListAddressingMode")) return false; if (!nextTokenIsFast(b, AREG, DREG)) return false; @@ -846,7 +916,7 @@ public class M68kParser implements PsiParser, LightPsiParser { return r; } - // (OP_AR_DIV (DataOrAddressRegister|RegisterRange))* + // ((OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange))* private static boolean RegisterListAddressingMode_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "RegisterListAddressingMode_1")) return false; while (true) { @@ -857,17 +927,26 @@ public class M68kParser implements PsiParser, LightPsiParser { return true; } - // OP_AR_DIV (DataOrAddressRegister|RegisterRange) + // (OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange) private static boolean RegisterListAddressingMode_1_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "RegisterListAddressingMode_1_0")) return false; boolean r; Marker m = enter_section_(b); - r = consumeTokenFast(b, OP_AR_DIV); + r = RegisterListAddressingMode_1_0_0(b, l + 1); r = r && RegisterListAddressingMode_1_0_1(b, l + 1); exit_section_(b, m, null, r); return r; } + // OP_AR_DIV|OP_MINUS + private static boolean RegisterListAddressingMode_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "RegisterListAddressingMode_1_0_0")) return false; + boolean r; + r = consumeTokenFast(b, OP_AR_DIV); + if (!r) r = consumeTokenFast(b, OP_MINUS); + return r; + } + // DataOrAddressRegister|RegisterRange private static boolean RegisterListAddressingMode_1_0_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "RegisterListAddressingMode_1_0_1")) return false; diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexNewAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexNewAddressingMode.java index 4048ab0..2db1dc5 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexNewAddressingMode.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexNewAddressingMode.java @@ -15,7 +15,7 @@ public interface M68kAddressRegisterIndirectWithIndexNewAddressingMode extends M @NotNull M68kRegister getRegister(); - @NotNull + @Nullable M68kExpr getExpr(); } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexOldAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexOldAddressingMode.java index 534ddc9..4cafd66 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexOldAddressingMode.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kAddressRegisterIndirectWithIndexOldAddressingMode.java @@ -15,7 +15,7 @@ public interface M68kAddressRegisterIndirectWithIndexOldAddressingMode extends M @NotNull M68kRegister getRegister(); - @NotNull + @Nullable M68kExpr getExpr(); } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kInstruction.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kInstruction.java deleted file mode 100644 index 543f654..0000000 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kInstruction.java +++ /dev/null @@ -1,15 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package de.platon42.intellij.plugins.m68k.psi; - -import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.Nullable; - -public interface M68kInstruction extends PsiElement { - - @Nullable - M68kAsmInstruction getAsmInstruction(); - - @Nullable - M68kMacroCall getMacroCall(); - -} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithDisplacementOldAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithDisplacementOldAddressingMode.java index fca56ad..f63c7cc 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithDisplacementOldAddressingMode.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithDisplacementOldAddressingMode.java @@ -1,11 +1,11 @@ // This is a generated file. Not intended for manual editing. package de.platon42.intellij.plugins.m68k.psi; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface M68kProgramCounterIndirectWithDisplacementOldAddressingMode extends M68kAddressingMode { - @NotNull + @Nullable M68kExpr getExpr(); } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexNewAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexNewAddressingMode.java index 3d6b5c1..23517f7 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexNewAddressingMode.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexNewAddressingMode.java @@ -12,7 +12,7 @@ public interface M68kProgramCounterIndirectWithIndexNewAddressingMode extends M6 @NotNull M68kRegister getRegister(); - @NotNull + @Nullable M68kExpr getExpr(); } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexOldAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexOldAddressingMode.java index 9525956..6e1de16 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexOldAddressingMode.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kProgramCounterIndirectWithIndexOldAddressingMode.java @@ -12,7 +12,7 @@ public interface M68kProgramCounterIndirectWithIndexOldAddressingMode extends M6 @NotNull M68kRegister getRegister(); - @NotNull + @Nullable M68kExpr getExpr(); } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRegisterListAddressingMode.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRegisterListAddressingMode.java new file mode 100644 index 0000000..8847b46 --- /dev/null +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kRegisterListAddressingMode.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package de.platon42.intellij.plugins.m68k.psi; + +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public interface M68kRegisterListAddressingMode extends M68kAddressingMode { + + @NotNull + List getRegisterList(); + +} diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl.java index 9a88b92..d8570d0 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl.java @@ -43,9 +43,9 @@ public class M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl extends M } @Override - @NotNull + @Nullable public M68kExpr getExpr() { - return findNotNullChildByClass(M68kExpr.class); + return findChildByClass(M68kExpr.class); } } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl.java index e6ac4c8..4165d04 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl.java @@ -43,9 +43,9 @@ public class M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl extends M } @Override - @NotNull + @Nullable public M68kExpr getExpr() { - return findNotNullChildByClass(M68kExpr.class); + return findChildByClass(M68kExpr.class); } } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl.java index b2799d6..7397aaf 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl.java @@ -7,6 +7,7 @@ import de.platon42.intellij.plugins.m68k.psi.M68kExpr; import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithDisplacementOldAddressingMode; import de.platon42.intellij.plugins.m68k.psi.M68kVisitor; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl extends M68kAddressingModeImpl implements M68kProgramCounterIndirectWithDisplacementOldAddressingMode { @@ -26,9 +27,9 @@ public class M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl ext } @Override - @NotNull + @Nullable public M68kExpr getExpr() { - return findNotNullChildByClass(M68kExpr.class); + return findChildByClass(M68kExpr.class); } } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexNewAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexNewAddressingModeImpl.java index fab0fab..b561a0d 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexNewAddressingModeImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexNewAddressingModeImpl.java @@ -37,9 +37,9 @@ public class M68kProgramCounterIndirectWithIndexNewAddressingModeImpl extends M6 } @Override - @NotNull + @Nullable public M68kExpr getExpr() { - return findNotNullChildByClass(M68kExpr.class); + return findChildByClass(M68kExpr.class); } } diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexOldAddressingModeImpl.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexOldAddressingModeImpl.java index 543abaf..d430aab 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexOldAddressingModeImpl.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/impl/M68kProgramCounterIndirectWithIndexOldAddressingModeImpl.java @@ -37,9 +37,9 @@ public class M68kProgramCounterIndirectWithIndexOldAddressingModeImpl extends M6 } @Override - @NotNull + @Nullable public M68kExpr getExpr() { - return findNotNullChildByClass(M68kExpr.class); + return findChildByClass(M68kExpr.class); } } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt b/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt index a297489..96a6786 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/asm/M68kIsa.kt @@ -20,14 +20,14 @@ object M68kIsa { val isaData = listOf( IsaData("abcd", "Add Decimal with Extend"), IsaData("add", "Add"), - IsaData("adda", "Add Address"), - IsaData("addi", "Add Immediate"), + IsaData("adda", "Add Address", altMnemonics = listOf("add")), + IsaData("addi", "Add Immediate", altMnemonics = listOf("add")), IsaData("addq", "Add Quick"), IsaData("addx", "Add with Extend"), IsaData("and", "Logical AND"), - IsaData("andi", "Logical AND Immediate"), - IsaData("andi", "to CCR AND Immediate to Condition Code Register"), - IsaData("andi", "to SR AND Immediate to Status Register"), + IsaData("andi", "Logical AND Immediate", altMnemonics = listOf("and")), + IsaData("andi", "to CCR AND Immediate to Condition Code Register", altMnemonics = listOf("and")), + IsaData("andi", "to SR AND Immediate to Status Register", altMnemonics = listOf("and")), IsaData("asl", "Arithmetic Shift Left"), IsaData("asr", "Arithmetic Shift Right"), IsaData("bCC", "Branch Conditionally", conditionCodes = conditionCodesBcc), @@ -40,9 +40,9 @@ object M68kIsa { IsaData("chk", "Check Register Against Bound"), IsaData("clr", "Clear"), IsaData("cmp", "Compare"), - IsaData("cmpa", "Compare Address"), - IsaData("cmpi", "Compare Immediate"), - IsaData("cmpm", "Compare Memory to Memory"), + IsaData("cmpa", "Compare Address", altMnemonics = listOf("cmp")), + IsaData("cmpi", "Compare Immediate", altMnemonics = listOf("cmp")), + IsaData("cmpm", "Compare Memory to Memory", altMnemonics = listOf("cmp")), IsaData( "dbCC", "Test Condition, Decrement, and Branch", @@ -52,9 +52,9 @@ object M68kIsa { IsaData("divs", "Signed Divide"), IsaData("divu", "Unsigned Divide"), IsaData("eor", "Logical Exclusive-OR"), - IsaData("eori", "Logical Exclusive-OR Immediate"), - IsaData("eori", "to CCR Exclusive-OR Immediate to Condition Code Register"), - IsaData("eori", "to SR Exclusive-OR Immediate to Status Register"), + IsaData("eori", "Logical Exclusive-OR Immediate", altMnemonics = listOf("eor")), + IsaData("eori", "to CCR Exclusive-OR Immediate to Condition Code Register", altMnemonics = listOf("eor")), + IsaData("eori", "to SR Exclusive-OR Immediate to Status Register", altMnemonics = listOf("eor")), IsaData("exg", "Exchange Registers"), IsaData("ext", "Sign Extend"), IsaData("illegal", "Take Illegal Instruction Trap"), @@ -65,7 +65,7 @@ object M68kIsa { IsaData("lsl", "Logical Shift Left"), IsaData("lsr", "Logical Shift Right"), IsaData("move", "Move"), - IsaData("movea", "Move Address"), + IsaData("movea", "Move Address", altMnemonics = listOf("move")), IsaData("move", "to CCR Move to Condition Code Register"), IsaData("move", "from SR Move from Status Register"), IsaData("move", "to SR Move to Status Register"), @@ -81,9 +81,9 @@ object M68kIsa { IsaData("nop", "No Operation"), IsaData("not", "Logical Complement"), IsaData("or", "Logical Inclusive-OR"), - IsaData("ori", "Logical Inclusive-OR Immediate"), - IsaData("ori", "to CCR Inclusive-OR Immediate to Condition Code Register"), - IsaData("ori", "to SR Inclusive-OR Immediate to Status Register"), + IsaData("ori", "Logical Inclusive-OR Immediate", altMnemonics = listOf("or")), + IsaData("ori", "to CCR Inclusive-OR Immediate to Condition Code Register", altMnemonics = listOf("or")), + IsaData("ori", "to SR Inclusive-OR Immediate to Status Register", altMnemonics = listOf("or")), IsaData("pea", "Push Effective Address"), IsaData("reset", "Reset External Devices"), IsaData("rol", "Rotate Left"), @@ -97,8 +97,8 @@ object M68kIsa { IsaData("sCC", "Set Conditionally", conditionCodes = conditionCodes), IsaData("stop", "Stop"), IsaData("sub", "Subtract"), - IsaData("suba", "Subtract Address"), - IsaData("subi", "Subtract Immediate"), + IsaData("suba", "Subtract Address", altMnemonics = listOf("sub")), + IsaData("subi", "Subtract Immediate", altMnemonics = listOf("sub")), IsaData("subq", "Subtract Quick"), IsaData("subx", "Subtract with Extend"), IsaData("swap", "Swap Register Words"), @@ -106,7 +106,7 @@ object M68kIsa { IsaData("trap", "Trap"), IsaData("trapv", "Trap on Overflow"), IsaData("tst", "Test Operand"), - IsaData("unlk", "Unlink "), + IsaData("unlk", "Unlink"), ) val mnemonics = 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 9841c0e..cc87242 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf +++ b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf @@ -206,15 +206,15 @@ AddressRegisterIndirectPostIncAddressingMode ::= ROUND_L AddressRegister ROUND_R AddressRegisterIndirectPreDecAddressingMode ::= OP_MINUS ROUND_L AddressRegister ROUND_R AddressRegisterIndirectWithDisplacementOldAddressingMode ::= expr ROUND_L AddressRegister ROUND_R AddressRegisterIndirectWithDisplacementNewAddressingMode ::= ROUND_L expr SEPARATOR AddressRegister ROUND_R -AddressRegisterIndirectWithIndexOldAddressingMode ::= expr ROUND_L AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R -AddressRegisterIndirectWithIndexNewAddressingMode ::= ROUND_L expr SEPARATOR AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R -ProgramCounterIndirectWithDisplacementOldAddressingMode ::= expr ROUND_L PC ROUND_R +AddressRegisterIndirectWithIndexOldAddressingMode ::= expr? ROUND_L AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R +AddressRegisterIndirectWithIndexNewAddressingMode ::= ROUND_L (expr SEPARATOR)? AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R +ProgramCounterIndirectWithDisplacementOldAddressingMode ::= (ROUND_L PC ROUND_R) | (expr ROUND_L PC ROUND_R) ProgramCounterIndirectWithDisplacementNewAddressingMode ::= ROUND_L expr SEPARATOR PC ROUND_R -ProgramCounterIndirectWithIndexOldAddressingMode ::= expr ROUND_L PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R -ProgramCounterIndirectWithIndexNewAddressingMode ::= ROUND_L expr SEPARATOR PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R +ProgramCounterIndirectWithIndexOldAddressingMode ::= expr? ROUND_L PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R +ProgramCounterIndirectWithIndexNewAddressingMode ::= ROUND_L (expr SEPARATOR)? PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R AbsoluteAddressAddressingMode ::= expr AddressSize? !ROUND_L private RegisterRange ::= (DataOrAddressRegister OP_MINUS DataOrAddressRegister) -RegisterListAddressingMode ::= (DataOrAddressRegister|RegisterRange) (OP_AR_DIV (DataOrAddressRegister|RegisterRange))* +RegisterListAddressingMode ::= (DataOrAddressRegister|RegisterRange) ((OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange))* ImmediateData ::= HASH expr {extends=AddressingMode} expr ::= binary_logical_or_expr diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt new file mode 100644 index 0000000..2ca32b2 --- /dev/null +++ b/src/test/java/de/platon42/intellij/plugins/m68k/parser/AddressingModesTest.kt @@ -0,0 +1,101 @@ +package de.platon42.intellij.plugins.m68k.parser + +import de.platon42.intellij.jupiter.MyTestCase +import de.platon42.intellij.jupiter.ParsingTestExtension +import de.platon42.intellij.jupiter.TestDataSubPath +import org.junit.jupiter.api.Test + +@TestDataSubPath("addressingmodes") +internal class AddressingModesTest : AbstractParsingTest() { + + @Test + internal fun register_direct(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l d0,a7\n") + } + + @Test + internal fun register_indirect(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (sp),(a0)\n") + } + + @Test + internal fun register_indirect_predecrement_postincrement(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (a1)+,-(sp)\n") + } + + @Test + internal fun register_indirect_with_offset_old_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l -4+foo(sp),(10*20+4)(a1)\n") + } + + @Test + internal fun register_indirect_with_offset_new_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (-4+foo,sp),((10*20+4),a1)\n") + } + + @Test + internal fun register_indirect_with_index_and_offset_old_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l -4+foo(sp,d0.w),(10*20+4)(a1,a3)\n") + } + + @Test + internal fun register_indirect_with_index_and_offset_new_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (-4+foo,sp,a0),((10*20+4),a1,d5.l)\n") + } + + @Test + internal fun register_indirect_with_index_special_case_without_offset(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (sp,d0.w),(a1,a3)\n") + } + + @Test + internal fun pc_indirect_with_offset_old_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l -4*4(pc),+4(pc)\n") + } + + @Test + internal fun pc_indirect_with_offset_new_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l ((-4+foo),pc),((10*20+4),pc)\n") + } + + @Test + internal fun pc_indirect_special_case_without_offset(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (pc),d6\n") + } + + @Test + internal fun pc_indirect_with_index_and_offset_old_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l -4+foo(pc,d0.w),(10*20+4)(pc,a3)\n") + } + + @Test + internal fun pc_indirect_with_index_and_offset_new_syntax(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (-4+foo,pc,a0),((10*20+4),pc,d5.l)\n") + } + + @Test + internal fun pc_indirect_with_index_special_case_without_offset(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l (pc,d0.w),(pc,a3)\n") + } + + @Test + internal fun absolute_address(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l 4.w,a6\n") + } + + @Test + internal fun movem_register_list(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " movem.l d0-d2/d4/a0-a2/a4,-(sp)\n") + } + + @Test + internal fun immediate_data(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " moveq.l #FOO_BAR,d0\n") + } + + @Test + internal fun special_register_move(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, " move.l usp,a0\n" + + " move.l a5,usp\n") + } +} \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/absolute_address.txt b/src/test/resources/parser/addressingmodes/absolute_address.txt new file mode 100644 index 0000000..87f7ff1 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/absolute_address.txt @@ -0,0 +1,20 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + M68kAddressSizeImpl(ADDRESS_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.w') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterDirectAddressingModeImpl(ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE) + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a6') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/immediate_data.txt b/src/test/resources/parser/addressingmodes/immediate_data.txt new file mode 100644 index 0000000..8932f37 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/immediate_data.txt @@ -0,0 +1,19 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('moveq') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kImmediateDataImpl(IMMEDIATE_DATA) + PsiElement(M68kTokenType.#)('#') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('FOO_BAR') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE) + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/movem_register_list.txt b/src/test/resources/parser/addressingmodes/movem_register_list.txt new file mode 100644 index 0000000..15e05f0 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/movem_register_list.txt @@ -0,0 +1,36 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('movem') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kRegisterListAddressingModeImpl(REGISTER_LIST_ADDRESSING_MODE) + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + PsiElement(M68kTokenType.-)('-') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d2') + PsiElement(M68kTokenType./)('/') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d4') + PsiElement(M68kTokenType./)('/') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a0') + PsiElement(M68kTokenType.-)('-') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a2') + PsiElement(M68kTokenType./)('/') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a4') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectPreDecAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE) + PsiElement(M68kTokenType.-)('-') + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/pc_indirect_special_case_without_offset.txt b/src/test/resources/parser/addressingmodes/pc_indirect_special_case_without_offset.txt new file mode 100644 index 0000000..cc3fac1 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/pc_indirect_special_case_without_offset.txt @@ -0,0 +1,19 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE) + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d6') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..7708ccf --- /dev/null +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_new_syntax.txt @@ -0,0 +1,51 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.,)(',') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a0') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d5') + M68kDataWidthImpl(DATA_WIDTH) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..17f21c9 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_and_offset_old_syntax.txt @@ -0,0 +1,49 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kProgramCounterIndirectWithIndexOldAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + M68kDataWidthImpl(DATA_WIDTH) + PsiElement(M68kTokenType.OPSIZE_WL)('.w') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kProgramCounterIndirectWithIndexOldAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a3') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/pc_indirect_with_index_special_case_without_offset.txt b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_special_case_without_offset.txt new file mode 100644 index 0000000..32611aa --- /dev/null +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_index_special_case_without_offset.txt @@ -0,0 +1,28 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + M68kDataWidthImpl(DATA_WIDTH) + PsiElement(M68kTokenType.OPSIZE_WL)('.w') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a3') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..01952fc --- /dev/null +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_new_syntax.txt @@ -0,0 +1,46 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_old_syntax.txt b/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_old_syntax.txt new file mode 100644 index 0000000..2dd2306 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/pc_indirect_with_offset_old_syntax.txt @@ -0,0 +1,32 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl(PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) + M68kUnaryPlusExprImpl(UNARY_PLUS_EXPR) + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.()('(') + PsiElement(M68kTokenType.pc)('pc') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/register_direct.txt b/src/test/resources/parser/addressingmodes/register_direct.txt new file mode 100644 index 0000000..cec5c83 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_direct.txt @@ -0,0 +1,18 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE) + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterDirectAddressingModeImpl(ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE) + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a7') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/register_indirect.txt b/src/test/resources/parser/addressingmodes/register_indirect.txt new file mode 100644 index 0000000..b17d968 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect.txt @@ -0,0 +1,22 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a0') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/register_indirect_predecrement_postincrement.txt b/src/test/resources/parser/addressingmodes/register_indirect_predecrement_postincrement.txt new file mode 100644 index 0000000..c2dc36b --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect_predecrement_postincrement.txt @@ -0,0 +1,24 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectPostIncAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_POST_INC_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a1') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.+)('+') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectPreDecAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE) + PsiElement(M68kTokenType.-)('-') + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..050cfdf --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_new_syntax.txt @@ -0,0 +1,53 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a0') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a1') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d5') + M68kDataWidthImpl(DATA_WIDTH) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..08e2c72 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_index_and_offset_old_syntax.txt @@ -0,0 +1,51 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + M68kDataWidthImpl(DATA_WIDTH) + PsiElement(M68kTokenType.OPSIZE_WL)('.w') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a1') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a3') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/register_indirect_with_index_special_case_without_offset.txt b/src/test/resources/parser/addressingmodes/register_indirect_with_index_special_case_without_offset.txt new file mode 100644 index 0000000..45c255d --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_index_special_case_without_offset.txt @@ -0,0 +1,30 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.,)(',') + M68kDataRegisterImpl(DATA_REGISTER) + PsiElement(M68kTokenType.DREG)('d0') + M68kDataWidthImpl(DATA_WIDTH) + PsiElement(M68kTokenType.OPSIZE_WL)('.w') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a1') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a3') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..3fd3196 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_offset_new_syntax.txt @@ -0,0 +1,45 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) + PsiElement(M68kTokenType.()('(') + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a1') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file 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 new file mode 100644 index 0000000..d0a3cd1 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/register_indirect_with_offset_old_syntax.txt @@ -0,0 +1,43 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kUnaryMinusExprImpl(UNARY_MINUS_EXPR) + PsiElement(M68kTokenType.-)('-') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.+)('+') + M68kRefExprImpl(REF_EXPR) + PsiElement(M68kTokenType.SYMBOL)('foo') + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('sp') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) + M68kParenExprImpl(PAREN_EXPR) + PsiElement(M68kTokenType.()('(') + M68kBinaryAddExprImpl(BINARY_ADD_EXPR) + M68kBinaryMulExprImpl(BINARY_MUL_EXPR) + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('10') + PsiElement(M68kTokenType.*)('*') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('20') + PsiElement(M68kTokenType.+)('+') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('4') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.()('(') + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a1') + PsiElement(M68kTokenType.))(')') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/addressingmodes/special_register_move.txt b/src/test/resources/parser/addressingmodes/special_register_move.txt new file mode 100644 index 0000000..f6a3538 --- /dev/null +++ b/src/test/resources/parser/addressingmodes/special_register_move.txt @@ -0,0 +1,35 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kSpecialRegisterDirectAddressingModeImpl(SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE) + M68kSpecialRegisterImpl(SPECIAL_REGISTER) + PsiElement(M68kTokenType.usp)('usp') + PsiElement(M68kTokenType.,)(',') + M68kAddressRegisterDirectAddressingModeImpl(ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE) + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a0') + PsiElement(M68kTokenType.EOL)('\n') + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kAsmInstructionImpl(ASM_INSTRUCTION) + M68kAsmOpImpl(ASM_OP) + PsiElement(M68kTokenType.MNEMONIC)('move') + M68kOperandSizeImpl(OPERAND_SIZE) + PsiElement(M68kTokenType.OPSIZE_WL)('.l') + PsiWhiteSpace(' ') + M68kAsmOperandsImpl(ASM_OPERANDS) + M68kAddressRegisterDirectAddressingModeImpl(ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE) + M68kAddressRegisterImpl(ADDRESS_REGISTER) + PsiElement(M68kTokenType.AREG)('a5') + PsiElement(M68kTokenType.,)(',') + M68kSpecialRegisterDirectAddressingModeImpl(SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE) + M68kSpecialRegisterImpl(SPECIAL_REGISTER) + PsiElement(M68kTokenType.usp)('usp') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file