From e3efc545a87c157c9d94f2d4c0779175c8d6208d Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Tue, 20 Feb 2024 22:41:33 +0100 Subject: [PATCH] Flushing current state for a release. --- README.md | 16 ++++- build.gradle | 42 +++++------ .../plugins/m68k/asm/AssemblerDirectives.kt | 4 +- .../m68k/formatter/M68kAsmAssignmentBlock.kt | 23 ++++++ .../plugins/m68k/formatter/M68kAsmBlock.kt | 33 ++++++--- .../m68k/formatter/M68kAsmCommentBlock.kt | 21 ++++++ .../plugins/m68k/formatter/M68kAsmEolBlock.kt | 9 +-- .../m68k/formatter/M68kAsmLabelBlock.kt | 9 ++- .../m68k/formatter/M68kAsmMacroDefBlock.kt | 21 ++++++ .../m68k/formatter/M68kAsmRootBlock.kt | 34 ++++++--- .../m68k/formatter/M68kAsmStatementBlock.kt | 70 +++++-------------- src/main/resources/META-INF/plugin.xml | 6 +- .../resources/formatting/mnemonics_after.asm | 39 ++++++++--- .../resources/formatting/mnemonics_before.asm | 28 ++++++-- 14 files changed, 227 insertions(+), 128 deletions(-) create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmAssignmentBlock.kt create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmCommentBlock.kt create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmMacroDefBlock.kt diff --git a/README.md b/README.md index 11184bf..33efa9a 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ If the current statement has no valid syntax, the instruction details of all mat - Switching the spaces option usually needs the caches to be invalidated. Find Usages word scanner always uses default settings, as it is not configurable per project :-/ - Unit Test coverage is not as good as it could be (ahem). +- Code flow sometimes outputs "uhm?" - Missing but planned features: - Macro evaluation on invocation - Folding @@ -164,6 +165,19 @@ are appreciated. It really is keeping me motivated to continue development. ## Changelog +### V0.10 (20-Feb-24) + +- Decided to release some features that have been sitting on my harddrive for almost two years, but never got released, + because I was unable to get that damn formatter working in a way that was acceptable (the API and the docs are easily one + the worst abominations I've come across). +- Maintenance. Updated all dependencies to the latest versions. +- New: Added semantic highlighting. Currently available for data and address registers and local labels. +- Bugfix: addq/subq for address register stated it would affect the condition codes, which it in fact doesn't. +- New: Added simple custom navigation bar. +- New: Added folding support for functions and macro definitions. +- New: Added assembler directives to code completion (only lower-case except for other directives like IF + and MACRO, which are only suggested for upper-case). + ### V0.9 (16-Aug-22) - Maintenance. Updated all dependencies to the latest versions. @@ -249,4 +263,4 @@ are appreciated. It really is keeping me motivated to continue development. ### V0.1 (20-Jul-21) -- Initial public release. \ No newline at end of file +- Initial public release. diff --git a/build.gradle b/build.gradle index 416b100..76f4a0c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,12 @@ plugins { id 'java' - id 'org.jetbrains.intellij' version '1.11.0' - id 'org.jetbrains.kotlin.jvm' version '1.8.0-RC2' + id 'org.jetbrains.intellij' version '1.17.1' + id 'org.jetbrains.kotlin.jvm' version '1.9.22' id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.12.0' } group = 'de.platon42' -version = '0.10' +version = '0.11' sourceCompatibility = 17 targetCompatibility = 17 @@ -16,18 +15,18 @@ repositories { } /* - To run tests in IntelliJ use these VM Options for run configuration + To run tests in IntelliJ use these VM Options for run configuration -ea -Didea.system.path=build/idea-sandbox/system-test -Didea.config.path=build/idea-sandbox/config-test -Didea.plugins.path=build/idea-sandbox/plugins-test */ dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' - testImplementation 'org.assertj:assertj-core:3.23.1' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' + testImplementation 'org.assertj:assertj-core:3.25.3' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2' testImplementation "org.jetbrains.kotlin:kotlin-test" testImplementation "org.jetbrains.kotlin:kotlin-reflect" - testImplementation 'org.junit.platform:junit-platform-launcher:1.9.1' + testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2' // testImplementation "org.jetbrains.kotlin:kotlin-test-junit" } @@ -38,21 +37,20 @@ intellij { } runPluginVerifier { - ideVersions = ["IC-203.6682.168", "IC-223.7571.182", // 2020.3 - 2022.3 - "CL-203.8084.11", // 2020.3 - "CL-211.7628.27", // 2021.1 - "CL-212.5712.21", // 2021.2 - "CL-213.7172.20", // 2021.3.4 - "CL-221.5921.22", // 2022.1.3 - "CL-222.4345.21", // 2022.2.4 - "CL-223.7571.171"] // 2022.3 + ideVersions = ["IC-203.6682.168", "IC-233.14015.106", // 2020.3 - 2023.3 + "CL-203.8084.11", "CL-233.14015.92"] // 2020.3 - 2023.3 + downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier" } patchPluginXml { setChangeNotes(""" -

V0.10 (undefined)

+

V0.10 (20-Feb-24)

-

Full changelog available at Github project site.

+

Full changelog available at Gitea project site.

""") } @@ -76,10 +74,6 @@ test { } } -tasks.coveralls { - dependsOn jacocoTestReport -} - jacoco { toolVersion = '0.8.8' } @@ -93,4 +87,4 @@ jacocoTestReport { publishPlugin { setToken(intellijPublishToken) -} \ No newline at end of file +} diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/asm/AssemblerDirectives.kt b/src/main/java/de/platon42/intellij/plugins/m68k/asm/AssemblerDirectives.kt index 79271d9..d0bea8e 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/asm/AssemblerDirectives.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/asm/AssemblerDirectives.kt @@ -19,7 +19,9 @@ object AssemblerDirectives { "align", "even", "odd", "cnop", "long", "dphrase", "phrase", "qphrase", "cargs", "comm", "comment", - "rsset", "clrfo", "clrso", "setfo", "setso" + "rsset", "clrfo", "clrso", "setfo", "setso", + + "rsreset", "rs.b", "rs.w", "rs.l" ) val plainDirectives: Set = setOf( diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmAssignmentBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmAssignmentBlock.kt new file mode 100644 index 0000000..42c0e70 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmAssignmentBlock.kt @@ -0,0 +1,23 @@ +package de.platon42.intellij.plugins.m68k.formatter + +import com.intellij.formatting.Alignment +import com.intellij.formatting.Block +import com.intellij.formatting.Spacing +import com.intellij.formatting.Wrap +import com.intellij.lang.ASTNode +import com.intellij.psi.codeStyle.CodeStyleSettings +import com.intellij.psi.formatter.common.AbstractBlock + +class M68kAsmAssignmentBlock( + node: ASTNode, wrap: Wrap?, alignment: Alignment?, + private val codeStyleSettings: CodeStyleSettings +) : AbstractBlock(node, wrap, alignment) { + + override fun getSpacing(child1: Block?, child2: Block): Spacing? { + return Spacing.getReadOnlySpacing() + } + + override fun isLeaf() = true + + override fun buildChildren() = emptyList() +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmBlock.kt index 1e75db9..59f8555 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmBlock.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmBlock.kt @@ -1,6 +1,9 @@ package de.platon42.intellij.plugins.m68k.formatter -import com.intellij.formatting.* +import com.intellij.formatting.Alignment +import com.intellij.formatting.Block +import com.intellij.formatting.Spacing +import com.intellij.formatting.Wrap import com.intellij.lang.ASTNode import com.intellij.psi.TokenType import com.intellij.psi.codeStyle.CodeStyleSettings @@ -9,17 +12,21 @@ import de.platon42.intellij.plugins.m68k.psi.M68kTypes class M68kAsmBlock( node: ASTNode, wrap: Wrap?, alignment: Alignment?, - private val column: Int, + val column: Int, private val codeStyleSettings: CodeStyleSettings ) : AbstractBlock(node, wrap, alignment) { - override fun getIndent() = Indent.getNoneIndent() - - private fun normalIndent(): Indent { - return IndentImpl(Indent.Type.SPACES, true, codeStyleSettings.indentOptions.INDENT_SIZE, false, false) - } - override fun getSpacing(child1: Block?, child2: Block): Spacing? { + if (child1 is M68kAsmBlock && child2 is M68kAsmBlock) { + val columnDiff = child2.column - child1.column + if (columnDiff > 0) { + var minSpaces = columnDiff * codeStyleSettings.indentOptions.INDENT_SIZE - child1.node.textLength + while (minSpaces < 1) { + minSpaces += codeStyleSettings.indentOptions.INDENT_SIZE + } + return Spacing.createSpacing(minSpaces, minSpaces, 0, false, 0) + } + } return null } @@ -27,6 +34,10 @@ class M68kAsmBlock( override fun buildChildren(): List { val subBlocks = ArrayList() + if (myNode.elementType == M68kTypes.ASM_OP) { + return subBlocks + } + var child = myNode.firstChildNode var newColumn = column while (child != null) { @@ -34,14 +45,14 @@ class M68kAsmBlock( subBlocks.add( M68kAsmBlock( child, - Wrap.createWrap(WrapType.NONE, false), - Alignment.createAlignment(), + null, + null, newColumn, codeStyleSettings ) ) if (child.elementType == M68kTypes.ASM_OP) { - newColumn++ + newColumn += 2 } } child = child.treeNext diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmCommentBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmCommentBlock.kt new file mode 100644 index 0000000..0f1fd31 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmCommentBlock.kt @@ -0,0 +1,21 @@ +package de.platon42.intellij.plugins.m68k.formatter + +import com.intellij.formatting.Block +import com.intellij.formatting.Spacing +import com.intellij.lang.ASTNode +import com.intellij.psi.codeStyle.CodeStyleSettings +import com.intellij.psi.formatter.common.AbstractBlock + +class M68kAsmCommentBlock( + node: ASTNode, + private val codeStyleSettings: CodeStyleSettings +) : AbstractBlock(node, null, null) { + + override fun getSpacing(child1: Block?, child2: Block): Spacing? { + return Spacing.getReadOnlySpacing() + } + + override fun isLeaf() = true + + override fun buildChildren() = emptyList() +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmEolBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmEolBlock.kt index f97d340..956fcd0 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmEolBlock.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmEolBlock.kt @@ -1,15 +1,10 @@ package de.platon42.intellij.plugins.m68k.formatter -import com.intellij.formatting.* +import com.intellij.formatting.Block import com.intellij.lang.ASTNode import com.intellij.psi.formatter.common.AbstractBlock -class M68kAsmEolBlock(node: ASTNode) : AbstractBlock( - node, Wrap.createWrap(WrapType.NONE, false), - Alignment.createAlignment() -) { - - override fun getIndent() = Indent.getNoneIndent() +class M68kAsmEolBlock(node: ASTNode) : AbstractBlock(node, null, null) { override fun getSpacing(child1: Block?, child2: Block) = null diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmLabelBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmLabelBlock.kt index 96e9886..e486fc8 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmLabelBlock.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmLabelBlock.kt @@ -1,6 +1,9 @@ package de.platon42.intellij.plugins.m68k.formatter -import com.intellij.formatting.* +import com.intellij.formatting.Alignment +import com.intellij.formatting.Block +import com.intellij.formatting.Spacing +import com.intellij.formatting.Wrap import com.intellij.lang.ASTNode import com.intellij.psi.codeStyle.CodeStyleSettings import com.intellij.psi.formatter.common.AbstractBlock @@ -10,10 +13,6 @@ class M68kAsmLabelBlock( private val codeStyleSettings: CodeStyleSettings ) : AbstractBlock(node, wrap, alignment) { - override fun getIndent(): Indent? { - return Indent.getAbsoluteNoneIndent() - } - override fun getSpacing(child1: Block?, child2: Block): Spacing? { return Spacing.getReadOnlySpacing() } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmMacroDefBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmMacroDefBlock.kt new file mode 100644 index 0000000..7f2f9e7 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmMacroDefBlock.kt @@ -0,0 +1,21 @@ +package de.platon42.intellij.plugins.m68k.formatter + +import com.intellij.formatting.Block +import com.intellij.formatting.Spacing +import com.intellij.lang.ASTNode +import com.intellij.psi.codeStyle.CodeStyleSettings +import com.intellij.psi.formatter.common.AbstractBlock + +class M68kAsmMacroDefBlock( + node: ASTNode, + private val codeStyleSettings: CodeStyleSettings +) : AbstractBlock(node, null, null) { + + override fun getSpacing(child1: Block?, child2: Block): Spacing? { + return Spacing.getReadOnlySpacing() + } + + override fun isLeaf() = true + + override fun buildChildren() = emptyList() +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmRootBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmRootBlock.kt index a6ff075..909caf3 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmRootBlock.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmRootBlock.kt @@ -1,22 +1,39 @@ package de.platon42.intellij.plugins.m68k.formatter -import com.intellij.formatting.* +import com.intellij.formatting.Block +import com.intellij.formatting.Indent +import com.intellij.formatting.Spacing import com.intellij.lang.ASTNode +import com.intellij.psi.PsiComment import com.intellij.psi.TokenType import com.intellij.psi.codeStyle.CodeStyleSettings import com.intellij.psi.formatter.common.AbstractBlock +import de.platon42.intellij.plugins.m68k.psi.M68kMacroDefinition import de.platon42.intellij.plugins.m68k.psi.M68kStatement import de.platon42.intellij.plugins.m68k.psi.M68kTypes class M68kAsmRootBlock(node: ASTNode, private val codeStyleSettings: CodeStyleSettings) : AbstractBlock(node, null, null) { override fun getIndent(): Indent? { - return Indent.getNoneIndent() + return Indent.getAbsoluteNoneIndent() } override fun getSpacing(child1: Block?, child2: Block): Spacing? { if (child2 is M68kAsmEolBlock) { return Spacing.createSpacing(0, 0, 0, false, 0) + //return null + } + if (child2 is M68kAsmMacroDefBlock) { + return child2.getSpacing(child1, child2) + } + if (child2 is M68kAsmCommentBlock) { + if (child1 is M68kAsmStatementBlock) { + val indentSize = codeStyleSettings.indentOptions.INDENT_SIZE + val oddIdent = indentSize - (child1.node.textLength % indentSize) + return Spacing.createSpacing(oddIdent, Integer.MAX_VALUE, 0, false, 0) + } else { + return Spacing.getReadOnlySpacing() + } } if (child2.subBlocks.isNotEmpty()) { return child2.getSpacing(child1, child2.subBlocks.first()) @@ -37,15 +54,12 @@ class M68kAsmRootBlock(node: ASTNode, private val codeStyleSettings: CodeStyleSe } else if (child.elementType != TokenType.WHITE_SPACE) { if (child.psi is M68kStatement) { subBlocks.add(M68kAsmStatementBlock(child, codeStyleSettings)) + } else if (child.psi is M68kMacroDefinition) { + subBlocks.add(M68kAsmMacroDefBlock(child, codeStyleSettings)) + } else if (child.psi is PsiComment) { + subBlocks.add(M68kAsmCommentBlock(child, codeStyleSettings)) } else { - subBlocks.add( - M68kAsmBlock( - child, - Wrap.createWrap(WrapType.NONE, false), - Alignment.createAlignment(), - 0, codeStyleSettings - ) - ) + subBlocks.add(M68kAsmBlock(child, null, null, 0, codeStyleSettings)) } } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmStatementBlock.kt b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmStatementBlock.kt index 13b7464..3313668 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmStatementBlock.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/formatter/M68kAsmStatementBlock.kt @@ -1,6 +1,8 @@ package de.platon42.intellij.plugins.m68k.formatter -import com.intellij.formatting.* +import com.intellij.formatting.Block +import com.intellij.formatting.Indent +import com.intellij.formatting.Spacing import com.intellij.lang.ASTNode import com.intellij.psi.TokenType import com.intellij.psi.codeStyle.CodeStyleSettings @@ -8,15 +10,15 @@ import com.intellij.psi.formatter.common.AbstractBlock import de.platon42.intellij.plugins.m68k.psi.* class M68kAsmStatementBlock(node: ASTNode, private val codeStyleSettings: CodeStyleSettings) : - AbstractBlock(node, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment()) { + AbstractBlock(node, null, null) { - override fun getIndent(): Indent { + override fun getIndent(): Indent? { val statement = myNode.psi as M68kStatement - if (((statement.asmInstruction != null) || (statement.preprocessorDirective != null) + if (((statement.asmInstruction != null) || (statement.asmInstruction != null) || (statement.preprocessorDirective != null) || (statement.macroCall != null)) && ((statement.localLabel == null) && (statement.globalLabel == null)) ) { - return IndentImpl(Indent.Type.SPACES, true, codeStyleSettings.indentOptions.INDENT_SIZE, false, false) + return null } else { return Indent.getAbsoluteNoneIndent() } @@ -24,22 +26,22 @@ class M68kAsmStatementBlock(node: ASTNode, private val codeStyleSettings: CodeSt override fun getSpacing(child1: Block?, child2: Block): Spacing? { if (child2 is M68kAsmBlock) { - val indentSize = codeStyleSettings.indentOptions.INDENT_SIZE - if (child1 is M68kAsmEolBlock) { - return Spacing.createSpacing(1, indentSize, 0, true, 0) + val indentSize = codeStyleSettings.indentOptions.INDENT_SIZE * child2.column + if (child1 is M68kAsmEolBlock || child1 is M68kAsmCommentBlock) { + return Spacing.createSpacing(indentSize, indentSize, 0, true, 0) } if (child1 is M68kAsmLabelBlock) { val spacesLeft = indentSize - child1.node.textLength if (spacesLeft <= 0) { - return Spacing.createSpacing(1, indentSize, 1, false, 0) + return Spacing.createSpacing(0, 0, 1, true, 0) } else { - return Spacing.createSpacing(1, spacesLeft, 0, false, 0) + return Spacing.createSpacing(spacesLeft, spacesLeft, 0, true, 0) } } - return Spacing.createSpacing(1, indentSize, 0, false, 0) + return Spacing.createSpacing(indentSize, indentSize, 0, true, 0) } - if (child2 is M68kAsmLabelBlock) { - return Spacing.createSpacing(0, 0, 0, false, 0) + if (child2 is M68kAsmLabelBlock || child2 is M68kAsmAssignmentBlock) { + return Spacing.createSpacing(0, 0, 0, true, 0) } return null } @@ -53,49 +55,15 @@ class M68kAsmStatementBlock(node: ASTNode, private val codeStyleSettings: CodeSt if (child.elementType != TokenType.WHITE_SPACE) { val element = child.psi when (element) { - is M68kAssignment -> - subBlocks.add( - M68kAsmBlock( - child, - Wrap.createWrap(WrapType.NORMAL, false), - Alignment.createAlignment(), - 0, - codeStyleSettings - ) - ) + is M68kAssignment -> subBlocks.add(M68kAsmAssignmentBlock(child, null, null, codeStyleSettings)) is M68kAsmInstruction, is M68kPreprocessorDirective, is M68kMacroCall -> - subBlocks.add( - M68kAsmBlock( - child, - Wrap.createWrap(WrapType.NORMAL, false), - Alignment.createAlignment(), - 1, - codeStyleSettings - ) - ) + subBlocks.add(M68kAsmBlock(child, null, null, 2, codeStyleSettings)) is M68kGlobalLabel, is M68kLocalLabel -> - subBlocks.add( - M68kAsmLabelBlock( - child, - Wrap.createWrap(WrapType.NONE, false), - Alignment.createAlignment(), - codeStyleSettings - ) - ) + subBlocks.add(M68kAsmLabelBlock(child, null, null, codeStyleSettings)) - - else -> - subBlocks.add( - M68kAsmBlock( - child, - Wrap.createWrap(WrapType.NONE, false), - Alignment.createAlignment(), - 1, - codeStyleSettings - ) - ) + else -> subBlocks.add(M68kAsmBlock(child, null, null, 1, codeStyleSettings)) } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 3d33a85..b56e04a 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -23,8 +23,8 @@ implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighterFactory"/> - + @@ -87,4 +87,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/formatting/mnemonics_after.asm b/src/test/resources/formatting/mnemonics_after.asm index df68218..d6f7e09 100644 --- a/src/test/resources/formatting/mnemonics_after.asm +++ b/src/test/resources/formatting/mnemonics_after.asm @@ -1,13 +1,32 @@ - moveq.l #10,d1 - add.l #10,d1 - subq.b #2,d2 - bra.s .foo - nop -.foo move.l d2,d1 - rts -.verylonglabel: stop #$2000 +FOO = 1234 +BAR = 1235 + +COUNTER SET COUNTER+1 + +FISH MACRO +.fish\@ rts + ENDM + MACRO SOUP + moveq.l #0,d0 + ENDM + +; with space + +; standalone comment + moveq.l #10,d1 ; end of line comment + FISH + add.l #10,d1 + SOUP + subq.b #2,d2 ; end of line comment + bra.s .foo + nop +.foo move.l d2,d1 + rts +.verylonglabel: + stop #$2000 .narf - moveq.l #2,d0 + moveq.l #2,d0 -globallabel: moveq.l #0,d0 +globallabel: + moveq.l #0,d0 diff --git a/src/test/resources/formatting/mnemonics_before.asm b/src/test/resources/formatting/mnemonics_before.asm index df68218..000248d 100644 --- a/src/test/resources/formatting/mnemonics_before.asm +++ b/src/test/resources/formatting/mnemonics_before.asm @@ -1,10 +1,28 @@ - moveq.l #10,d1 - add.l #10,d1 - subq.b #2,d2 - bra.s .foo +FOO = 1234 +BAR = 1235 + +COUNTER SET COUNTER+1 + +FISH MACRO +.fish\@ rts + ENDM + MACRO SOUP + moveq.l #0,d0 + ENDM + +; with space + +; standalone comment + + moveq.l #10,d1; end of line comment + FISH + add.l #10,d1 + SOUP + subq.b #2,d2 ; end of line comment + bra.s .foo nop .foo move.l d2,d1 - rts + rts .verylonglabel: stop #$2000 .narf