Added first tests, improved BNF and Lexer. Fixed extra space in assignment symbol.

This commit is contained in:
Chris Hodges 2021-07-15 12:04:05 +02:00
parent 1dc418ae84
commit 2fe70deee2
33 changed files with 982 additions and 464 deletions

View File

@ -273,44 +273,44 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
// AbsoluteAddressAddressingMode
// | SpecialRegisterDirectAddressingMode
// | DataRegisterDirectAddressingMode
// | AddressRegisterDirectAddressingMode
// ImmediateData
// | AddressRegisterIndirectPreDecAddressingMode
// | AddressRegisterIndirectPostIncAddressingMode
// | AddressRegisterIndirectAddressingMode
// | AddressRegisterIndirectWithDisplacementOldAddressingMode
// | ProgramCounterIndirectWithDisplacementOldAddressingMode
// | AddressRegisterIndirectWithIndexOldAddressingMode
// | ProgramCounterIndirectWithIndexOldAddressingMode
// | AddressRegisterIndirectWithDisplacementNewAddressingMode
// | ProgramCounterIndirectWithDisplacementNewAddressingMode
// | AddressRegisterIndirectWithIndexNewAddressingMode
// | ProgramCounterIndirectWithIndexNewAddressingMode
// | AddressRegisterIndirectPreDecAddressingMode
// | AddressRegisterIndirectPostIncAddressingMode
// | AddressRegisterIndirectWithDisplacementOldAddressingMode
// | ProgramCounterIndirectWithDisplacementOldAddressingMode
// | AddressRegisterIndirectWithIndexOldAddressingMode
// | ProgramCounterIndirectWithIndexOldAddressingMode
// | SpecialRegisterDirectAddressingMode
// | DataRegisterDirectAddressingMode
// | AddressRegisterDirectAddressingMode
// | RegisterListAddressingMode
// | ImmediateData
// | AbsoluteAddressAddressingMode
public static boolean AddressingMode(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "AddressingMode")) return false;
boolean r;
Marker m = enter_section_(b, l, _COLLAPSE_, ADDRESSING_MODE, "<AddressingMode>");
r = AbsoluteAddressAddressingMode(b, l + 1);
if (!r) r = SpecialRegisterDirectAddressingMode(b, l + 1);
if (!r) r = DataRegisterDirectAddressingMode(b, l + 1);
if (!r) r = AddressRegisterDirectAddressingMode(b, l + 1);
r = ImmediateData(b, l + 1);
if (!r) r = AddressRegisterIndirectPreDecAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectPostIncAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectWithDisplacementOldAddressingMode(b, l + 1);
if (!r) r = ProgramCounterIndirectWithDisplacementOldAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectWithIndexOldAddressingMode(b, l + 1);
if (!r) r = ProgramCounterIndirectWithIndexOldAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectWithDisplacementNewAddressingMode(b, l + 1);
if (!r) r = ProgramCounterIndirectWithDisplacementNewAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectWithIndexNewAddressingMode(b, l + 1);
if (!r) r = ProgramCounterIndirectWithIndexNewAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectPreDecAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectPostIncAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectWithDisplacementOldAddressingMode(b, l + 1);
if (!r) r = ProgramCounterIndirectWithDisplacementOldAddressingMode(b, l + 1);
if (!r) r = AddressRegisterIndirectWithIndexOldAddressingMode(b, l + 1);
if (!r) r = ProgramCounterIndirectWithIndexOldAddressingMode(b, l + 1);
if (!r) r = SpecialRegisterDirectAddressingMode(b, l + 1);
if (!r) r = DataRegisterDirectAddressingMode(b, l + 1);
if (!r) r = AddressRegisterDirectAddressingMode(b, l + 1);
if (!r) r = RegisterListAddressingMode(b, l + 1);
if (!r) r = ImmediateData(b, l + 1);
if (!r) r = AbsoluteAddressAddressingMode(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
@ -356,18 +356,18 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
// FirstAsmOperand (SEPARATOR NextAsmOperand)*
// AddressingMode (SEPARATOR AddressingMode)*
public static boolean AsmOperands(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "AsmOperands")) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, ASM_OPERANDS, "<asm operands>");
r = FirstAsmOperand(b, l + 1);
r = AddressingMode(b, l + 1);
r = r && AsmOperands_1(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// (SEPARATOR NextAsmOperand)*
// (SEPARATOR AddressingMode)*
private static boolean AsmOperands_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "AsmOperands_1")) return false;
while (true) {
@ -378,13 +378,13 @@ public class M68kParser implements PsiParser, LightPsiParser {
return true;
}
// SEPARATOR NextAsmOperand
// SEPARATOR AddressingMode
private static boolean AsmOperands_1_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "AsmOperands_1_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, SEPARATOR);
r = r && NextAsmOperand(b, l + 1);
r = r && AddressingMode(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
@ -481,12 +481,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
return r;
}
/* ********************************************************** */
// AddressingMode
static boolean FirstAsmOperand(PsiBuilder b, int l) {
return AddressingMode(b, l + 1);
}
/* ********************************************************** */
// GLOBAL_LABEL_DEF
public static boolean GlobalLabel(PsiBuilder b, int l) {
@ -543,12 +537,12 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
// LabelOnly|LabelWithInstruction|InstructionOnly
// LabelWithInstruction | LabelOnly | InstructionOnly
static boolean LabelInsts(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "LabelInsts")) return false;
boolean r;
r = LabelOnly(b, l + 1);
if (!r) r = LabelWithInstruction(b, l + 1);
r = LabelWithInstruction(b, l + 1);
if (!r) r = LabelOnly(b, l + 1);
if (!r) r = InstructionOnly(b, l + 1);
return r;
}
@ -616,12 +610,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
return true;
}
/* ********************************************************** */
// AddressingMode
static boolean NextAsmOperand(PsiBuilder b, int l) {
return AddressingMode(b, l + 1);
}
/* ********************************************************** */
// OPSIZE_BS|OPSIZE_WL
public static boolean OperandSize(PsiBuilder b, int l) {

View File

@ -3,11 +3,18 @@ package de.platon42.intellij.plugins.m68k.lexer
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.mnemonics
object LexerUtil {
private val ASSIGNMENT_SEPARATORS = charArrayOf('=', ' ', '\t')
private val ASSIGNMENT_SEPARATORS = charArrayOf(' ', '\t')
@JvmStatic
fun isAsmMnemonic(text: CharSequence) = mnemonics.contains(text.toString().lowercase())
@JvmStatic
fun pushbackAssignment(text: CharSequence) = text.length - 1 - text.indexOfAny(ASSIGNMENT_SEPARATORS)
fun pushbackAssignment(text: CharSequence): Int {
val spacePos = text.indexOfAny(ASSIGNMENT_SEPARATORS)
if (spacePos > -1) {
return text.length - spacePos
}
return text.length - 1 - text.indexOf('=')
}
}

View File

@ -38,7 +38,7 @@ LOCAL_LABEL_WC=(\.([:letter:]|_)(([:letter:]|[:digit:])|_)*:)|(([:letter:]|_)(([
GLOBAL_LABEL=(([:letter:]|_)(([:letter:]|[:digit:])|_)*:?:?)
GLOBAL_LABEL_WC=(([:letter:]|_)(([:letter:]|[:digit:])|_)*::?)
MNEMONIC=(([:letter:])+)
SYMBOL=(([:letter:]|_|.)(([:letter:]|[:digit:])|_|\$)*)
SYMBOL=(([:letter:]|_|\.)(([:letter:]|[:digit:])|[_\$])*)
OPSIZE_BS=(\.[bs])
OPSIZE_WL=(\.[wl])
BINARY=(%[01]+)
@ -49,7 +49,7 @@ STRINGLIT=(`([^`\\]|\\.)*`|'([^'\\]|\\.)*'|\"([^\"\\]|\\.)*\")|<([^`\\]|\\.)*>
COMMENT=([;].*+)
HASH_COMMENT=([#;*].*+)
%state NOSOL,INSTRPART,ASMINSTR,ASMOPS,ASSIGNMENT
%state NOSOL,INSTRPART,ASMINSTR,ASMOPS,ASSIGNMENT,WAITEOL
%%
<YYINITIAL> {
@ -67,8 +67,8 @@ HASH_COMMENT=([#;*].*+)
{EOL} { yybegin(YYINITIAL); return WHITE_SPACE; }
{LOCAL_LABEL_WC} { yybegin(INSTRPART); return LOCAL_LABEL_DEF; }
{GLOBAL_LABEL_WC} { yybegin(INSTRPART); return GLOBAL_LABEL_DEF; }
{MNEMONIC} { yybegin(ASMINSTR); return isAsmMnemonic(yytext()) ? MNEMONIC : SYMBOL; }
{SYMBOL} { return SYMBOL; }
{MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { yybegin(INSTRPART); return SYMBOL; } }
{SYMBOL} { yybegin(INSTRPART); return SYMBOL; }
{HASH_COMMENT} { yybegin(YYINITIAL); return COMMENT; }
}
@ -93,10 +93,10 @@ HASH_COMMENT=([#;*].*+)
{IF_TAG} { return IF_TAG; }
{MNEMONIC} { return isAsmMnemonic(yytext()) ? MNEMONIC : SYMBOL; }
{MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { return SYMBOL; } }
{SYMBOL} { return SYMBOL; }
{COMMENT} { yybegin(YYINITIAL); return COMMENT; }
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
}
<ASMINSTR> {
@ -106,7 +106,7 @@ HASH_COMMENT=([#;*].*+)
{OPSIZE_BS} { return OPSIZE_BS; }
{OPSIZE_WL} { return OPSIZE_WL; }
{COMMENT} { yybegin(YYINITIAL); return COMMENT; }
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
}
<ASSIGNMENT> {
@ -155,7 +155,7 @@ HASH_COMMENT=([#;*].*+)
{SYMBOL} { return SYMBOL; }
{COMMENT} { return COMMENT; }
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
}
<ASMOPS> {
@ -171,6 +171,14 @@ HASH_COMMENT=([#;*].*+)
{OPSIZE_BS} { return OPSIZE_BS; }
{OPSIZE_WL} { return OPSIZE_WL; }
{AREG} { return AREG; }
{DREG} { return DREG; }
"pc" { return PC; }
"ccr" { return REG_CCR; }
"sr" { return REG_SR; }
"usp" { return REG_USP; }
"vbr" { return REG_VBR; }
"<<" { return OP_AR_SHIFT_L; }
">>" { return OP_AR_SHIFT_R; }
"&&" { return OP_LOGICAL_AND; }
@ -204,18 +212,15 @@ HASH_COMMENT=([#;*].*+)
"/" { return OP_AR_DIV; }
"%" { return OP_AR_MOD; }
{AREG} { return AREG; }
{DREG} { return DREG; }
"pc" { return PC; }
"ccr" { return REG_CCR; }
"sr" { return REG_SR; }
"usp" { return REG_USP; }
"vbr" { return REG_VBR; }
{SYMBOL} { return SYMBOL; }
{COMMENT} { return COMMENT; }
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
}
<WAITEOL>
{
{EOL} { yybegin(YYINITIAL); return EOL; }
}
[^] { return BAD_CHARACTER; }

View File

@ -128,7 +128,7 @@ private statement_recover ::= !(EOL)
Assignment ::= SYMBOLDEF (OP_ASSIGN|EQU) expr
private LabelInsts ::= LabelOnly|LabelWithInstruction|InstructionOnly
private LabelInsts ::= LabelWithInstruction | LabelOnly | InstructionOnly
private LabelOnly ::= Label
private LabelWithInstruction ::= Label Instruction
@ -166,11 +166,7 @@ AsmInstruction ::= AsmOp AsmOperands?
private Instruction ::= AsmInstruction | MacroCall
//external Instruction ::= parseMacroCallOrAsmInstruction
AsmOperands ::= FirstAsmOperand (SEPARATOR NextAsmOperand)*
private FirstAsmOperand ::= AddressingMode
private NextAsmOperand ::= AddressingMode
AsmOperands ::= AddressingMode (SEPARATOR AddressingMode)*
private PreprocessorOperands ::= PreprocessorOperand (SEPARATOR PreprocessorOperand)*
@ -184,23 +180,23 @@ Register ::= DataRegister | AddressRegister | SpecialRegister
private DataOrAddressRegister ::= DataRegister | AddressRegister
AddressingMode ::= AbsoluteAddressAddressingMode
| SpecialRegisterDirectAddressingMode
| DataRegisterDirectAddressingMode
| AddressRegisterDirectAddressingMode
AddressingMode ::= ImmediateData
| AddressRegisterIndirectPreDecAddressingMode
| AddressRegisterIndirectPostIncAddressingMode
| AddressRegisterIndirectAddressingMode
| AddressRegisterIndirectWithDisplacementOldAddressingMode
| ProgramCounterIndirectWithDisplacementOldAddressingMode
| AddressRegisterIndirectWithIndexOldAddressingMode
| ProgramCounterIndirectWithIndexOldAddressingMode
| AddressRegisterIndirectWithDisplacementNewAddressingMode
| ProgramCounterIndirectWithDisplacementNewAddressingMode
| AddressRegisterIndirectWithIndexNewAddressingMode
| ProgramCounterIndirectWithIndexNewAddressingMode
| AddressRegisterIndirectPreDecAddressingMode
| AddressRegisterIndirectPostIncAddressingMode
| AddressRegisterIndirectWithDisplacementOldAddressingMode
| ProgramCounterIndirectWithDisplacementOldAddressingMode
| AddressRegisterIndirectWithIndexOldAddressingMode
| ProgramCounterIndirectWithIndexOldAddressingMode
| SpecialRegisterDirectAddressingMode
| DataRegisterDirectAddressingMode
| AddressRegisterDirectAddressingMode
| RegisterListAddressingMode
| ImmediateData
| AbsoluteAddressAddressingMode
SpecialRegisterDirectAddressingMode ::= SpecialRegister
DataRegisterDirectAddressingMode ::= DataRegister !(OP_MINUS|OP_AR_DIV)

View File

@ -0,0 +1,16 @@
package de.platon42.intellij.plugins.m68k
import org.junit.jupiter.api.DisplayNameGeneration
import org.junit.jupiter.api.DisplayNameGenerator
import java.lang.reflect.Method
@DisplayNameGeneration(AbstractM68kTest.CutOffFixtureDisplayNameGenerator::class)
abstract class AbstractM68kTest {
class CutOffFixtureDisplayNameGenerator : DisplayNameGenerator.ReplaceUnderscores() {
override fun generateDisplayNameForMethod(testClass: Class<*>?, testMethod: Method?): String {
val nameForMethod = super.generateDisplayNameForMethod(testClass, testMethod)
return nameForMethod.substringBefore("$")
}
}
}

View File

@ -0,0 +1,24 @@
package de.platon42.intellij.plugins.m68k.parser
import de.platon42.intellij.jupiter.MyParser
import de.platon42.intellij.jupiter.ParsingTestExtension
import de.platon42.intellij.jupiter.TestDataPath
import de.platon42.intellij.plugins.m68k.AbstractM68kTest
import org.junit.jupiter.api.extension.ExtendWith
@ExtendWith(ParsingTestExtension::class)
@TestDataPath("src/test/resources/parser")
@MyParser(value = M68kParserDefinition::class, extension = "asm")
abstract class AbstractParsingTest : AbstractM68kTest() {
fun testGoodSyntax(testCase: ParsingTestExtension.IParsingTestCase, code: String) {
testCase.doCodeTest(code)
testCase.ensureCorrectReparse()
testCase.ensureNoErrorElements()
}
fun testBadSyntax(testCase: ParsingTestExtension.IParsingTestCase, code: String) {
testCase.doCodeTest(code)
testCase.ensureCorrectReparse()
}
}

View File

@ -0,0 +1,25 @@
package de.platon42.intellij.plugins.m68k.parser
import de.platon42.intellij.jupiter.MyTestCase
import de.platon42.intellij.jupiter.ParserResultFile
import de.platon42.intellij.jupiter.ParsingTestExtension
import de.platon42.intellij.jupiter.TestDataSubPath
import org.junit.jupiter.api.Test
@TestDataSubPath("basic")
internal class BasicAsmInstTest : AbstractParsingTest() {
@Test
@ParserResultFile("basic_block_of_code")
internal fun parser_can_parse_basic_block_of_code(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(
testCase, "\tadd.l d0,d0\n"
+ "\tmoveq #10,d1\n"
+ " rts\n"
+ "\n"
+ "; comment\n"
+ " jmp\tresetcode ; unreachable\n"
+ " \n"
)
}
}

View File

@ -0,0 +1,50 @@
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("comments")
internal class CommentsTest : AbstractParsingTest() {
@Test
internal fun asterisk_comment_at_sol(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "*********** comment\n")
}
@Test
internal fun asterisk_comment_after_space(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " *********** comment\n")
}
@Test
internal fun hash_comment_at_sol(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "#comment \n")
}
@Test
internal fun hash_comment_after_space(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " #comment \n")
}
@Test
internal fun semicolon_comment_at_sol(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "; comment \n")
}
@Test
internal fun semicolon_comment_after_space(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " ; comment \n")
}
@Test
internal fun empty_and_blank_lines(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "; hi\n\n\n * foo\n\n\n \n\n # bar\n\n")
}
@Test
internal fun end_of_line_comments(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "foo = 1234; hi\n\n\nlabel; foo\n\n\n add.w d0,d0;narf \n\n")
}
}

View File

@ -0,0 +1,87 @@
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("labels")
internal class LabelsTest : AbstractParsingTest() {
@Test
internal fun plain_global_label(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "Global_Label\n")
}
@Test
internal fun global_label_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "Global_Label:\n")
}
@Test
internal fun external_label_with_double_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "External_Label::\n")
}
@Test
internal fun indented_global_label_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " Global_Label:\n")
}
@Test
internal fun indented_external_label_with_double_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " External_Label::\n")
}
@Test
internal fun plain_dot_local_label(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, ".local_label\n")
}
@Test
internal fun dot_local_label_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, ".local_label:\n")
}
@Test
internal fun indented_dot_local_label_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "\t.local_label:\n")
}
@Test
internal fun plain_local_label_dollar(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "local_label$\n")
}
@Test
internal fun local_label_dollar_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "local_label$:\n")
}
@Test
internal fun indented_local_label_dollar_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " local_label$:\n")
}
@Test
internal fun bad_indented_dot_local_label_without_label(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testBadSyntax(testCase, " .local_label\n")
}
@Test
internal fun bad_indented_local_label_dollar_without_label(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testBadSyntax(testCase, " local_label$\n")
}
@Test
internal fun complex_label_test(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(
testCase, "start_demo: ; here we will do some cool stuff\n"
+ ".outerloop moveq.l #17-1,d7 ; this is the outer loop\n"
+ "innerloop$ move.l (a0)+,(a1)+ ; copy stuff\n"
+ " dbne d7,innerloop$ ; copy more\n"
+ " .skip: bne.s .outerloop ; end of chunk?\n"
+ " GlobalExit:: rts\n"
)
}
}

View File

@ -0,0 +1,58 @@
Assembly File: a.asm
PsiWhiteSpace('\t')
M68kStatementImpl(STATEMENT)
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('add')
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.,)(',')
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
M68kDataRegisterImpl(DATA_REGISTER)
PsiElement(M68kTokenType.DREG)('d0')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace('\t')
M68kStatementImpl(STATEMENT)
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('moveq')
PsiWhiteSpace(' ')
M68kAsmOperandsImpl(ASM_OPERANDS)
M68kImmediateDataImpl(IMMEDIATE_DATA)
PsiElement(M68kTokenType.#)('#')
M68kLiteralExprImpl(LITERAL_EXPR)
PsiElement(M68kTokenType.DECIMAL)('10')
PsiElement(M68kTokenType.,)(',')
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
M68kDataRegisterImpl(DATA_REGISTER)
PsiElement(M68kTokenType.DREG)('d1')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('rts')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace('\n')
PsiComment(M68kTokenType.COMMENT)('; comment')
PsiWhiteSpace('\n')
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('jmp')
PsiWhiteSpace('\t')
M68kAsmOperandsImpl(ASM_OPERANDS)
M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE)
M68kRefExprImpl(REF_EXPR)
PsiElement(M68kTokenType.SYMBOL)('resetcode')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; unreachable')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace(' ')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,4 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('*********** comment')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,3 @@
Assembly File: a.asm
PsiComment(M68kTokenType.COMMENT)('*********** comment')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,17 @@
Assembly File: a.asm
PsiComment(M68kTokenType.COMMENT)('; hi')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('* foo')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace(' ')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('# bar')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,39 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kAssignmentImpl(ASSIGNMENT)
PsiElement(M68kTokenType.SYMBOLDEF)('foo')
PsiWhiteSpace(' ')
PsiElement(M68kTokenType.=)('=')
PsiWhiteSpace(' ')
M68kLiteralExprImpl(LITERAL_EXPR)
PsiElement(M68kTokenType.DECIMAL)('1234')
PsiComment(M68kTokenType.COMMENT)('; hi')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('label')
PsiComment(M68kTokenType.COMMENT)('; foo')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('add')
M68kOperandSizeImpl(OPERAND_SIZE)
PsiElement(M68kTokenType.OPSIZE_WL)('.w')
PsiWhiteSpace(' ')
M68kAsmOperandsImpl(ASM_OPERANDS)
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
M68kDataRegisterImpl(DATA_REGISTER)
PsiElement(M68kTokenType.DREG)('d0')
PsiElement(M68kTokenType.,)(',')
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
M68kDataRegisterImpl(DATA_REGISTER)
PsiElement(M68kTokenType.DREG)('d0')
PsiComment(M68kTokenType.COMMENT)(';narf ')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,4 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('#comment ')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,3 @@
Assembly File: a.asm
PsiComment(M68kTokenType.COMMENT)('#comment ')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,4 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; comment ')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,3 @@
Assembly File: a.asm
PsiComment(M68kTokenType.COMMENT)('; comment ')
PsiWhiteSpace('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kMacroCallImpl(MACRO_CALL)
PsiElement(M68kTokenType.SYMBOL)('.local_label')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kMacroCallImpl(MACRO_CALL)
PsiElement(M68kTokenType.SYMBOL)('local_label$')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,104 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('start_demo:')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; here we will do some cool stuff')
PsiElement(M68kTokenType.EOL)('\n')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.outerloop')
PsiWhiteSpace(' ')
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.#)('#')
M68kBinarySubExprImpl(BINARY_SUB_EXPR)
M68kLiteralExprImpl(LITERAL_EXPR)
PsiElement(M68kTokenType.DECIMAL)('17')
PsiElement(M68kTokenType.-)('-')
M68kLiteralExprImpl(LITERAL_EXPR)
PsiElement(M68kTokenType.DECIMAL)('1')
PsiElement(M68kTokenType.,)(',')
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
M68kDataRegisterImpl(DATA_REGISTER)
PsiElement(M68kTokenType.DREG)('d7')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; this is the outer loop')
PsiElement(M68kTokenType.EOL)('\n')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('innerloop$')
PsiWhiteSpace(' ')
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)('a0')
PsiElement(M68kTokenType.))(')')
PsiElement(M68kTokenType.+)('+')
PsiElement(M68kTokenType.,)(',')
M68kAddressRegisterIndirectPostIncAddressingModeImpl(ADDRESS_REGISTER_INDIRECT_POST_INC_ADDRESSING_MODE)
PsiElement(M68kTokenType.()('(')
M68kAddressRegisterImpl(ADDRESS_REGISTER)
PsiElement(M68kTokenType.AREG)('a1')
PsiElement(M68kTokenType.))(')')
PsiElement(M68kTokenType.+)('+')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; copy stuff')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('dbne')
PsiWhiteSpace(' ')
M68kAsmOperandsImpl(ASM_OPERANDS)
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
M68kDataRegisterImpl(DATA_REGISTER)
PsiElement(M68kTokenType.DREG)('d7')
PsiElement(M68kTokenType.,)(',')
M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE)
M68kRefExprImpl(REF_EXPR)
PsiElement(M68kTokenType.SYMBOL)('innerloop$')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; copy more')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.skip:')
PsiWhiteSpace(' ')
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('bne')
M68kOperandSizeImpl(OPERAND_SIZE)
PsiElement(M68kTokenType.OPSIZE_BS)('.s')
PsiWhiteSpace(' ')
M68kAsmOperandsImpl(ASM_OPERANDS)
M68kAbsoluteAddressAddressingModeImpl(ABSOLUTE_ADDRESS_ADDRESSING_MODE)
M68kRefExprImpl(REF_EXPR)
PsiElement(M68kTokenType.SYMBOL)('.outerloop')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; end of chunk?')
PsiElement(M68kTokenType.EOL)('\n')
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('GlobalExit::')
PsiWhiteSpace(' ')
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
PsiElement(M68kTokenType.MNEMONIC)('rts')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label:')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('External_Label::')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label:')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace('\t')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label:')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('External_Label::')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label:')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$:')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$:')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,5 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$')
PsiElement(M68kTokenType.EOL)('\n')