Compare commits
No commits in common. "main" and "v0.5" have entirely different histories.
139
README.md
139
README.md
@ -1,4 +1,4 @@
|
|||||||
# MC68000 Assembly Language Plugin
|
# MC68000 Assembly Language Plugin [](https://travis-ci.com/chrisly42/mc68000-asm-plugin) [](https://coveralls.io/github/chrisly42/mc68000-asm-plugin?branch=main)
|
||||||
|
|
||||||
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
|
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
|
||||||
|
|
||||||
@ -6,31 +6,30 @@ _MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ
|
|||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
|
|
||||||
This plugin delivers support for MC680xx assembly language files ([VAsm](http://sun.hasenbraten.de/vasm/) / DevPac-Style).
|
This plugin delivers support for MC68000 assembly language files ([VAsm](http://sun.hasenbraten.de/vasm/) / DevPac-Style).
|
||||||
|
|
||||||
It adds a language parser with syntax highlighting, referencing and refactoring support, and a few more features.
|
It adds a language parser with syntax highlighting, referencing and refactoring support, and a few more features.
|
||||||
|
|
||||||
I'm an Amiga retro democoder (among other things), and the lack of a plugin for M68k was the motivation to write one. Also, diving deep into custom language
|
I'm an Amiga retro democoder, and the lack of a plugin for M68k was the motivation to write one. Also, diving deep into custom language plugins has a steep
|
||||||
plugins has a steep learning curve.
|
learning curve.
|
||||||
|
|
||||||
When I started the plugin in July 2021, I was unaware of the [M68k plugin efforts by Jetbrains employee Yann Cébron](https://github.com/YannCebron/m68kplugin)
|
When I started the plugin in July 2021, I was not aware of the [M68k plugin efforts by Jetbrains employee Yann Cébron](https://github.com/YannCebron/m68kplugin)
|
||||||
who has been working on the same topic for quite some time. *On 01-Oct-21, he released
|
who has been working on the same topic for quite some time. At the time of writing, his plugin however, has not been release yet. Nevertheless, it has a lot of
|
||||||
his [first public version](https://plugins.jetbrains.com/plugin/17712-motorola-68000-series-assembler).* Check it out. You can install both plugins at the same
|
awesome features and is pretty advanced. Check it out. You can install both plugins at the same time and see what suits you more.
|
||||||
time and see what suits you more.
|
|
||||||
|
|
||||||
Big kudos to Yann -- a few features were _inspired_ by his code.
|
Big kudos to Yann -- a few features were _inspired_ by his code.
|
||||||
|
|
||||||
My plugin, on the other hand, is still pretty basic and is the result of a few weeks of work. I released the first versions because I think it's "good enough"
|
My plugin, on the other hand, is still pretty basic and is the result of a few weeks of work. I released a really early first version it because I think it's "
|
||||||
to get started, and I can return to demo coding with its current state.
|
good enough" to get started, and I can return to demo coding with its current state.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Parser / Lexer for MC680xx assembly language files in VAsm / DevPac style
|
- Parser / Lexer for MC68000 (yes, only 68000 right now!) assembly language files in VAsm / DevPac style
|
||||||
- Validates the assembly syntax against the 68000/68010 ISA and 68020+ addressing modes (no complete >68020 support yet!)
|
- Inspection for validating the syntax of the 68000 ISA.
|
||||||
- Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!)
|
- Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!)
|
||||||
- Mnemonics code completion
|
- Mnemonics code completion
|
||||||
- Symbols / labels / macros code completion
|
- Symbols / Labels / Macros code completion
|
||||||
- References / refactoring support for local and global labels, symbol assignments, and macros.
|
- References / Refactoring support for local and global labels, symbol assignments, and macros.
|
||||||
- Simple register usage flow (hover over register or press F1 for full flow)
|
- Simple register usage flow (hover over register or press F1 for full flow)
|
||||||
- Brace matching
|
- Brace matching
|
||||||
- Quote handler
|
- Quote handler
|
||||||
@ -40,10 +39,7 @@ to get started, and I can return to demo coding with its current state.
|
|||||||
|
|
||||||
### Inspections
|
### Inspections
|
||||||
|
|
||||||
The plugin provides a few inspections for code analysis. An error or warning can be suppressed by placing a `; suppress <InspectionName>` comment either on an
|
#### M68kSyntaxInspection - Assembly instruction validity
|
||||||
end of line comment behind the statement or in a full line comment above the statement.
|
|
||||||
|
|
||||||
#### M68kSyntax - Assembly instruction validity
|
|
||||||
|
|
||||||
Checks the validity of the current instruction. If an instruction is not recognized, you may get one of the following errors:
|
Checks the validity of the current instruction. If an instruction is not recognized, you may get one of the following errors:
|
||||||
|
|
||||||
@ -58,7 +54,7 @@ Checks the validity of the current instruction. If an instruction is not recogni
|
|||||||
- Operation size _(.b,.w,.l)_ unsupported for _mnemonic_
|
- Operation size _(.b,.w,.l)_ unsupported for _mnemonic_
|
||||||
- Operation size _(.b,.w,.l)_ unsupported (should be _(.b,.w,.l)_)
|
- Operation size _(.b,.w,.l)_ unsupported (should be _(.b,.w,.l)_)
|
||||||
|
|
||||||
#### M68kDeadWrite - Dead writes to registers
|
#### M68kDeadWriteInspection - Dead writes to registers
|
||||||
|
|
||||||
This inspection looks at register writes and tries to find instructions that renders a write moot because it was overwritten by another instruction before
|
This inspection looks at register writes and tries to find instructions that renders a write moot because it was overwritten by another instruction before
|
||||||
anything useful was done with it.
|
anything useful was done with it.
|
||||||
@ -69,7 +65,7 @@ Analysis is aborted at global labels, flow control instructions, directives
|
|||||||
The inspection tries to take condition code changing into account and puts out a weak warning if the statement merely changes condition codes before the
|
The inspection tries to take condition code changing into account and puts out a weak warning if the statement merely changes condition codes before the
|
||||||
contents of the register are overwritten. In this case, it is sometimes better to replace `move` by `tst`.
|
contents of the register are overwritten. In this case, it is sometimes better to replace `move` by `tst`.
|
||||||
|
|
||||||
#### M68kUnexpectedConditionalInstruction - Unaffected condition codes before conditional instruction
|
#### M68kUnexpectedConditionalInstructionInspection - Unaffected condition codes before conditional instruction
|
||||||
|
|
||||||
Especially for novice coders, it is not clear that some instructions do not affect the condition codes for a subsequent condition branch or `scc` instruction.
|
Especially for novice coders, it is not clear that some instructions do not affect the condition codes for a subsequent condition branch or `scc` instruction.
|
||||||
`movea`, `adda` and `suba` come to my mind.
|
`movea`, `adda` and `suba` come to my mind.
|
||||||
@ -79,27 +75,13 @@ The inspection will report such suspicious instruction sequences.
|
|||||||
However, this does not need to be a programming error. Advanced coders sometimes make use of the fact that instructions do not change condition codes and thus
|
However, this does not need to be a programming error. Advanced coders sometimes make use of the fact that instructions do not change condition codes and thus
|
||||||
optimize the order of execution.
|
optimize the order of execution.
|
||||||
|
|
||||||
#### M68kUnresolvedReference - Unresolved label/symbol/macro reference
|
|
||||||
|
|
||||||
Points out unresolved references such for global and local labels, macros or symbols. Right now, missing symbol and global label references are shown only as
|
|
||||||
weak warnings as missing macro evaluation will not resolve symbols defined via `STRUCT` macros.
|
|
||||||
|
|
||||||
### Documentation provider
|
### Documentation provider
|
||||||
|
|
||||||
#### M68kSymbolDefinition
|
#### M68kSymbolDefinitionDocumentationProvider
|
||||||
|
|
||||||
Provides the assigned value of a `=`, `set` or `equ` symbol definition when hovering over a symbol.
|
Provides the assigned value of a `=`, `set` or `equ` symbol definition when hovering over a symbol.
|
||||||
|
|
||||||
#### M68kMacroDefinition
|
#### M68kRegisterFlowDocumentationProvider
|
||||||
|
|
||||||
When used over a macro invocation, shows the expanded macro contents (only the \1 to \9 and \a to \z are expanded according to the parameters used).
|
|
||||||
|
|
||||||
#### M68kLabelDefinition
|
|
||||||
|
|
||||||
Shows the comments above the label (local or global) and an end-of-line comment, if available. If the first statement after the label is a directive
|
|
||||||
like `include` or `dc.b`, it will be shown, too.
|
|
||||||
|
|
||||||
#### M68kRegisterFlow
|
|
||||||
|
|
||||||
When hovering over or placing the cursor at a data or address register, the documentation will scan through the instructions backwards and forwards and will
|
When hovering over or placing the cursor at a data or address register, the documentation will scan through the instructions backwards and forwards and will
|
||||||
show all read, changes of the register contents. It does this until an instruction is found that defines (sets) the contents of the register
|
show all read, changes of the register contents. It does this until an instruction is found that defines (sets) the contents of the register
|
||||||
@ -110,7 +92,7 @@ The analysis ignores all code flow instructions and might be inaccurate for bran
|
|||||||
The documentation will search up to 100 instructions in each direction, but only four when hovering over the register
|
The documentation will search up to 100 instructions in each direction, but only four when hovering over the register
|
||||||
(so if you need the whole analysis, use the documentation window).
|
(so if you need the whole analysis, use the documentation window).
|
||||||
|
|
||||||
#### M68kInstruction
|
#### M68kInstructionDocumentationProvider
|
||||||
|
|
||||||
When hovering over a mnemonic, it will show a short description of the assembly instruction.
|
When hovering over a mnemonic, it will show a short description of the assembly instruction.
|
||||||
|
|
||||||
@ -122,18 +104,13 @@ If the current statement has no valid syntax, the instruction details of all mat
|
|||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
- `Find Usages` always shows _"Unclassified"_ though it shouldn't (?)
|
- `Find Usages` always shows _"Unclassified"_ though it shouldn't (?)
|
||||||
- `END` detection was breaking parsing, so this is disabled for now until I find a working solution.
|
|
||||||
- Macro invocations are not yet evaluated, thus no referencing to symbols defined via macros (e.g. `STRUCT`).
|
- Macro invocations are not yet evaluated, thus no referencing to symbols defined via macros (e.g. `STRUCT`).
|
||||||
- Scoping for global symbols, labels and macros is currently the whole project.
|
- No support for includes. Scoping is for global symbols and labels is currently the whole project.
|
||||||
- No support for register replacement (e.g. registers replaced by `EQUR` or `EQURL` will cause syntax errors)
|
- No support for register replacement (e.g. registers replaced by `EQUR` or `EQURL` will cause syntax errors)
|
||||||
- No support for other processor instructions and FPU. Yet.
|
- While the Lexer supports the -spaces option (where a space introduces a comment), this cannot be configured yet (default is off).
|
||||||
- The pretty esoteric use of `ZPC`, `ZA0-ZA7` or `ZSP` for zero (omitted) address in 68020 addressing modes is unsupported.
|
- No support for other processor instructions, FPU or 68020+ address modes.
|
||||||
- Devpac allowed shuffling of (base) displacement and other parameters inside the new syntax (68020+) brackets. Well, I don't. Only strict `(bd,An,Xn*s)` or
|
|
||||||
`([bd,An],Xn*s,od)` order allowed.
|
|
||||||
- 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).
|
- Unit Test coverage is not as good as it could be (ahem).
|
||||||
- Code flow sometimes outputs "uhm?"
|
- `opt` keyword needs special treatment and will currently show a parsing error.
|
||||||
- Missing but planned features:
|
- Missing but planned features:
|
||||||
- Macro evaluation on invocation
|
- Macro evaluation on invocation
|
||||||
- Folding
|
- Folding
|
||||||
@ -150,73 +127,23 @@ to highlight the same address and data registers while editing (see new `View ->
|
|||||||
|
|
||||||
## Development notice
|
## Development notice
|
||||||
|
|
||||||
This plugin has been written in Kotlin 1.9 using Grammar-Kit.
|
This plugin has been written in Kotlin 1.5 using Grammar-Kit.
|
||||||
|
|
||||||
It is probably the only plugin (besides [Cajon](https://git.platon42.de/chrisly42/cajon-plugin) from the same author) that uses JUnit 5 Jupiter for unit testing
|
It is probably the only plugin (besides [Cajon](https://github.com/chrisly42/cajon-plugin) from the same author) that uses JUnit 5 Jupiter for unit testing so
|
||||||
so
|
|
||||||
far (or at least the only one I'm aware of ;) ). The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to
|
far (or at least the only one I'm aware of ;) ). The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to
|
||||||
make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for your projects (with attribution).
|
make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for your projects (with attribution).
|
||||||
|
|
||||||
## Feedback
|
## Private TODO list
|
||||||
|
|
||||||
I guess there are currently over 500 users of this plugin and while I wrote this mainly for myself, I'm only doing this in my spare time.
|
- code completion suggestion for unresolved local labels, global labels and symbols
|
||||||
|
- support `include` directive
|
||||||
Feedback and [rating](https://plugins.jetbrains.com/plugin/17268-mc68000-assembly-language-support/reviews)
|
- support `opt` directive
|
||||||
are appreciated. It really is keeping me motivated to continue development.
|
- suppression support via comments
|
||||||
|
- inspection: Unresolved local label
|
||||||
|
- inspection: Unresolved macro
|
||||||
|
|
||||||
## Changelog
|
## 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.
|
|
||||||
- Bugfix: Fixed condition code for `asr/lsr/lsl`, which is has a different behaviour for V flag than `asl`.
|
|
||||||
- Bugfix: Fixed 'Unknown op size' exception when uppercase sizes were used.
|
|
||||||
- Bugfix: Refactoring was broken for newer IDE versions, at least for me, this now works again by unknown magic.
|
|
||||||
|
|
||||||
### V0.8 (15-Oct-21)
|
|
||||||
|
|
||||||
- New: Support for MC68020+ addressing modes! However, MC68020+ specific instructions have not been added yet.
|
|
||||||
- New: Full support for MC68010 ISA (`movec`, `moves` and new special registers `SFC` and `DFC`).
|
|
||||||
- Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too.
|
|
||||||
- Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does.
|
|
||||||
- New: Macro definition / invocation documentation provider that even tries to expand macros.
|
|
||||||
- New: Added Language settings page with one option so far (-spaces option).
|
|
||||||
- New: Added some more settings for maximum parsed lines inside a macro and maximum displayed lines of code for documentation.
|
|
||||||
|
|
||||||
### V0.7 (26-Sep-21)
|
|
||||||
|
|
||||||
- Bugfix: `btst` with pc-relative and weird immediate mode was missing (courtesy of Yann).
|
|
||||||
- Bugfix: `movem` with pc-relative mode was missing for weird immediate mode (courtesy of Yann).
|
|
||||||
- Bugfix: Special registers for address mode matching only worked with lower case register names (courtesy of Yann).
|
|
||||||
- Enhancement: Assembler syntax with implicit immediate 1 for shifts and rotations no longer cause syntax errors (courtesy of Yann).
|
|
||||||
- Enhancement: Documentation for instruction with special register shows specific register expected.
|
|
||||||
- New: Added documentation provider info for global labels. Shows directives and comments above.
|
|
||||||
- Bugfix: Fixed BNF for labels with preprocessor statements.
|
|
||||||
- Disabled: `END` detection was breaking parsing, causing havoc.
|
|
||||||
|
|
||||||
### V0.6 (09-Aug-21)
|
|
||||||
|
|
||||||
- Enhancement: `opt` and several other directives (`printt`, `fail` etc.) no longer causes a syntax error when unquoted.
|
|
||||||
- Enhancement: `include`, `incdir` and `incbin` and `output` with `<pathname>` quotes no longer cause syntax error.
|
|
||||||
- New: Files in `include` directives can be referenced and renamed/refactored.
|
|
||||||
- New: Code completion for local label definitions, suggesting undefined labels already referenced.
|
|
||||||
- New: Added inspection suppression possibility and quickfix.
|
|
||||||
- New: Added inspection for unresolved symbols, macros and labels.
|
|
||||||
- Enhancement: 'END' directive stops parsing.
|
|
||||||
|
|
||||||
### V0.5 (06-Aug-21)
|
### V0.5 (06-Aug-21)
|
||||||
|
|
||||||
- Bugfix: `movem` ISA was wrong regarding the `movem.w <ea>,<registerlist>` (sign extends registers).
|
- Bugfix: `movem` ISA was wrong regarding the `movem.w <ea>,<registerlist>` (sign extends registers).
|
||||||
@ -248,7 +175,7 @@ are appreciated. It really is keeping me motivated to continue development.
|
|||||||
- Enhancement: Macro definitions are now word and stub indexed, macro calls reference to definition.
|
- Enhancement: Macro definitions are now word and stub indexed, macro calls reference to definition.
|
||||||
- New: Macro definition refactoring and find usages support.
|
- New: Macro definition refactoring and find usages support.
|
||||||
- Enhancement: Structural View also shows macro definitions.
|
- Enhancement: Structural View also shows macro definitions.
|
||||||
- Bugfix: Missing `REPT` and `ENDR` assembler directives added.
|
- Bugfix: Missing REPT and ENDR assembler directives added.
|
||||||
- Cosmetics: Changed or added some icons at various places.
|
- Cosmetics: Changed or added some icons at various places.
|
||||||
- Performance: Reference search for global labels and symbols now uses stub index.
|
- Performance: Reference search for global labels and symbols now uses stub index.
|
||||||
- Compatibility: Restored compatibility with IDE versions < 2021.1.
|
- Compatibility: Restored compatibility with IDE versions < 2021.1.
|
||||||
|
81
build.gradle
81
build.gradle
@ -1,14 +1,15 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.jetbrains.intellij' version '1.17.1'
|
id 'org.jetbrains.intellij' version '1.1.3'
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
|
id 'org.jetbrains.kotlin.jvm' version '1.5.21'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
|
id 'com.github.kt3k.coveralls' version '2.11.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'de.platon42'
|
group = 'de.platon42'
|
||||||
version = '0.10'
|
version = '0.5'
|
||||||
sourceCompatibility = 17
|
sourceCompatibility = "1.8"
|
||||||
targetCompatibility = 17
|
targetCompatibility = "1.8"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -21,44 +22,67 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||||
testImplementation 'org.assertj:assertj-core:3.25.3'
|
testImplementation "org.assertj:assertj-core:3.20.2"
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0-M1'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0-M1'
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||||
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2'
|
|
||||||
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileKotlin {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
freeCompilerArgs += "-Xjvm-default=all"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileTestKotlin {
|
||||||
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
setVersion("2022.3") // LATEST-EAP-SNAPSHOT
|
setVersion("2021.2") // LATEST-EAP-SNAPSHOT
|
||||||
setUpdateSinceUntilBuild(false)
|
setUpdateSinceUntilBuild(false)
|
||||||
// setPlugins(["com.intellij.java"])
|
// setPlugins(["com.intellij.java"])
|
||||||
}
|
}
|
||||||
|
|
||||||
runPluginVerifier {
|
runPluginVerifier {
|
||||||
ideVersions = ["IC-203.6682.168", "IC-233.14015.106", // 2020.3 - 2023.3
|
ideVersions = ["IC-203.6682.168", "IC-212.4746.92", // 2020.3 - 2021.2
|
||||||
"CL-203.8084.11", "CL-233.14015.92"] // 2020.3 - 2023.3
|
"CL-203.5981.166", "CL-203.8084.11", // 2020.3
|
||||||
|
"CL-211.6693.114", "CL-211.7628.27", // 2021.1
|
||||||
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier"
|
"CL-212.4746.93"] // 2021.2
|
||||||
|
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea"
|
||||||
}
|
}
|
||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
setChangeNotes("""
|
setChangeNotes("""
|
||||||
<h4>V0.10 (20-Feb-24)</h4>
|
<h4>V0.5 (06-Aug-21)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Decided to release some features that have been sitting on my harddrive for almost two years, but never got released,
|
<li>Bugfix: movem ISA was wrong regarding movem.w <ea>,<registerlist> (sign extends registers).
|
||||||
because I was unable to get that damn formatter working in a way that was acceptable (the API and the docs are easily one
|
<li>Cosmetics: Changed Register Flow Documentation wording from 'reads' to 'uses' and from 'modifies' to 'changes'.
|
||||||
the worst abominations I've come across).
|
<li>Bugfix: Minor fix for `andi/eori/ori to ccr` which were not byte sized in ISA.
|
||||||
<li>Maintenance. Updated all dependencies to the latest versions.
|
<li>Bugfix: Added alternate condition code tests HS (=CC) and LO (=CS).
|
||||||
<li>New: Added semantic highlighting. Currently available for data and address registers and local labels.
|
<li>Performance: Optimized mnemonic lookup.
|
||||||
<li>Bugfix: addq/subq for address register stated it would affect the condition codes, which it in fact doesn't.
|
<li>Enhancement: Reworked Instruction Documentation provider, now shows condition codes.
|
||||||
<li>New: Added simple custom navigation bar.
|
<li>Bugfix: In ISA exg is no longer treated as setting a definitive value.
|
||||||
<li>New: Added folding support for functions and macro definitions.
|
<li>New: Added inspection to find dead writes to registers!
|
||||||
<li>New: Added assembler directives to code completion (only lower-case except for other directives like IF
|
<li>New: Added inspection to warn about unexpected condition code unaffecting instructions before conditional instructions.
|
||||||
and MACRO, which are only suggested for upper-case).
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>Full changelog available at <a href="https://git.platon42.de/chrisly42/mc68000-asm-plugin#changelog">Gitea project site</a>.</p>
|
<h4>V0.4 (03-Aug-21)</h4>
|
||||||
|
<ul>
|
||||||
|
<li>Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3.
|
||||||
|
<li>Enhancement: Added Structure View filters.
|
||||||
|
<li>New: Added inspection to validate the correctness of a MC68000 instruction regarding operation size and address modes.
|
||||||
|
<li>Bugfix: Added several missing assembler directives (opt, machine, etc.).
|
||||||
|
<li>Bugfix: Uppercase hexadecimal literals were not parsed (JFlex bug?).
|
||||||
|
<li>Bugfix: Interpretation of register lists was wrong in BNF.
|
||||||
|
<li>New: Added Documentation Provider for symbol definitions (shows assigned declaration).
|
||||||
|
<li>New: Added Documentation Provider for mnemonics (simple version, generated out of ISA information).
|
||||||
|
<li>Bugfix: Macro definitions with colons and without space supported (as found in P61a source).
|
||||||
|
<li>New: When asking for documentation on registers, a code flow analysis is done. Cool stuff!
|
||||||
|
</ul>
|
||||||
|
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,13 +93,10 @@ test {
|
|||||||
testLogging {
|
testLogging {
|
||||||
events "passed", "skipped", "failed"
|
events "passed", "skipped", "failed"
|
||||||
}
|
}
|
||||||
runIde {
|
|
||||||
jvmArgs '--add-exports', 'java.base/jdk.internal.vm=ALL-UNNAMED'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion = '0.8.8'
|
toolVersion = '0.8.7'
|
||||||
}
|
}
|
||||||
|
|
||||||
jacocoTestReport {
|
jacocoTestReport {
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
17
plans.txt
17
plans.txt
@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
Formatting:
|
|
||||||
- dc.w statements: Pressing return will automatically add dc.w in next line (plus tabs)
|
|
||||||
|
|
||||||
Showing of used registers in selection
|
|
||||||
|
|
||||||
Actions:
|
|
||||||
- Replace constant by symbol (with suggestion)
|
|
||||||
- Converting of hex values into decimal values and vice versa
|
|
||||||
- convert new style to old style
|
|
||||||
- convert old style to new style
|
|
||||||
- simplify explicit mnemonics (e.g. movea)
|
|
||||||
|
|
||||||
Marker:
|
|
||||||
- go to source register setter
|
|
||||||
- go to target register setter
|
|
||||||
- Can we add "find declaration to go for registers"
|
|
File diff suppressed because it is too large
Load Diff
@ -40,10 +40,8 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
create_token_set_(ADDRESS_REGISTER, DATA_REGISTER, REGISTER, SPECIAL_REGISTER),
|
create_token_set_(ADDRESS_REGISTER, DATA_REGISTER, REGISTER, SPECIAL_REGISTER),
|
||||||
create_token_set_(ABSOLUTE_ADDRESS_ADDRESSING_MODE, ADDRESSING_MODE, ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_ADDRESSING_MODE,
|
create_token_set_(ABSOLUTE_ADDRESS_ADDRESSING_MODE, ADDRESSING_MODE, ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_ADDRESSING_MODE,
|
||||||
ADDRESS_REGISTER_INDIRECT_POST_INC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE,
|
ADDRESS_REGISTER_INDIRECT_POST_INC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE,
|
||||||
ADDRESS_REGISTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE, DATA_REGISTER_DIRECT_ADDRESSING_MODE,
|
ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE, DATA_REGISTER_DIRECT_ADDRESSING_MODE, IMMEDIATE_DATA,
|
||||||
IMMEDIATE_DATA, MEMORY_INDIRECT_ADDRESSING_MODE, MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE, MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE,
|
PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE, PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE,
|
||||||
PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE, PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE,
|
|
||||||
PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE, PROGRAM_COUNTER_MEMORY_INDIRECT_ADDRESSING_MODE, PROGRAM_COUNTER_MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE, PROGRAM_COUNTER_MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE,
|
|
||||||
REGISTER_LIST_ADDRESSING_MODE, SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE),
|
REGISTER_LIST_ADDRESSING_MODE, SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE),
|
||||||
create_token_set_(BINARY_ADD_EXPR, BINARY_BITWISE_AND_EXPR, BINARY_BITWISE_OR_EXPR, BINARY_BITWISE_XOR_EXPR,
|
create_token_set_(BINARY_ADD_EXPR, BINARY_BITWISE_AND_EXPR, BINARY_BITWISE_OR_EXPR, BINARY_BITWISE_XOR_EXPR,
|
||||||
BINARY_CMP_EQ_EXPR, BINARY_CMP_GE_EXPR, BINARY_CMP_GT_EXPR, BINARY_CMP_LE_EXPR,
|
BINARY_CMP_EQ_EXPR, BINARY_CMP_GE_EXPR, BINARY_CMP_GT_EXPR, BINARY_CMP_LE_EXPR,
|
||||||
@ -212,37 +210,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L (internalBaseDisplacementOption1|internalBaseDisplacementOption2|internalBaseDisplacementOption3)? ROUND_R
|
|
||||||
public static boolean AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, ADDRESS_REGISTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokenFast(b, ROUND_L);
|
|
||||||
r = r && AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode_1(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (internalBaseDisplacementOption1|internalBaseDisplacementOption2|internalBaseDisplacementOption3)?
|
|
||||||
private static boolean AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode_1")) return false;
|
|
||||||
AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// internalBaseDisplacementOption1|internalBaseDisplacementOption2|internalBaseDisplacementOption3
|
|
||||||
private static boolean AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
r = internalBaseDisplacementOption1(b, l + 1);
|
|
||||||
if (!r) r = internalBaseDisplacementOption2(b, l + 1);
|
|
||||||
if (!r) r = internalBaseDisplacementOption3(b, l + 1);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// ROUND_L (expr SEPARATOR)? AddressRegister SEPARATOR IndexRegister ROUND_R
|
// ROUND_L (expr SEPARATOR)? AddressRegister SEPARATOR IndexRegister ROUND_R
|
||||||
public static boolean AddressRegisterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) {
|
public static boolean AddressRegisterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) {
|
||||||
@ -327,14 +294,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
// | ProgramCounterIndirectWithDisplacementOldAddressingMode
|
// | ProgramCounterIndirectWithDisplacementOldAddressingMode
|
||||||
// | AddressRegisterIndirectWithIndexOldAddressingMode
|
// | AddressRegisterIndirectWithIndexOldAddressingMode
|
||||||
// | ProgramCounterIndirectWithIndexOldAddressingMode
|
// | ProgramCounterIndirectWithIndexOldAddressingMode
|
||||||
// | AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode
|
|
||||||
// | ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode
|
|
||||||
// | MemoryIndirectAddressingMode
|
|
||||||
// | ProgramCounterMemoryIndirectAddressingMode
|
|
||||||
// | MemoryIndirectPostIndexedAddressingMode
|
|
||||||
// | ProgramCounterMemoryIndirectPostIndexedAddressingMode
|
|
||||||
// | MemoryIndirectPreIndexedAddressingMode
|
|
||||||
// | ProgramCounterMemoryIndirectPreIndexedAddressingMode
|
|
||||||
// | SpecialRegisterDirectAddressingMode
|
// | SpecialRegisterDirectAddressingMode
|
||||||
// | DataRegisterDirectAddressingMode
|
// | DataRegisterDirectAddressingMode
|
||||||
// | AddressRegisterDirectAddressingMode
|
// | AddressRegisterDirectAddressingMode
|
||||||
@ -356,14 +315,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
if (!r) r = ProgramCounterIndirectWithDisplacementOldAddressingMode(b, l + 1);
|
if (!r) r = ProgramCounterIndirectWithDisplacementOldAddressingMode(b, l + 1);
|
||||||
if (!r) r = AddressRegisterIndirectWithIndexOldAddressingMode(b, l + 1);
|
if (!r) r = AddressRegisterIndirectWithIndexOldAddressingMode(b, l + 1);
|
||||||
if (!r) r = ProgramCounterIndirectWithIndexOldAddressingMode(b, l + 1);
|
if (!r) r = ProgramCounterIndirectWithIndexOldAddressingMode(b, l + 1);
|
||||||
if (!r) r = AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = MemoryIndirectAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = ProgramCounterMemoryIndirectAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = MemoryIndirectPostIndexedAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = ProgramCounterMemoryIndirectPostIndexedAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = MemoryIndirectPreIndexedAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = ProgramCounterMemoryIndirectPreIndexedAddressingMode(b, l + 1);
|
|
||||||
if (!r) r = SpecialRegisterDirectAddressingMode(b, l + 1);
|
if (!r) r = SpecialRegisterDirectAddressingMode(b, l + 1);
|
||||||
if (!r) r = DataRegisterDirectAddressingMode(b, l + 1);
|
if (!r) r = DataRegisterDirectAddressingMode(b, l + 1);
|
||||||
if (!r) r = AddressRegisterDirectAddressingMode(b, l + 1);
|
if (!r) r = AddressRegisterDirectAddressingMode(b, l + 1);
|
||||||
@ -474,25 +425,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// expr DataWidth?
|
|
||||||
public static boolean BaseDisplacement(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "BaseDisplacement")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, BASE_DISPLACEMENT, "<base displacement>");
|
|
||||||
r = expr(b, l + 1, -1);
|
|
||||||
r = r && BaseDisplacement_1(b, l + 1);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DataWidth?
|
|
||||||
private static boolean BaseDisplacement_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "BaseDisplacement_1")) return false;
|
|
||||||
DataWidth(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// DataRegister | AddressRegister
|
// DataRegister | AddressRegister
|
||||||
static boolean DataOrAddressRegister(PsiBuilder b, int l) {
|
static boolean DataOrAddressRegister(PsiBuilder b, int l) {
|
||||||
@ -600,14 +532,13 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// DataOrAddressRegister DataWidth? (OP_AR_MUL IndexScale)?
|
// DataOrAddressRegister DataWidth?
|
||||||
public static boolean IndexRegister(PsiBuilder b, int l) {
|
public static boolean IndexRegister(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "IndexRegister")) return false;
|
if (!recursion_guard_(b, l, "IndexRegister")) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
Marker m = enter_section_(b, l, _NONE_, INDEX_REGISTER, "<index register>");
|
Marker m = enter_section_(b, l, _NONE_, INDEX_REGISTER, "<index register>");
|
||||||
r = DataOrAddressRegister(b, l + 1);
|
r = DataOrAddressRegister(b, l + 1);
|
||||||
r = r && IndexRegister_1(b, l + 1);
|
r = r && IndexRegister_1(b, l + 1);
|
||||||
r = r && IndexRegister_2(b, l + 1);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
exit_section_(b, l, m, r, false, null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -619,46 +550,23 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (OP_AR_MUL IndexScale)?
|
|
||||||
private static boolean IndexRegister_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "IndexRegister_2")) return false;
|
|
||||||
IndexRegister_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OP_AR_MUL IndexScale
|
|
||||||
private static boolean IndexRegister_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "IndexRegister_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeToken(b, OP_AR_MUL);
|
|
||||||
r = r && IndexScale(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// expr
|
// AsmInstruction | MacroCall
|
||||||
public static boolean IndexScale(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "IndexScale")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, INDEX_SCALE, "<scale value>");
|
|
||||||
r = expr(b, l + 1, -1);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// AsmInstruction | MacroCall | PreprocessorDirective
|
|
||||||
static boolean Instruction(PsiBuilder b, int l) {
|
static boolean Instruction(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "Instruction")) return false;
|
if (!recursion_guard_(b, l, "Instruction")) return false;
|
||||||
|
if (!nextTokenIs(b, "", MACRO_INVOCATION, MNEMONIC)) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
r = AsmInstruction(b, l + 1);
|
r = AsmInstruction(b, l + 1);
|
||||||
if (!r) r = MacroCall(b, l + 1);
|
if (!r) r = MacroCall(b, l + 1);
|
||||||
if (!r) r = PreprocessorDirective(b, l + 1);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ********************************************************** */
|
||||||
|
// Instruction
|
||||||
|
static boolean InstructionOnly(PsiBuilder b, int l) {
|
||||||
|
return Instruction(b, l + 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// LocalLabel | GlobalLabel
|
// LocalLabel | GlobalLabel
|
||||||
static boolean Label(PsiBuilder b, int l) {
|
static boolean Label(PsiBuilder b, int l) {
|
||||||
@ -671,13 +579,13 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// LabelWithInstruction | LabelOnly | Instruction
|
// LabelWithInstruction | LabelOnly | InstructionOnly
|
||||||
static boolean LabelInsts(PsiBuilder b, int l) {
|
static boolean LabelInsts(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "LabelInsts")) return false;
|
if (!recursion_guard_(b, l, "LabelInsts")) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
r = LabelWithInstruction(b, l + 1);
|
r = LabelWithInstruction(b, l + 1);
|
||||||
if (!r) r = LabelOnly(b, l + 1);
|
if (!r) r = LabelOnly(b, l + 1);
|
||||||
if (!r) r = Instruction(b, l + 1);
|
if (!r) r = InstructionOnly(b, l + 1);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,193 +751,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
public static boolean MemoryIndirectAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, MEMORY_INDIRECT_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokens(b, 0, ROUND_L, SQUARE_L);
|
|
||||||
r = r && MemoryIndirectAddressingMode_2(b, l + 1);
|
|
||||||
r = r && AddressRegister(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SQUARE_R);
|
|
||||||
r = r && MemoryIndirectAddressingMode_5(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean MemoryIndirectAddressingMode_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectAddressingMode_2")) return false;
|
|
||||||
MemoryIndirectAddressingMode_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean MemoryIndirectAddressingMode_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectAddressingMode_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR OuterDisplacement)?
|
|
||||||
private static boolean MemoryIndirectAddressingMode_5(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectAddressingMode_5")) return false;
|
|
||||||
MemoryIndirectAddressingMode_5_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR OuterDisplacement
|
|
||||||
private static boolean MemoryIndirectAddressingMode_5_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectAddressingMode_5_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && OuterDisplacement(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L (SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
public static boolean MemoryIndirectPostIndexedAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokenFast(b, ROUND_L);
|
|
||||||
r = r && MemoryIndirectPostIndexedAddressingMode_1(b, l + 1);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
r = r && MemoryIndirectPostIndexedAddressingMode_3(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR)?
|
|
||||||
private static boolean MemoryIndirectPostIndexedAddressingMode_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1")) return false;
|
|
||||||
MemoryIndirectPostIndexedAddressingMode_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR
|
|
||||||
private static boolean MemoryIndirectPostIndexedAddressingMode_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SQUARE_L);
|
|
||||||
r = r && MemoryIndirectPostIndexedAddressingMode_1_0_1(b, l + 1);
|
|
||||||
r = r && consumeTokens(b, 0, SQUARE_R, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2
|
|
||||||
private static boolean MemoryIndirectPostIndexedAddressingMode_1_0_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_1_0_1")) return false;
|
|
||||||
boolean r;
|
|
||||||
r = internalMemoryIndirectPostIndexedOption1(b, l + 1);
|
|
||||||
if (!r) r = internalMemoryIndirectPostIndexedOption2(b, l + 1);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR OuterDisplacement)?
|
|
||||||
private static boolean MemoryIndirectPostIndexedAddressingMode_3(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_3")) return false;
|
|
||||||
MemoryIndirectPostIndexedAddressingMode_3_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR OuterDisplacement
|
|
||||||
private static boolean MemoryIndirectPostIndexedAddressingMode_3_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPostIndexedAddressingMode_3_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && OuterDisplacement(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? (AddressRegister SEPARATOR)? IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
public static boolean MemoryIndirectPreIndexedAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokens(b, 0, ROUND_L, SQUARE_L);
|
|
||||||
r = r && MemoryIndirectPreIndexedAddressingMode_2(b, l + 1);
|
|
||||||
r = r && MemoryIndirectPreIndexedAddressingMode_3(b, l + 1);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SQUARE_R);
|
|
||||||
r = r && MemoryIndirectPreIndexedAddressingMode_6(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean MemoryIndirectPreIndexedAddressingMode_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_2")) return false;
|
|
||||||
MemoryIndirectPreIndexedAddressingMode_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean MemoryIndirectPreIndexedAddressingMode_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (AddressRegister SEPARATOR)?
|
|
||||||
private static boolean MemoryIndirectPreIndexedAddressingMode_3(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_3")) return false;
|
|
||||||
MemoryIndirectPreIndexedAddressingMode_3_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddressRegister SEPARATOR
|
|
||||||
private static boolean MemoryIndirectPreIndexedAddressingMode_3_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_3_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = AddressRegister(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR OuterDisplacement)?
|
|
||||||
private static boolean MemoryIndirectPreIndexedAddressingMode_6(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_6")) return false;
|
|
||||||
MemoryIndirectPreIndexedAddressingMode_6_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR OuterDisplacement
|
|
||||||
private static boolean MemoryIndirectPreIndexedAddressingMode_6_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "MemoryIndirectPreIndexedAddressingMode_6_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && OuterDisplacement(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// OPSIZE_BS|OPSIZE_W|OPSIZE_L
|
// OPSIZE_BS|OPSIZE_W|OPSIZE_L
|
||||||
public static boolean OperandSize(PsiBuilder b, int l) {
|
public static boolean OperandSize(PsiBuilder b, int l) {
|
||||||
@ -1043,25 +764,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// expr DataWidth?
|
|
||||||
public static boolean OuterDisplacement(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "OuterDisplacement")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, OUTER_DISPLACEMENT, "<outer displacement>");
|
|
||||||
r = expr(b, l + 1, -1);
|
|
||||||
r = r && OuterDisplacement_1(b, l + 1);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DataWidth?
|
|
||||||
private static boolean OuterDisplacement_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "OuterDisplacement_1")) return false;
|
|
||||||
DataWidth(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// (expr|AddressingMode) (SEPARATOR (expr|AddressingMode))*
|
// (expr|AddressingMode) (SEPARATOR (expr|AddressingMode))*
|
||||||
static boolean PlainOperands(PsiBuilder b, int l) {
|
static boolean PlainOperands(PsiBuilder b, int l) {
|
||||||
@ -1115,38 +817,42 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// PreprocessorKeyword PreprocessorOperands?
|
// Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE)
|
||||||
|
// PreprocessorOperands?
|
||||||
public static boolean PreprocessorDirective(PsiBuilder b, int l) {
|
public static boolean PreprocessorDirective(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "PreprocessorDirective")) return false;
|
if (!recursion_guard_(b, l, "PreprocessorDirective")) return false;
|
||||||
if (!nextTokenIs(b, "<preprocessor directive>", DATA_DIRECTIVE, OTHER_DIRECTIVE)) return false;
|
|
||||||
boolean r;
|
boolean r;
|
||||||
Marker m = enter_section_(b, l, _NONE_, PREPROCESSOR_DIRECTIVE, "<preprocessor directive>");
|
Marker m = enter_section_(b, l, _NONE_, PREPROCESSOR_DIRECTIVE, "<preprocessor directive>");
|
||||||
r = PreprocessorKeyword(b, l + 1);
|
r = PreprocessorDirective_0(b, l + 1);
|
||||||
r = r && PreprocessorDirective_1(b, l + 1);
|
r = r && PreprocessorDirective_1(b, l + 1);
|
||||||
|
r = r && PreprocessorDirective_2(b, l + 1);
|
||||||
exit_section_(b, l, m, r, false, null);
|
exit_section_(b, l, m, r, false, null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Label?
|
||||||
|
private static boolean PreprocessorDirective_0(PsiBuilder b, int l) {
|
||||||
|
if (!recursion_guard_(b, l, "PreprocessorDirective_0")) return false;
|
||||||
|
Label(b, l + 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DATA_DIRECTIVE | OTHER_DIRECTIVE
|
||||||
|
private static boolean PreprocessorDirective_1(PsiBuilder b, int l) {
|
||||||
|
if (!recursion_guard_(b, l, "PreprocessorDirective_1")) return false;
|
||||||
|
boolean r;
|
||||||
|
r = consumeToken(b, DATA_DIRECTIVE);
|
||||||
|
if (!r) r = consumeToken(b, OTHER_DIRECTIVE);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
// PreprocessorOperands?
|
// PreprocessorOperands?
|
||||||
private static boolean PreprocessorDirective_1(PsiBuilder b, int l) {
|
private static boolean PreprocessorDirective_2(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "PreprocessorDirective_1")) return false;
|
if (!recursion_guard_(b, l, "PreprocessorDirective_2")) return false;
|
||||||
PreprocessorOperands(b, l + 1);
|
PreprocessorOperands(b, l + 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// DATA_DIRECTIVE | OTHER_DIRECTIVE
|
|
||||||
public static boolean PreprocessorKeyword(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "PreprocessorKeyword")) return false;
|
|
||||||
if (!nextTokenIs(b, "<preprocessor keyword>", DATA_DIRECTIVE, OTHER_DIRECTIVE)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, PREPROCESSOR_KEYWORD, "<preprocessor keyword>");
|
|
||||||
r = consumeToken(b, DATA_DIRECTIVE);
|
|
||||||
if (!r) r = consumeToken(b, OTHER_DIRECTIVE);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// expr
|
// expr
|
||||||
static boolean PreprocessorOperand(PsiBuilder b, int l) {
|
static boolean PreprocessorOperand(PsiBuilder b, int l) {
|
||||||
@ -1234,58 +940,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L (BaseDisplacement SEPARATOR)? PC (SEPARATOR IndexRegister)? ROUND_R
|
|
||||||
public static boolean ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokenFast(b, ROUND_L);
|
|
||||||
r = r && ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_1(b, l + 1);
|
|
||||||
r = r && consumeToken(b, PC);
|
|
||||||
r = r && ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_3(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_1")) return false;
|
|
||||||
ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR IndexRegister)?
|
|
||||||
private static boolean ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_3(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_3")) return false;
|
|
||||||
ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_3_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR IndexRegister
|
|
||||||
private static boolean ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_3_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode_3_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// ROUND_L (expr SEPARATOR)? PC SEPARATOR IndexRegister ROUND_R
|
// ROUND_L (expr SEPARATOR)? PC SEPARATOR IndexRegister ROUND_R
|
||||||
public static boolean ProgramCounterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) {
|
public static boolean ProgramCounterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) {
|
||||||
@ -1341,183 +995,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? PC SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
public static boolean ProgramCounterMemoryIndirectAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_MEMORY_INDIRECT_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokens(b, 0, ROUND_L, SQUARE_L);
|
|
||||||
r = r && ProgramCounterMemoryIndirectAddressingMode_2(b, l + 1);
|
|
||||||
r = r && consumeTokens(b, 0, PC, SQUARE_R);
|
|
||||||
r = r && ProgramCounterMemoryIndirectAddressingMode_5(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectAddressingMode_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectAddressingMode_2")) return false;
|
|
||||||
ProgramCounterMemoryIndirectAddressingMode_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean ProgramCounterMemoryIndirectAddressingMode_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectAddressingMode_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR OuterDisplacement)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectAddressingMode_5(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectAddressingMode_5")) return false;
|
|
||||||
ProgramCounterMemoryIndirectAddressingMode_5_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR OuterDisplacement
|
|
||||||
private static boolean ProgramCounterMemoryIndirectAddressingMode_5_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectAddressingMode_5_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && OuterDisplacement(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L (SQUARE_L (BaseDisplacement SEPARATOR)? PC SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
public static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokenFast(b, ROUND_L);
|
|
||||||
r = r && ProgramCounterMemoryIndirectPostIndexedAddressingMode_1(b, l + 1);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
r = r && ProgramCounterMemoryIndirectPostIndexedAddressingMode_3(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SQUARE_L (BaseDisplacement SEPARATOR)? PC SQUARE_R SEPARATOR)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode_1")) return false;
|
|
||||||
ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SQUARE_L (BaseDisplacement SEPARATOR)? PC SQUARE_R SEPARATOR
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SQUARE_L);
|
|
||||||
r = r && ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0_1(b, l + 1);
|
|
||||||
r = r && consumeTokens(b, 0, PC, SQUARE_R, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0_1")) return false;
|
|
||||||
ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode_1_0_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR OuterDisplacement)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode_3(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode_3")) return false;
|
|
||||||
ProgramCounterMemoryIndirectPostIndexedAddressingMode_3_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR OuterDisplacement
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPostIndexedAddressingMode_3_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPostIndexedAddressingMode_3_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && OuterDisplacement(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? PC SEPARATOR IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
public static boolean ProgramCounterMemoryIndirectPreIndexedAddressingMode(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPreIndexedAddressingMode")) return false;
|
|
||||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE, "<AddressingMode>");
|
|
||||||
r = consumeTokens(b, 0, ROUND_L, SQUARE_L);
|
|
||||||
r = r && ProgramCounterMemoryIndirectPreIndexedAddressingMode_2(b, l + 1);
|
|
||||||
r = r && consumeTokens(b, 0, PC, SEPARATOR);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SQUARE_R);
|
|
||||||
r = r && ProgramCounterMemoryIndirectPreIndexedAddressingMode_7(b, l + 1);
|
|
||||||
r = r && consumeToken(b, ROUND_R);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPreIndexedAddressingMode_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPreIndexedAddressingMode_2")) return false;
|
|
||||||
ProgramCounterMemoryIndirectPreIndexedAddressingMode_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPreIndexedAddressingMode_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPreIndexedAddressingMode_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR OuterDisplacement)?
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPreIndexedAddressingMode_7(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPreIndexedAddressingMode_7")) return false;
|
|
||||||
ProgramCounterMemoryIndirectPreIndexedAddressingMode_7_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR OuterDisplacement
|
|
||||||
private static boolean ProgramCounterMemoryIndirectPreIndexedAddressingMode_7_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "ProgramCounterMemoryIndirectPreIndexedAddressingMode_7_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, SEPARATOR);
|
|
||||||
r = r && OuterDisplacement(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// CURRENT_PC_SYMBOL
|
// CURRENT_PC_SYMBOL
|
||||||
public static boolean ProgramCounterReference(PsiBuilder b, int l) {
|
public static boolean ProgramCounterReference(PsiBuilder b, int l) {
|
||||||
@ -1645,7 +1122,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// REG_CCR | REG_SR | REG_USP | REG_VBR | REG_SFC | REG_DFC
|
// REG_CCR | REG_SR | REG_USP | REG_VBR
|
||||||
public static boolean SpecialRegister(PsiBuilder b, int l) {
|
public static boolean SpecialRegister(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "SpecialRegister")) return false;
|
if (!recursion_guard_(b, l, "SpecialRegister")) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
@ -1654,8 +1131,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
if (!r) r = consumeToken(b, REG_SR);
|
if (!r) r = consumeToken(b, REG_SR);
|
||||||
if (!r) r = consumeToken(b, REG_USP);
|
if (!r) r = consumeToken(b, REG_USP);
|
||||||
if (!r) r = consumeToken(b, REG_VBR);
|
if (!r) r = consumeToken(b, REG_VBR);
|
||||||
if (!r) r = consumeToken(b, REG_SFC);
|
|
||||||
if (!r) r = consumeToken(b, REG_DFC);
|
|
||||||
exit_section_(b, l, m, r, false, null);
|
exit_section_(b, l, m, r, false, null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -1695,213 +1170,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// (BaseDisplacement SEPARATOR)? (AddressRegister SEPARATOR)? IndexRegister
|
|
||||||
static boolean internalBaseDisplacementOption1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption1")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = internalBaseDisplacementOption1_0(b, l + 1);
|
|
||||||
r = r && internalBaseDisplacementOption1_1(b, l + 1);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean internalBaseDisplacementOption1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption1_0")) return false;
|
|
||||||
internalBaseDisplacementOption1_0_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean internalBaseDisplacementOption1_0_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption1_0_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (AddressRegister SEPARATOR)?
|
|
||||||
private static boolean internalBaseDisplacementOption1_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption1_1")) return false;
|
|
||||||
internalBaseDisplacementOption1_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddressRegister SEPARATOR
|
|
||||||
private static boolean internalBaseDisplacementOption1_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption1_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = AddressRegister(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// (BaseDisplacement SEPARATOR)? AddressRegister (SEPARATOR IndexRegister)?
|
|
||||||
static boolean internalBaseDisplacementOption2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption2")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = internalBaseDisplacementOption2_0(b, l + 1);
|
|
||||||
r = r && AddressRegister(b, l + 1);
|
|
||||||
r = r && internalBaseDisplacementOption2_2(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean internalBaseDisplacementOption2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption2_0")) return false;
|
|
||||||
internalBaseDisplacementOption2_0_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean internalBaseDisplacementOption2_0_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption2_0_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR IndexRegister)?
|
|
||||||
private static boolean internalBaseDisplacementOption2_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption2_2")) return false;
|
|
||||||
internalBaseDisplacementOption2_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR IndexRegister
|
|
||||||
private static boolean internalBaseDisplacementOption2_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption2_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeToken(b, SEPARATOR);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// BaseDisplacement (SEPARATOR AddressRegister)? (SEPARATOR IndexRegister)?
|
|
||||||
static boolean internalBaseDisplacementOption3(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption3")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && internalBaseDisplacementOption3_1(b, l + 1);
|
|
||||||
r = r && internalBaseDisplacementOption3_2(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR AddressRegister)?
|
|
||||||
private static boolean internalBaseDisplacementOption3_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption3_1")) return false;
|
|
||||||
internalBaseDisplacementOption3_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR AddressRegister
|
|
||||||
private static boolean internalBaseDisplacementOption3_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption3_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeToken(b, SEPARATOR);
|
|
||||||
r = r && AddressRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR IndexRegister)?
|
|
||||||
private static boolean internalBaseDisplacementOption3_2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption3_2")) return false;
|
|
||||||
internalBaseDisplacementOption3_2_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR IndexRegister
|
|
||||||
private static boolean internalBaseDisplacementOption3_2_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalBaseDisplacementOption3_2_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeToken(b, SEPARATOR);
|
|
||||||
r = r && IndexRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// (BaseDisplacement SEPARATOR)? AddressRegister
|
|
||||||
static boolean internalMemoryIndirectPostIndexedOption1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption1")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = internalMemoryIndirectPostIndexedOption1_0(b, l + 1);
|
|
||||||
r = r && AddressRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (BaseDisplacement SEPARATOR)?
|
|
||||||
private static boolean internalMemoryIndirectPostIndexedOption1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption1_0")) return false;
|
|
||||||
internalMemoryIndirectPostIndexedOption1_0_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BaseDisplacement SEPARATOR
|
|
||||||
private static boolean internalMemoryIndirectPostIndexedOption1_0_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption1_0_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
|
||||||
// BaseDisplacement (SEPARATOR AddressRegister)?
|
|
||||||
static boolean internalMemoryIndirectPostIndexedOption2(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption2")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = BaseDisplacement(b, l + 1);
|
|
||||||
r = r && internalMemoryIndirectPostIndexedOption2_1(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (SEPARATOR AddressRegister)?
|
|
||||||
private static boolean internalMemoryIndirectPostIndexedOption2_1(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption2_1")) return false;
|
|
||||||
internalMemoryIndirectPostIndexedOption2_1_0(b, l + 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEPARATOR AddressRegister
|
|
||||||
private static boolean internalMemoryIndirectPostIndexedOption2_1_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "internalMemoryIndirectPostIndexedOption2_1_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeToken(b, SEPARATOR);
|
|
||||||
r = r && AddressRegister(b, l + 1);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// !<<eof>> (MacroDefinition | statement) (<<eof>>|EOL)
|
// !<<eof>> (MacroDefinition | statement) (<<eof>>|EOL)
|
||||||
static boolean line(PsiBuilder b, int l) {
|
static boolean line(PsiBuilder b, int l) {
|
||||||
@ -1949,12 +1217,14 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// Assignment
|
// Assignment
|
||||||
|
// | PreprocessorDirective
|
||||||
// | LabelInsts
|
// | LabelInsts
|
||||||
public static boolean statement(PsiBuilder b, int l) {
|
public static boolean statement(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "statement")) return false;
|
if (!recursion_guard_(b, l, "statement")) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
Marker m = enter_section_(b, l, _NONE_, STATEMENT, "<statement>");
|
Marker m = enter_section_(b, l, _NONE_, STATEMENT, "<statement>");
|
||||||
r = Assignment(b, l + 1);
|
r = Assignment(b, l + 1);
|
||||||
|
if (!r) r = PreprocessorDirective(b, l + 1);
|
||||||
if (!r) r = LabelInsts(b, l + 1);
|
if (!r) r = LabelInsts(b, l + 1);
|
||||||
exit_section_(b, l, m, r, false, M68kParser::statement_recover);
|
exit_section_(b, l, m, r, false, M68kParser::statement_recover);
|
||||||
return r;
|
return r;
|
||||||
@ -1966,21 +1236,11 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
|||||||
if (!recursion_guard_(b, l, "statement_recover")) return false;
|
if (!recursion_guard_(b, l, "statement_recover")) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
Marker m = enter_section_(b, l, _NOT_);
|
Marker m = enter_section_(b, l, _NOT_);
|
||||||
r = !statement_recover_0(b, l + 1);
|
r = !consumeToken(b, EOL);
|
||||||
exit_section_(b, l, m, r, false, null);
|
exit_section_(b, l, m, r, false, null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (EOL)
|
|
||||||
private static boolean statement_recover_0(PsiBuilder b, int l) {
|
|
||||||
if (!recursion_guard_(b, l, "statement_recover_0")) return false;
|
|
||||||
boolean r;
|
|
||||||
Marker m = enter_section_(b);
|
|
||||||
r = consumeTokenFast(b, EOL);
|
|
||||||
exit_section_(b, m, null, r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// Expression root: expr
|
// Expression root: expr
|
||||||
// Operator priority table:
|
// Operator priority table:
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public interface M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode extends M68kAddressingMode, M68kWithOptionalAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithOptionalIndexRegister {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kAddressRegister getAddressRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kIndexRegister getIndexRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// 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 M68kBaseDisplacement extends M68kPsiElement {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kDataWidth getDataWidth();
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kExpr getExpr();
|
|
||||||
|
|
||||||
}
|
|
@ -9,9 +9,6 @@ public interface M68kIndexRegister extends M68kPsiElement {
|
|||||||
@Nullable
|
@Nullable
|
||||||
M68kDataWidth getDataWidth();
|
M68kDataWidth getDataWidth();
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kIndexScale getIndexScale();
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
M68kRegister getRegister();
|
M68kRegister getRegister();
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public interface M68kIndexScale extends M68kPsiElement {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kExpr getIndexScale();
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// 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 M68kMemoryIndirectAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithOuterDisplacement {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kAddressRegister getAddressRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kOuterDisplacement getOuterDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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 M68kMemoryIndirectPostIndexedAddressingMode extends M68kAddressingMode, M68kWithOptionalAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kAddressRegister getAddressRegister();
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kIndexRegister getIndexRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kOuterDisplacement getOuterDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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 M68kMemoryIndirectPreIndexedAddressingMode extends M68kAddressingMode, M68kWithOptionalAddressRegisterIndirect, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kAddressRegister getAddressRegister();
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kIndexRegister getIndexRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kOuterDisplacement getOuterDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// 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 M68kOuterDisplacement extends M68kPsiElement {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kDataWidth getDataWidth();
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kExpr getExpr();
|
|
||||||
|
|
||||||
}
|
|
@ -2,13 +2,17 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi;
|
package de.platon42.intellij.plugins.m68k.psi;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface M68kPreprocessorDirective extends M68kPsiElement {
|
public interface M68kPreprocessorDirective extends M68kPsiElement {
|
||||||
|
|
||||||
@NotNull
|
@Nullable
|
||||||
M68kPreprocessorKeyword getPreprocessorKeyword();
|
M68kGlobalLabel getGlobalLabel();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
M68kLocalLabel getLocalLabel();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
List<M68kExpr> getExprList();
|
List<M68kExpr> getExprList();
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi;
|
|
||||||
|
|
||||||
public interface M68kPreprocessorKeyword extends M68kPsiElement {
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public interface M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithOptionalIndexRegister {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kIndexRegister getIndexRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public interface M68kProgramCounterMemoryIndirectAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithOuterDisplacement {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kOuterDisplacement getOuterDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// 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 M68kProgramCounterMemoryIndirectPostIndexedAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kIndexRegister getIndexRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kOuterDisplacement getOuterDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// 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 M68kProgramCounterMemoryIndirectPreIndexedAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithIndexRegister, M68kWithOuterDisplacement {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
M68kIndexRegister getIndexRegister();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kBaseDisplacement getBaseDisplacement();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
M68kOuterDisplacement getOuterDisplacement();
|
|
||||||
|
|
||||||
}
|
|
@ -18,14 +18,12 @@ public interface M68kTypes {
|
|||||||
IElementType ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE");
|
IElementType ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE");
|
||||||
IElementType ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE");
|
IElementType ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE");
|
||||||
IElementType ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE");
|
IElementType ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE");
|
||||||
IElementType ADDRESS_REGISTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE");
|
|
||||||
IElementType ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE");
|
IElementType ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE");
|
||||||
IElementType ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE");
|
IElementType ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE");
|
||||||
IElementType ADDRESS_SIZE = new M68kElementType("ADDRESS_SIZE");
|
IElementType ADDRESS_SIZE = new M68kElementType("ADDRESS_SIZE");
|
||||||
IElementType ASM_INSTRUCTION = new M68kElementType("ASM_INSTRUCTION");
|
IElementType ASM_INSTRUCTION = new M68kElementType("ASM_INSTRUCTION");
|
||||||
IElementType ASM_OP = new M68kElementType("ASM_OP");
|
IElementType ASM_OP = new M68kElementType("ASM_OP");
|
||||||
IElementType ASSIGNMENT = new M68kElementType("ASSIGNMENT");
|
IElementType ASSIGNMENT = new M68kElementType("ASSIGNMENT");
|
||||||
IElementType BASE_DISPLACEMENT = new M68kElementType("BASE_DISPLACEMENT");
|
|
||||||
IElementType BINARY_ADD_EXPR = new M68kElementType("BINARY_ADD_EXPR");
|
IElementType BINARY_ADD_EXPR = new M68kElementType("BINARY_ADD_EXPR");
|
||||||
IElementType BINARY_BITWISE_AND_EXPR = new M68kElementType("BINARY_BITWISE_AND_EXPR");
|
IElementType BINARY_BITWISE_AND_EXPR = new M68kElementType("BINARY_BITWISE_AND_EXPR");
|
||||||
IElementType BINARY_BITWISE_OR_EXPR = new M68kElementType("BINARY_BITWISE_OR_EXPR");
|
IElementType BINARY_BITWISE_OR_EXPR = new M68kElementType("BINARY_BITWISE_OR_EXPR");
|
||||||
@ -51,29 +49,19 @@ public interface M68kTypes {
|
|||||||
IElementType GLOBAL_LABEL = M68kStubElementTypeFactory.stubFactory("GLOBAL_LABEL");
|
IElementType GLOBAL_LABEL = M68kStubElementTypeFactory.stubFactory("GLOBAL_LABEL");
|
||||||
IElementType IMMEDIATE_DATA = new M68kElementType("IMMEDIATE_DATA");
|
IElementType IMMEDIATE_DATA = new M68kElementType("IMMEDIATE_DATA");
|
||||||
IElementType INDEX_REGISTER = new M68kElementType("INDEX_REGISTER");
|
IElementType INDEX_REGISTER = new M68kElementType("INDEX_REGISTER");
|
||||||
IElementType INDEX_SCALE = new M68kElementType("INDEX_SCALE");
|
|
||||||
IElementType LITERAL_EXPR = new M68kElementType("LITERAL_EXPR");
|
IElementType LITERAL_EXPR = new M68kElementType("LITERAL_EXPR");
|
||||||
IElementType LOCAL_LABEL = new M68kElementType("LOCAL_LABEL");
|
IElementType LOCAL_LABEL = new M68kElementType("LOCAL_LABEL");
|
||||||
IElementType MACRO_CALL = new M68kElementType("MACRO_CALL");
|
IElementType MACRO_CALL = new M68kElementType("MACRO_CALL");
|
||||||
IElementType MACRO_DEFINITION = M68kStubElementTypeFactory.stubFactory("MACRO_DEFINITION");
|
IElementType MACRO_DEFINITION = M68kStubElementTypeFactory.stubFactory("MACRO_DEFINITION");
|
||||||
IElementType MACRO_NAME_DEFINITION = new M68kElementType("MACRO_NAME_DEFINITION");
|
IElementType MACRO_NAME_DEFINITION = new M68kElementType("MACRO_NAME_DEFINITION");
|
||||||
IElementType MACRO_PLAIN_LINE = new M68kElementType("MACRO_PLAIN_LINE");
|
IElementType MACRO_PLAIN_LINE = new M68kElementType("MACRO_PLAIN_LINE");
|
||||||
IElementType MEMORY_INDIRECT_ADDRESSING_MODE = new M68kElementType("MEMORY_INDIRECT_ADDRESSING_MODE");
|
|
||||||
IElementType MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE = new M68kElementType("MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE");
|
|
||||||
IElementType MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE = new M68kElementType("MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE");
|
|
||||||
IElementType OPERAND_SIZE = new M68kElementType("OPERAND_SIZE");
|
IElementType OPERAND_SIZE = new M68kElementType("OPERAND_SIZE");
|
||||||
IElementType OUTER_DISPLACEMENT = new M68kElementType("OUTER_DISPLACEMENT");
|
|
||||||
IElementType PAREN_EXPR = new M68kElementType("PAREN_EXPR");
|
IElementType PAREN_EXPR = new M68kElementType("PAREN_EXPR");
|
||||||
IElementType PREPROCESSOR_DIRECTIVE = new M68kElementType("PREPROCESSOR_DIRECTIVE");
|
IElementType PREPROCESSOR_DIRECTIVE = new M68kElementType("PREPROCESSOR_DIRECTIVE");
|
||||||
IElementType PREPROCESSOR_KEYWORD = new M68kElementType("PREPROCESSOR_KEYWORD");
|
|
||||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE");
|
IElementType PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE");
|
||||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE");
|
IElementType PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE");
|
||||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE");
|
|
||||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE");
|
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE");
|
||||||
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE");
|
IElementType PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE");
|
||||||
IElementType PROGRAM_COUNTER_MEMORY_INDIRECT_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_MEMORY_INDIRECT_ADDRESSING_MODE");
|
|
||||||
IElementType PROGRAM_COUNTER_MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE");
|
|
||||||
IElementType PROGRAM_COUNTER_MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE");
|
|
||||||
IElementType PROGRAM_COUNTER_REFERENCE = new M68kElementType("PROGRAM_COUNTER_REFERENCE");
|
IElementType PROGRAM_COUNTER_REFERENCE = new M68kElementType("PROGRAM_COUNTER_REFERENCE");
|
||||||
IElementType REF_EXPR = new M68kElementType("REF_EXPR");
|
IElementType REF_EXPR = new M68kElementType("REF_EXPR");
|
||||||
IElementType REGISTER = new M68kElementType("REGISTER");
|
IElementType REGISTER = new M68kElementType("REGISTER");
|
||||||
@ -137,8 +125,6 @@ public interface M68kTypes {
|
|||||||
IElementType OTHER_DIRECTIVE = new M68kTokenType("OTHER_DIRECTIVE");
|
IElementType OTHER_DIRECTIVE = new M68kTokenType("OTHER_DIRECTIVE");
|
||||||
IElementType PC = new M68kTokenType("PC");
|
IElementType PC = new M68kTokenType("PC");
|
||||||
IElementType REG_CCR = new M68kTokenType("REG_CCR");
|
IElementType REG_CCR = new M68kTokenType("REG_CCR");
|
||||||
IElementType REG_DFC = new M68kTokenType("REG_DFC");
|
|
||||||
IElementType REG_SFC = new M68kTokenType("REG_SFC");
|
|
||||||
IElementType REG_SP = new M68kTokenType("REG_SP");
|
IElementType REG_SP = new M68kTokenType("REG_SP");
|
||||||
IElementType REG_SR = new M68kTokenType("REG_SR");
|
IElementType REG_SR = new M68kTokenType("REG_SR");
|
||||||
IElementType REG_USP = new M68kTokenType("REG_USP");
|
IElementType REG_USP = new M68kTokenType("REG_USP");
|
||||||
@ -146,8 +132,6 @@ public interface M68kTypes {
|
|||||||
IElementType ROUND_L = new M68kTokenType("ROUND_L");
|
IElementType ROUND_L = new M68kTokenType("ROUND_L");
|
||||||
IElementType ROUND_R = new M68kTokenType("ROUND_R");
|
IElementType ROUND_R = new M68kTokenType("ROUND_R");
|
||||||
IElementType SEPARATOR = new M68kTokenType("SEPARATOR");
|
IElementType SEPARATOR = new M68kTokenType("SEPARATOR");
|
||||||
IElementType SQUARE_L = new M68kTokenType("SQUARE_L");
|
|
||||||
IElementType SQUARE_R = new M68kTokenType("SQUARE_R");
|
|
||||||
IElementType STRINGLIT = new M68kTokenType("STRINGLIT");
|
IElementType STRINGLIT = new M68kTokenType("STRINGLIT");
|
||||||
IElementType SYMBOL = new M68kTokenType("SYMBOL");
|
IElementType SYMBOL = new M68kTokenType("SYMBOL");
|
||||||
IElementType SYMBOLDEF = new M68kTokenType("SYMBOLDEF");
|
IElementType SYMBOLDEF = new M68kTokenType("SYMBOLDEF");
|
||||||
@ -171,8 +155,6 @@ public interface M68kTypes {
|
|||||||
return new M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl(node);
|
return new M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl(node);
|
||||||
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) {
|
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) {
|
||||||
return new M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl(node);
|
return new M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl(node);
|
||||||
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE) {
|
|
||||||
return new M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl(node);
|
|
||||||
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) {
|
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) {
|
||||||
return new M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(node);
|
return new M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(node);
|
||||||
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
||||||
@ -185,8 +167,6 @@ public interface M68kTypes {
|
|||||||
return new M68kAsmOpImpl(node);
|
return new M68kAsmOpImpl(node);
|
||||||
} else if (type == ASSIGNMENT) {
|
} else if (type == ASSIGNMENT) {
|
||||||
return new M68kAssignmentImpl(node);
|
return new M68kAssignmentImpl(node);
|
||||||
} else if (type == BASE_DISPLACEMENT) {
|
|
||||||
return new M68kBaseDisplacementImpl(node);
|
|
||||||
} else if (type == BINARY_ADD_EXPR) {
|
} else if (type == BINARY_ADD_EXPR) {
|
||||||
return new M68kBinaryAddExprImpl(node);
|
return new M68kBinaryAddExprImpl(node);
|
||||||
} else if (type == BINARY_BITWISE_AND_EXPR) {
|
} else if (type == BINARY_BITWISE_AND_EXPR) {
|
||||||
@ -235,8 +215,6 @@ public interface M68kTypes {
|
|||||||
return new M68kImmediateDataImpl(node);
|
return new M68kImmediateDataImpl(node);
|
||||||
} else if (type == INDEX_REGISTER) {
|
} else if (type == INDEX_REGISTER) {
|
||||||
return new M68kIndexRegisterImpl(node);
|
return new M68kIndexRegisterImpl(node);
|
||||||
} else if (type == INDEX_SCALE) {
|
|
||||||
return new M68kIndexScaleImpl(node);
|
|
||||||
} else if (type == LITERAL_EXPR) {
|
} else if (type == LITERAL_EXPR) {
|
||||||
return new M68kLiteralExprImpl(node);
|
return new M68kLiteralExprImpl(node);
|
||||||
} else if (type == LOCAL_LABEL) {
|
} else if (type == LOCAL_LABEL) {
|
||||||
@ -249,38 +227,20 @@ public interface M68kTypes {
|
|||||||
return new M68kMacroNameDefinitionImpl(node);
|
return new M68kMacroNameDefinitionImpl(node);
|
||||||
} else if (type == MACRO_PLAIN_LINE) {
|
} else if (type == MACRO_PLAIN_LINE) {
|
||||||
return new M68kMacroPlainLineImpl(node);
|
return new M68kMacroPlainLineImpl(node);
|
||||||
} else if (type == MEMORY_INDIRECT_ADDRESSING_MODE) {
|
|
||||||
return new M68kMemoryIndirectAddressingModeImpl(node);
|
|
||||||
} else if (type == MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE) {
|
|
||||||
return new M68kMemoryIndirectPostIndexedAddressingModeImpl(node);
|
|
||||||
} else if (type == MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE) {
|
|
||||||
return new M68kMemoryIndirectPreIndexedAddressingModeImpl(node);
|
|
||||||
} else if (type == OPERAND_SIZE) {
|
} else if (type == OPERAND_SIZE) {
|
||||||
return new M68kOperandSizeImpl(node);
|
return new M68kOperandSizeImpl(node);
|
||||||
} else if (type == OUTER_DISPLACEMENT) {
|
|
||||||
return new M68kOuterDisplacementImpl(node);
|
|
||||||
} else if (type == PAREN_EXPR) {
|
} else if (type == PAREN_EXPR) {
|
||||||
return new M68kParenExprImpl(node);
|
return new M68kParenExprImpl(node);
|
||||||
} else if (type == PREPROCESSOR_DIRECTIVE) {
|
} else if (type == PREPROCESSOR_DIRECTIVE) {
|
||||||
return new M68kPreprocessorDirectiveImpl(node);
|
return new M68kPreprocessorDirectiveImpl(node);
|
||||||
} else if (type == PREPROCESSOR_KEYWORD) {
|
|
||||||
return new M68kPreprocessorKeywordImpl(node);
|
|
||||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) {
|
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) {
|
||||||
return new M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl(node);
|
return new M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl(node);
|
||||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) {
|
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) {
|
||||||
return new M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl(node);
|
return new M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl(node);
|
||||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_BASE_DISPLACEMENT_ADDRESSING_MODE) {
|
|
||||||
return new M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl(node);
|
|
||||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) {
|
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE) {
|
||||||
return new M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(node);
|
return new M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(node);
|
||||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
||||||
return new M68kProgramCounterIndirectWithIndexOldAddressingModeImpl(node);
|
return new M68kProgramCounterIndirectWithIndexOldAddressingModeImpl(node);
|
||||||
} else if (type == PROGRAM_COUNTER_MEMORY_INDIRECT_ADDRESSING_MODE) {
|
|
||||||
return new M68kProgramCounterMemoryIndirectAddressingModeImpl(node);
|
|
||||||
} else if (type == PROGRAM_COUNTER_MEMORY_INDIRECT_POST_INDEXED_ADDRESSING_MODE) {
|
|
||||||
return new M68kProgramCounterMemoryIndirectPostIndexedAddressingModeImpl(node);
|
|
||||||
} else if (type == PROGRAM_COUNTER_MEMORY_INDIRECT_PRE_INDEXED_ADDRESSING_MODE) {
|
|
||||||
return new M68kProgramCounterMemoryIndirectPreIndexedAddressingModeImpl(node);
|
|
||||||
} else if (type == PROGRAM_COUNTER_REFERENCE) {
|
} else if (type == PROGRAM_COUNTER_REFERENCE) {
|
||||||
return new M68kProgramCounterReferenceImpl(node);
|
return new M68kProgramCounterReferenceImpl(node);
|
||||||
} else if (type == REF_EXPR) {
|
} else if (type == REF_EXPR) {
|
||||||
|
@ -45,13 +45,6 @@ public class M68kVisitor extends PsiElementVisitor {
|
|||||||
// visitWithDisplacement(o);
|
// visitWithDisplacement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithOptionalAddressRegisterIndirect(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithOptionalIndexRegister(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitAddressRegisterIndirectWithIndexNewAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexNewAddressingMode o) {
|
public void visitAddressRegisterIndirectWithIndexNewAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexNewAddressingMode o) {
|
||||||
visitAddressingMode(o);
|
visitAddressingMode(o);
|
||||||
// visitWithAddressRegisterIndirect(o);
|
// visitWithAddressRegisterIndirect(o);
|
||||||
@ -86,10 +79,6 @@ public class M68kVisitor extends PsiElementVisitor {
|
|||||||
visitPsiElement(o);
|
visitPsiElement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitBaseDisplacement(@NotNull M68kBaseDisplacement o) {
|
|
||||||
visitPsiElement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitDataRegister(@NotNull M68kDataRegister o) {
|
public void visitDataRegister(@NotNull M68kDataRegister o) {
|
||||||
visitRegister(o);
|
visitRegister(o);
|
||||||
}
|
}
|
||||||
@ -114,10 +103,6 @@ public class M68kVisitor extends PsiElementVisitor {
|
|||||||
visitPsiElement(o);
|
visitPsiElement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitIndexScale(@NotNull M68kIndexScale o) {
|
|
||||||
visitPsiElement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitLocalLabel(@NotNull M68kLocalLabel o) {
|
public void visitLocalLabel(@NotNull M68kLocalLabel o) {
|
||||||
visitNamedElement(o);
|
visitNamedElement(o);
|
||||||
}
|
}
|
||||||
@ -138,45 +123,14 @@ public class M68kVisitor extends PsiElementVisitor {
|
|||||||
visitPsiElement(o);
|
visitPsiElement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitMemoryIndirectAddressingMode(@NotNull M68kMemoryIndirectAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithAddressRegisterIndirect(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithOuterDisplacement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitMemoryIndirectPostIndexedAddressingMode(@NotNull M68kMemoryIndirectPostIndexedAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithOptionalAddressRegisterIndirect(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithIndexRegister(o);
|
|
||||||
// visitWithOuterDisplacement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitMemoryIndirectPreIndexedAddressingMode(@NotNull M68kMemoryIndirectPreIndexedAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithOptionalAddressRegisterIndirect(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithIndexRegister(o);
|
|
||||||
// visitWithOuterDisplacement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitOperandSize(@NotNull M68kOperandSize o) {
|
public void visitOperandSize(@NotNull M68kOperandSize o) {
|
||||||
visitPsiElement(o);
|
visitPsiElement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitOuterDisplacement(@NotNull M68kOuterDisplacement o) {
|
|
||||||
visitPsiElement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitPreprocessorDirective(@NotNull M68kPreprocessorDirective o) {
|
public void visitPreprocessorDirective(@NotNull M68kPreprocessorDirective o) {
|
||||||
visitPsiElement(o);
|
visitPsiElement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitPreprocessorKeyword(@NotNull M68kPreprocessorKeyword o) {
|
|
||||||
visitPsiElement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitProgramCounterIndirectWithDisplacementNewAddressingMode(@NotNull M68kProgramCounterIndirectWithDisplacementNewAddressingMode o) {
|
public void visitProgramCounterIndirectWithDisplacementNewAddressingMode(@NotNull M68kProgramCounterIndirectWithDisplacementNewAddressingMode o) {
|
||||||
visitAddressingMode(o);
|
visitAddressingMode(o);
|
||||||
// visitWithDisplacement(o);
|
// visitWithDisplacement(o);
|
||||||
@ -187,12 +141,6 @@ public class M68kVisitor extends PsiElementVisitor {
|
|||||||
// visitWithDisplacement(o);
|
// visitWithDisplacement(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithOptionalIndexRegister(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitProgramCounterIndirectWithIndexNewAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexNewAddressingMode o) {
|
public void visitProgramCounterIndirectWithIndexNewAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexNewAddressingMode o) {
|
||||||
visitAddressingMode(o);
|
visitAddressingMode(o);
|
||||||
// visitWithDisplacement(o);
|
// visitWithDisplacement(o);
|
||||||
@ -205,26 +153,6 @@ public class M68kVisitor extends PsiElementVisitor {
|
|||||||
// visitWithIndexRegister(o);
|
// visitWithIndexRegister(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitProgramCounterMemoryIndirectAddressingMode(@NotNull M68kProgramCounterMemoryIndirectAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithOuterDisplacement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitProgramCounterMemoryIndirectPostIndexedAddressingMode(@NotNull M68kProgramCounterMemoryIndirectPostIndexedAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithIndexRegister(o);
|
|
||||||
// visitWithOuterDisplacement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitProgramCounterMemoryIndirectPreIndexedAddressingMode(@NotNull M68kProgramCounterMemoryIndirectPreIndexedAddressingMode o) {
|
|
||||||
visitAddressingMode(o);
|
|
||||||
// visitWithBaseDisplacement(o);
|
|
||||||
// visitWithIndexRegister(o);
|
|
||||||
// visitWithOuterDisplacement(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitProgramCounterReference(@NotNull M68kProgramCounterReference o) {
|
public void visitProgramCounterReference(@NotNull M68kProgramCounterReference o) {
|
||||||
visitPsiElement(o);
|
visitPsiElement(o);
|
||||||
}
|
}
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl extends M68kAddressingModeImpl implements M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode {
|
|
||||||
|
|
||||||
public M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kAddressRegister getAddressRegister() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kIndexRegister getIndexRegister() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kBaseDisplacement;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kDataWidth;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kBaseDisplacementImpl extends ASTWrapperPsiElement implements M68kBaseDisplacement {
|
|
||||||
|
|
||||||
public M68kBaseDisplacementImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitBaseDisplacement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kDataWidth getDataWidth() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kExpr getExpr() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -19,8 +19,8 @@ public class M68kGlobalLabelImpl extends M68kGlobalLabelMixin implements M68kGlo
|
|||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public M68kGlobalLabelImpl(@NotNull M68kGlobalLabelStub stub, @NotNull IStubElementType<?, ?> type) {
|
public M68kGlobalLabelImpl(@NotNull M68kGlobalLabelStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||||
super(stub, type);
|
super(stub, nodeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
public void accept(@NotNull M68kVisitor visitor) {
|
||||||
|
@ -31,12 +31,6 @@ public class M68kIndexRegisterImpl extends ASTWrapperPsiElement implements M68kI
|
|||||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kIndexScale getIndexScale() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kIndexScale.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public M68kRegister getRegister() {
|
public M68kRegister getRegister() {
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kIndexScale;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class M68kIndexScaleImpl extends ASTWrapperPsiElement implements M68kIndexScale {
|
|
||||||
|
|
||||||
public M68kIndexScaleImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitIndexScale(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kExpr getIndexScale() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -19,8 +19,8 @@ public class M68kMacroDefinitionImpl extends M68kMacroDefinitionMixin implements
|
|||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public M68kMacroDefinitionImpl(@NotNull M68kMacroDefinitionStub stub, @NotNull IStubElementType<?, ?> type) {
|
public M68kMacroDefinitionImpl(@NotNull M68kMacroDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||||
super(stub, type);
|
super(stub, nodeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
public void accept(@NotNull M68kVisitor visitor) {
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kMemoryIndirectAddressingModeImpl extends M68kAddressingModeImpl implements M68kMemoryIndirectAddressingMode {
|
|
||||||
|
|
||||||
public M68kMemoryIndirectAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitMemoryIndirectAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kAddressRegister getAddressRegister() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kOuterDisplacement getOuterDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kOuterDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kMemoryIndirectPostIndexedAddressingModeImpl extends M68kAddressingModeImpl implements M68kMemoryIndirectPostIndexedAddressingMode {
|
|
||||||
|
|
||||||
public M68kMemoryIndirectPostIndexedAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitMemoryIndirectPostIndexedAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kAddressRegister getAddressRegister() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kIndexRegister getIndexRegister() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kOuterDisplacement getOuterDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kOuterDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kMemoryIndirectPreIndexedAddressingModeImpl extends M68kAddressingModeImpl implements M68kMemoryIndirectPreIndexedAddressingMode {
|
|
||||||
|
|
||||||
public M68kMemoryIndirectPreIndexedAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitMemoryIndirectPreIndexedAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kAddressRegister getAddressRegister() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kIndexRegister getIndexRegister() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kOuterDisplacement getOuterDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kOuterDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kDataWidth;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kOuterDisplacement;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kOuterDisplacementImpl extends ASTWrapperPsiElement implements M68kOuterDisplacement {
|
|
||||||
|
|
||||||
public M68kOuterDisplacementImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitOuterDisplacement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kDataWidth getDataWidth() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kExpr getExpr() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +1,17 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||||
|
|
||||||
|
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
import com.intellij.psi.PsiElementVisitor;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class M68kPreprocessorDirectiveImpl extends M68kPreprocessorDirectiveMixin implements M68kPreprocessorDirective {
|
public class M68kPreprocessorDirectiveImpl extends ASTWrapperPsiElement implements M68kPreprocessorDirective {
|
||||||
|
|
||||||
public M68kPreprocessorDirectiveImpl(@NotNull ASTNode node) {
|
public M68kPreprocessorDirectiveImpl(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
@ -26,9 +28,15 @@ public class M68kPreprocessorDirectiveImpl extends M68kPreprocessorDirectiveMixi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@Nullable
|
||||||
public M68kPreprocessorKeyword getPreprocessorKeyword() {
|
public M68kGlobalLabel getGlobalLabel() {
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kPreprocessorKeyword.class));
|
return PsiTreeUtil.getChildOfType(this, M68kGlobalLabel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public M68kLocalLabel getLocalLabel() {
|
||||||
|
return PsiTreeUtil.getChildOfType(this, M68kLocalLabel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorKeyword;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class M68kPreprocessorKeywordImpl extends ASTWrapperPsiElement implements M68kPreprocessorKeyword {
|
|
||||||
|
|
||||||
public M68kPreprocessorKeywordImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitPreprocessorKeyword(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kBaseDisplacement;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kIndexRegister;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl extends M68kAddressingModeImpl implements M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode {
|
|
||||||
|
|
||||||
public M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kIndexRegister getIndexRegister() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kBaseDisplacement;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kOuterDisplacement;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterMemoryIndirectAddressingMode;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kProgramCounterMemoryIndirectAddressingModeImpl extends M68kAddressingModeImpl implements M68kProgramCounterMemoryIndirectAddressingMode {
|
|
||||||
|
|
||||||
public M68kProgramCounterMemoryIndirectAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitProgramCounterMemoryIndirectAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kOuterDisplacement getOuterDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kOuterDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kProgramCounterMemoryIndirectPostIndexedAddressingModeImpl extends M68kAddressingModeImpl implements M68kProgramCounterMemoryIndirectPostIndexedAddressingMode {
|
|
||||||
|
|
||||||
public M68kProgramCounterMemoryIndirectPostIndexedAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitProgramCounterMemoryIndirectPostIndexedAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kIndexRegister getIndexRegister() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kOuterDisplacement getOuterDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kOuterDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
|
||||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class M68kProgramCounterMemoryIndirectPreIndexedAddressingModeImpl extends M68kAddressingModeImpl implements M68kProgramCounterMemoryIndirectPreIndexedAddressingMode {
|
|
||||||
|
|
||||||
public M68kProgramCounterMemoryIndirectPreIndexedAddressingModeImpl(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
|
||||||
visitor.visitProgramCounterMemoryIndirectPreIndexedAddressingMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
||||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
|
||||||
else super.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public M68kIndexRegister getIndexRegister() {
|
|
||||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kBaseDisplacement getBaseDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kBaseDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public M68kOuterDisplacement getOuterDisplacement() {
|
|
||||||
return PsiTreeUtil.getChildOfType(this, M68kOuterDisplacement.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -19,8 +19,8 @@ public class M68kSymbolDefinitionImpl extends M68kSymbolDefinitionMixin implemen
|
|||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public M68kSymbolDefinitionImpl(@NotNull M68kSymbolDefinitionStub stub, @NotNull IStubElementType<?, ?> type) {
|
public M68kSymbolDefinitionImpl(@NotNull M68kSymbolDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||||
super(stub, type);
|
super(stub, nodeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void accept(@NotNull M68kVisitor visitor) {
|
public void accept(@NotNull M68kVisitor visitor) {
|
||||||
|
@ -10,7 +10,7 @@ class M68kFileElementType private constructor() : ILightStubFileElementType<PsiF
|
|||||||
@JvmField
|
@JvmField
|
||||||
val INSTANCE = M68kFileElementType()
|
val INSTANCE = M68kFileElementType()
|
||||||
|
|
||||||
const val STUB_VERSION = 8
|
const val STUB_VERSION = 5
|
||||||
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
||||||
const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE"
|
const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE"
|
||||||
}
|
}
|
||||||
|
@ -19,20 +19,10 @@ object AssemblerDirectives {
|
|||||||
"align", "even", "odd", "cnop", "long", "dphrase", "phrase", "qphrase",
|
"align", "even", "odd", "cnop", "long", "dphrase", "phrase", "qphrase",
|
||||||
|
|
||||||
"cargs", "comm", "comment",
|
"cargs", "comm", "comment",
|
||||||
"rsset", "clrfo", "clrso", "setfo", "setso",
|
"rsset", "clrfo", "clrso", "setfo", "setso"
|
||||||
|
|
||||||
"rsreset", "rs.b", "rs.w", "rs.l"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val plainDirectives: Set<String> = setOf(
|
val otherDirective: Set<String> = setOf(
|
||||||
"incdir", "include", "incbin", "output", "idnt",
|
|
||||||
|
|
||||||
"printt", "echo", "fail",
|
|
||||||
|
|
||||||
"opt"
|
|
||||||
)
|
|
||||||
|
|
||||||
val otherDirectives: Set<String> = setOf(
|
|
||||||
"if",
|
"if",
|
||||||
"ifeq", "ifne", "ifgt", "ifge", "iflt", "ifle", "ifb", "ifnb", "ifc", "ifnc",
|
"ifeq", "ifne", "ifgt", "ifge", "iflt", "ifle", "ifb", "ifnb", "ifc", "ifnc",
|
||||||
"ifd", "ifnd", "ifmacrod", "ifmacrond",
|
"ifd", "ifnd", "ifmacrod", "ifmacrond",
|
||||||
@ -48,10 +38,12 @@ object AssemblerDirectives {
|
|||||||
"reg", "equr", "equrl",
|
"reg", "equr", "equrl",
|
||||||
"freg", "fequr", "fequrl",
|
"freg", "fequr", "fequrl",
|
||||||
|
|
||||||
|
"incdir", "include", "incbin", "output",
|
||||||
|
|
||||||
"list", "nlist", "nolist", "llen", "nopage", "page", "spc",
|
"list", "nlist", "nolist", "llen", "nopage", "page", "spc",
|
||||||
"org",
|
"org",
|
||||||
|
|
||||||
"assert", "printv",
|
"assert", "fail", "print", "printt", "printv", "echo",
|
||||||
|
|
||||||
"inline", "einline",
|
"inline", "einline",
|
||||||
"rem", "erem",
|
"rem", "erem",
|
||||||
@ -61,6 +53,6 @@ object AssemblerDirectives {
|
|||||||
|
|
||||||
"basereg", "endb", "far", "near", "initnear",
|
"basereg", "endb", "far", "near", "initnear",
|
||||||
|
|
||||||
"end"
|
"opt"
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -1,27 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.asm
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.completion.*
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
|
||||||
import com.intellij.patterns.PlatformPatterns
|
|
||||||
import com.intellij.util.ProcessingContext
|
|
||||||
import de.platon42.intellij.plugins.m68k.M68kIcons
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
|
||||||
|
|
||||||
class M68kDirectiveCompletionContributor : CompletionContributor() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val DIRECTIVES =
|
|
||||||
listOf(AssemblerDirectives.dataDirectives, AssemblerDirectives.plainDirectives, AssemblerDirectives.otherDirectives.map(String::uppercase))
|
|
||||||
.flatten()
|
|
||||||
.toSortedSet()
|
|
||||||
.map { PrioritizedLookupElement.withPriority(LookupElementBuilder.create(it).withIcon(M68kIcons.MNEMONIC), 1.5) }
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
extend(CompletionType.BASIC, PlatformPatterns.psiElement(M68kTypes.MACRO_INVOCATION), object : CompletionProvider<CompletionParameters>() {
|
|
||||||
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, resultSet: CompletionResultSet) {
|
|
||||||
resultSet.addAllElements(DIRECTIVES)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.asm
|
package de.platon42.intellij.plugins.m68k.asm
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
enum class Machine {
|
enum class Machine {
|
||||||
MC68000,
|
MC68000,
|
||||||
MC68010,
|
MC68010,
|
||||||
@ -11,10 +9,6 @@ enum class Machine {
|
|||||||
MC68060
|
MC68060
|
||||||
}
|
}
|
||||||
|
|
||||||
private val MC68000_ONLY = EnumSet.of(Machine.MC68000)
|
|
||||||
private val MC68020_PLUS = EnumSet.range(Machine.MC68020, Machine.MC68060)
|
|
||||||
private val ALL_MACHINES = EnumSet.allOf(Machine::class.java)
|
|
||||||
|
|
||||||
enum class Register(val regname: String, val num: Int) {
|
enum class Register(val regname: String, val num: Int) {
|
||||||
D0("d0", 0),
|
D0("d0", 0),
|
||||||
D1("d1", 1),
|
D1("d1", 1),
|
||||||
@ -49,18 +43,8 @@ enum class AddressMode(val description: String, val syntax: String) {
|
|||||||
ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT("address register indirect with displacement", "(d16,An)"),
|
ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT("address register indirect with displacement", "(d16,An)"),
|
||||||
PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT("program counter indirect with displacement", "(d16,PC)"),
|
PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT("program counter indirect with displacement", "(d16,PC)"),
|
||||||
ADDRESS_REGISTER_INDIRECT_WITH_INDEX("address register indirect with index", "(d8,An,Xn)"),
|
ADDRESS_REGISTER_INDIRECT_WITH_INDEX("address register indirect with index", "(d8,An,Xn)"),
|
||||||
ADDRESS_REGISTER_INDIRECT_WITH_SCALED_INDEX("address register indirect with scaled index", "(d8,An,Xn*s)"),
|
|
||||||
ADDRESS_REGISTER_INDIRECT_WITH_BASE_DISPLACEMENT("address register indirect with index (base displacement)", "(bd,An,Xn*s)"),
|
|
||||||
PROGRAM_COUNTER_INDIRECT_WITH_INDEX("program counter indirect with index", "(d8,PC,Xn)"),
|
PROGRAM_COUNTER_INDIRECT_WITH_INDEX("program counter indirect with index", "(d8,PC,Xn)"),
|
||||||
PROGRAM_COUNTER_INDIRECT_WITH_SCALED_INDEX("program counter indirect with scaled index", "(d8,PC,Xn*s)"),
|
SPECIAL_REGISTER_DIRECT("special register", "ccr|usp|vbr"),
|
||||||
PROGRAM_COUNTER_INDIRECT_WITH_BASE_DISPLACEMENT("program counter indirect with index (base displacement)", "(bd,PC,Xn*s)"),
|
|
||||||
MEMORY_INDIRECT("memory indirect", "([bd,An],od)"),
|
|
||||||
MEMORY_INDIRECT_POSTINDEXED("memory indirect postindexed", "([bd,An],Xn*s,od)"),
|
|
||||||
MEMORY_INDIRECT_PREINDEXED("memory indirect preindexed", "([bd,An,Xn*s],od)"),
|
|
||||||
PROGRAM_COUNTER_MEMORY_INDIRECT("program counter memory indirect", "([bd,PC],od)"),
|
|
||||||
PROGRAM_COUNTER_MEMORY_INDIRECT_POSTINDEXED("program counter memory indirect postindexed", "([bd,PC],Xn*s,od)"),
|
|
||||||
PROGRAM_COUNTER_MEMORY_INDIRECT_PREINDEXED("program counter memory indirect preindexed", "([bd,PC,Xn*s],od)"),
|
|
||||||
SPECIAL_REGISTER_DIRECT("special register", "sr|ccr|usp|vbr"),
|
|
||||||
REGISTER_LIST("register list", "list"),
|
REGISTER_LIST("register list", "list"),
|
||||||
IMMEDIATE_DATA("immediate", "#<xxx>"),
|
IMMEDIATE_DATA("immediate", "#<xxx>"),
|
||||||
ABSOLUTE_ADDRESS("absolute short/long", "(xxx).w|l")
|
ABSOLUTE_ADDRESS("absolute short/long", "(xxx).w|l")
|
||||||
@ -144,7 +128,7 @@ data class AllowedAdrMode(
|
|||||||
data class IsaData(
|
data class IsaData(
|
||||||
val mnemonic: String,
|
val mnemonic: String,
|
||||||
val description: String,
|
val description: String,
|
||||||
val machine: Set<Machine> = MC68000_ONLY,
|
val machine: Set<Machine> = setOf(Machine.MC68000),
|
||||||
val altMnemonics: List<String> = emptyList(),
|
val altMnemonics: List<String> = emptyList(),
|
||||||
val conditionCodes: List<String> = emptyList(),
|
val conditionCodes: List<String> = emptyList(),
|
||||||
val id: String = mnemonic,
|
val id: String = mnemonic,
|
||||||
@ -172,21 +156,6 @@ object M68kIsa {
|
|||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX,
|
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ALL_68020_MODES = ALL_68000_MODES.plus(
|
|
||||||
setOf(
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_SCALED_INDEX,
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_BASE_DISPLACEMENT,
|
|
||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_SCALED_INDEX,
|
|
||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_BASE_DISPLACEMENT,
|
|
||||||
AddressMode.MEMORY_INDIRECT,
|
|
||||||
AddressMode.MEMORY_INDIRECT_POSTINDEXED,
|
|
||||||
AddressMode.MEMORY_INDIRECT_PREINDEXED,
|
|
||||||
AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT,
|
|
||||||
AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT_POSTINDEXED,
|
|
||||||
AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT_PREINDEXED
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private val ALL_EXCEPT_IMMEDIATE_AND_PC_REL = setOf(
|
private val ALL_EXCEPT_IMMEDIATE_AND_PC_REL = setOf(
|
||||||
AddressMode.DATA_REGISTER_DIRECT,
|
AddressMode.DATA_REGISTER_DIRECT,
|
||||||
AddressMode.ADDRESS_REGISTER_DIRECT,
|
AddressMode.ADDRESS_REGISTER_DIRECT,
|
||||||
@ -198,16 +167,6 @@ object M68kIsa {
|
|||||||
AddressMode.ABSOLUTE_ADDRESS
|
AddressMode.ABSOLUTE_ADDRESS
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ALL_68020_MODES_EXCEPT_IMMEDIATE_AND_PC_REL = ALL_EXCEPT_IMMEDIATE_AND_PC_REL.plus(
|
|
||||||
setOf(
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_SCALED_INDEX,
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_BASE_DISPLACEMENT,
|
|
||||||
AddressMode.MEMORY_INDIRECT,
|
|
||||||
AddressMode.MEMORY_INDIRECT_POSTINDEXED,
|
|
||||||
AddressMode.MEMORY_INDIRECT_PREINDEXED,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private val ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL = setOf(
|
private val ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL = setOf(
|
||||||
AddressMode.DATA_REGISTER_DIRECT,
|
AddressMode.DATA_REGISTER_DIRECT,
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT,
|
AddressMode.ADDRESS_REGISTER_INDIRECT,
|
||||||
@ -243,18 +202,6 @@ object M68kIsa {
|
|||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX,
|
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ALL_EXCEPT_AREG_AND_DREG = setOf(
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT,
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC,
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_PRE_DEC,
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT,
|
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX,
|
|
||||||
AddressMode.ABSOLUTE_ADDRESS,
|
|
||||||
AddressMode.IMMEDIATE_DATA,
|
|
||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT,
|
|
||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX,
|
|
||||||
)
|
|
||||||
|
|
||||||
private val INDIRECT_MODES = setOf(
|
private val INDIRECT_MODES = setOf(
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT,
|
AddressMode.ADDRESS_REGISTER_INDIRECT,
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC,
|
AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC,
|
||||||
@ -266,7 +213,6 @@ object M68kIsa {
|
|||||||
|
|
||||||
private val AREG_ONLY = setOf(AddressMode.ADDRESS_REGISTER_DIRECT)
|
private val AREG_ONLY = setOf(AddressMode.ADDRESS_REGISTER_DIRECT)
|
||||||
private val DREG_ONLY = setOf(AddressMode.DATA_REGISTER_DIRECT)
|
private val DREG_ONLY = setOf(AddressMode.DATA_REGISTER_DIRECT)
|
||||||
private val DREG_AREG = setOf(AddressMode.ADDRESS_REGISTER_DIRECT, AddressMode.DATA_REGISTER_DIRECT)
|
|
||||||
|
|
||||||
private val ADD_SUB_MODES = listOf(
|
private val ADD_SUB_MODES = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
@ -294,7 +240,7 @@ object M68kIsa {
|
|||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.IMMEDIATE_DATA), ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("C****")
|
setOf(AddressMode.IMMEDIATE_DATA), ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("C****")
|
||||||
),
|
),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), AREG_ONLY, size = OP_SIZE_WL, modInfo = RWM_MODIFY_OP2_L)
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), AREG_ONLY, size = OP_SIZE_WL, modInfo = RWM_MODIFY_OP2_L, affectedCc = cc("C****"))
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ADDX_SUBX_MODES = listOf(
|
private val ADDX_SUBX_MODES = listOf(
|
||||||
@ -307,50 +253,36 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ASL_MODES = listOf(
|
private val ASD_LSD_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("*****")),
|
||||||
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****")),
|
AllowedAdrMode(INDIRECT_MODES, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****")),
|
||||||
// not an official address mode, but supported by assembler (implicit #1)
|
|
||||||
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("*****"))
|
|
||||||
)
|
|
||||||
|
|
||||||
private val ASR_LSD_MODES = listOf(
|
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*")),
|
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*")),
|
|
||||||
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*")),
|
|
||||||
// not an official address mode, but supported by assembler (implicit #1)
|
|
||||||
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*"))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ROD_MODES = listOf(
|
private val ROD_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**0*")),
|
||||||
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**0*")),
|
AllowedAdrMode(INDIRECT_MODES, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**0*")),
|
||||||
// not an official address mode, but supported by assembler (implicit #1)
|
|
||||||
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**0*")),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ROXD_MODES = listOf(
|
private val ROXD_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, modInfo = RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
||||||
AllowedAdrMode(INDIRECT_MODES, null, size = OP_SIZE_W, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
AllowedAdrMode(INDIRECT_MODES, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
||||||
// not an official address mode, but supported by assembler (implicit #1)
|
|
||||||
AllowedAdrMode(DREG_ONLY, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("***0*"), testedCc = cc("?----")),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val BCHG_BCLR_BSET_MODES = listOf(
|
private val BCHG_BCLR_BSET_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, OP_SIZE_L, modInfo = RWM_READ_OP1_B or RWM_MODIFY_OP2_L, affectedCc = cc("--*--")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, OP_SIZE_L, modInfo = RWM_READ_OP1_B or RWM_MODIFY_OP2_L, affectedCc = cc("--*--")),
|
||||||
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, OP_SIZE_B, modInfo = RWM_READ_OP1_B or RWM_MODIFY_OP2_B, affectedCc = cc("--*--")),
|
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, OP_SIZE_B, modInfo = RWM_READ_OP1_B or RWM_MODIFY_OP2_B, affectedCc = cc("--*--")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, OP_SIZE_L, modInfo = RWM_MODIFY_OP2_L, affectedCc = cc("--*--")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, OP_SIZE_L, modInfo = RWM_MODIFY_OP2_L, affectedCc = cc("--*--")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), ALL_EXCEPT_AREG_AND_DREG, OP_SIZE_B, modInfo = RWM_MODIFY_OP2_B, affectedCc = cc("--*--")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), INDIRECT_MODES, OP_SIZE_B, modInfo = RWM_MODIFY_OP2_B, affectedCc = cc("--*--")),
|
||||||
)
|
)
|
||||||
|
|
||||||
private val BTST_MODES = listOf(
|
private val BTST_MODES = listOf(
|
||||||
AllowedAdrMode(DREG_ONLY, DREG_ONLY, OP_SIZE_L, modInfo = RWM_READ_OP1_B or RWM_READ_OP2_L, affectedCc = cc("--*--")),
|
AllowedAdrMode(DREG_ONLY, DREG_ONLY, OP_SIZE_L, modInfo = RWM_READ_OP1_B or RWM_READ_OP2_L, affectedCc = cc("--*--")),
|
||||||
AllowedAdrMode(DREG_ONLY, ALL_EXCEPT_AREG_AND_DREG, OP_SIZE_B, modInfo = RWM_READ_OP1_B or RWM_READ_OP2_B, affectedCc = cc("--*--")),
|
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, OP_SIZE_B, modInfo = RWM_READ_OP1_B or RWM_READ_OP2_B, affectedCc = cc("--*--")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, OP_SIZE_L, modInfo = RWM_READ_OP2_L, affectedCc = cc("--*--")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, OP_SIZE_L, modInfo = RWM_READ_OP2_L, affectedCc = cc("--*--")),
|
||||||
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), ALL_EXCEPT_AREG_AND_DREG, OP_SIZE_B, modInfo = RWM_READ_OP2_B, affectedCc = cc("--*--")),
|
AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), INDIRECT_MODES, OP_SIZE_B, modInfo = RWM_READ_OP2_B, affectedCc = cc("--*--")),
|
||||||
)
|
)
|
||||||
|
|
||||||
private val conditionCodes =
|
private val conditionCodes =
|
||||||
@ -361,9 +293,6 @@ object M68kIsa {
|
|||||||
private val isaData = listOf(
|
private val isaData = listOf(
|
||||||
|
|
||||||
// Data Movement Instructions
|
// Data Movement Instructions
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"move", "Move",
|
"move", "Move",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -373,16 +302,12 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"movea", "Move Address", altMnemonics = listOf("move"),
|
"movea", "Move Address", altMnemonics = listOf("move"),
|
||||||
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_SET_OP2_L))
|
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_SET_OP2_L))
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"movem", "Move Multiple Registers",
|
"movem", "Move Multiple Registers",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.REGISTER_LIST, AddressMode.ADDRESS_REGISTER_DIRECT, AddressMode.DATA_REGISTER_DIRECT),
|
setOf(AddressMode.REGISTER_LIST, AddressMode.ADDRESS_REGISTER_DIRECT, AddressMode.DATA_REGISTER_DIRECT),
|
||||||
@ -429,9 +354,7 @@ object M68kIsa {
|
|||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC,
|
AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC,
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT,
|
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT,
|
||||||
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX,
|
AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX,
|
||||||
AddressMode.ABSOLUTE_ADDRESS,
|
AddressMode.ABSOLUTE_ADDRESS
|
||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT,
|
|
||||||
AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX
|
|
||||||
),
|
),
|
||||||
setOf(AddressMode.IMMEDIATE_DATA),
|
setOf(AddressMode.IMMEDIATE_DATA),
|
||||||
OP_SIZE_WL,
|
OP_SIZE_WL,
|
||||||
@ -439,10 +362,8 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"movep", "Move Peripheral",
|
"movep", "Move Peripheral",
|
||||||
machine = EnumSet.range(Machine.MC68000, Machine.MC68040),
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
DREG_ONLY,
|
DREG_ONLY,
|
||||||
@ -461,13 +382,11 @@ object M68kIsa {
|
|||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"moveq", "Move Quick",
|
"moveq", "Move Quick",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, OP_SIZE_L, modInfo = RWM_SET_OP2_L, affectedCc = cc("-**00")))
|
modes = listOf(AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), DREG_ONLY, OP_SIZE_L, modInfo = RWM_SET_OP2_L, affectedCc = cc("-**00")))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"exg", "Exchange Registers",
|
"exg", "Exchange Registers",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.DATA_REGISTER_DIRECT, AddressMode.ADDRESS_REGISTER_DIRECT),
|
setOf(AddressMode.DATA_REGISTER_DIRECT, AddressMode.ADDRESS_REGISTER_DIRECT),
|
||||||
@ -477,10 +396,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"lea", "Load Effective Address",
|
"lea", "Load Effective Address",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -499,7 +414,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"pea", "Push Effective Address",
|
"pea", "Push Effective Address",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -517,32 +431,22 @@ object M68kIsa {
|
|||||||
modInfo = RWM_MODIFY_STACK
|
modInfo = RWM_MODIFY_STACK
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"link", "Link and Allocate",
|
"link", "Link and Allocate",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(AllowedAdrMode(AREG_ONLY, setOf(AddressMode.IMMEDIATE_DATA), OP_SIZE_W, modInfo = RWM_SET_OP1_L or RWM_MODIFY_STACK))
|
modes = listOf(AllowedAdrMode(AREG_ONLY, setOf(AddressMode.IMMEDIATE_DATA), OP_SIZE_W, modInfo = RWM_SET_OP1_L or RWM_MODIFY_STACK))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"unlk", "Unlink",
|
"unlk", "Unlink",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(AllowedAdrMode(AREG_ONLY, null, OP_UNSIZED, modInfo = RWM_SET_OP1_L or RWM_MODIFY_STACK))
|
modes = listOf(AllowedAdrMode(AREG_ONLY, null, OP_UNSIZED, modInfo = RWM_SET_OP1_L or RWM_MODIFY_STACK))
|
||||||
),
|
),
|
||||||
|
|
||||||
// Integer Arithmetic Instructions
|
// Integer Arithmetic Instructions
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData("add", "Add", modes = ADD_SUB_MODES),
|
IsaData("add", "Add", modes = ADD_SUB_MODES),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"adda", "Add Address", altMnemonics = listOf("add"),
|
"adda", "Add Address", altMnemonics = listOf("add"),
|
||||||
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_L))
|
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_L))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"addi", "Add Immediate", altMnemonics = listOf("add"),
|
"addi", "Add Immediate", altMnemonics = listOf("add"),
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -551,22 +455,14 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
IsaData("addq", "Add Quick", modes = ADDQ_SUBQ_MODES),
|
||||||
IsaData("addq", "Add Quick", modes = ADDQ_SUBQ_MODES)
|
IsaData("addx", "Add with Extend", modes = ADDX_SUBX_MODES),
|
||||||
),
|
|
||||||
|
|
||||||
IsaData("addx", "Add with Extend", machine = ALL_MACHINES, modes = ADDX_SUBX_MODES),
|
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData("sub", "Subtract", modes = ADD_SUB_MODES),
|
IsaData("sub", "Subtract", modes = ADD_SUB_MODES),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"suba", "Subtract Address", altMnemonics = listOf("sub"),
|
"suba", "Subtract Address", altMnemonics = listOf("sub"),
|
||||||
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_L))
|
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_L))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"subi", "Subtract Immediate", altMnemonics = listOf("sub"),
|
"subi", "Subtract Immediate", altMnemonics = listOf("sub"),
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -575,14 +471,8 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
IsaData("subq", "Subtract Quick", modes = ADDQ_SUBQ_MODES),
|
||||||
IsaData("subq", "Subtract Quick", modes = ADDQ_SUBQ_MODES)
|
IsaData("subx", "Subtract with Extend", modes = ADDX_SUBX_MODES),
|
||||||
),
|
|
||||||
|
|
||||||
IsaData("subx", "Subtract with Extend", machine = ALL_MACHINES, modes = ADDX_SUBX_MODES),
|
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"neg", "Negate", modes = listOf(
|
"neg", "Negate", modes = listOf(
|
||||||
@ -592,7 +482,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"negx", "Negate with Extend", modes = listOf(
|
"negx", "Negate with Extend", modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
@ -625,20 +514,10 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"cmpa", "Compare Address", altMnemonics = listOf("cmp"),
|
"cmpa", "Compare Address", altMnemonics = listOf("cmp"),
|
||||||
modes = listOf(
|
modes = listOf(AllowedAdrMode(ALL_68000_MODES, AREG_ONLY, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE or RWM_READ_OP2_L, affectedCc = cc("-****")))
|
||||||
AllowedAdrMode(
|
|
||||||
ALL_68000_MODES,
|
|
||||||
AREG_ONLY,
|
|
||||||
OP_SIZE_WL,
|
|
||||||
modInfo = RWM_READ_OP1_OPSIZE or RWM_READ_OP2_L,
|
|
||||||
affectedCc = cc("-****")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"cmpi", "Compare Immediate", altMnemonics = listOf("cmp"),
|
"cmpi", "Compare Immediate", altMnemonics = listOf("cmp"),
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -647,12 +526,9 @@ object M68kIsa {
|
|||||||
affectedCc = cc("-****")
|
affectedCc = cc("-****")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"cmpm", "Compare Memory to Memory", altMnemonics = listOf("cmp"),
|
"cmpm", "Compare Memory to Memory", altMnemonics = listOf("cmp"),
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC),
|
setOf(AddressMode.ADDRESS_REGISTER_INDIRECT_POST_INC),
|
||||||
@ -663,41 +539,26 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"muls", "Signed Multiply",
|
"muls", "Signed Multiply",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_W or RWM_MODIFY_OP2_L, affectedCc = cc("-**00")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_W or RWM_MODIFY_OP2_L, affectedCc = cc("-**00")))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"mulu", "Unsigned Multiply",
|
"mulu", "Unsigned Multiply",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_W or RWM_MODIFY_OP2_L, affectedCc = cc("-**00")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_W or RWM_MODIFY_OP2_L, affectedCc = cc("-**00")))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"divs", "Signed Divide",
|
"divs", "Signed Divide",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_L or RWM_MODIFY_OP2_L, affectedCc = cc("-***0")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_L or RWM_MODIFY_OP2_L, affectedCc = cc("-***0")))
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"divu", "Unsigned Divide",
|
"divu", "Unsigned Divide",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_L or RWM_MODIFY_OP2_L, affectedCc = cc("-***0")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_L or RWM_MODIFY_OP2_L, affectedCc = cc("-***0")))
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
IsaData(
|
IsaData("ext", "Sign Extend", modes = listOf(AllowedAdrMode(DREG_ONLY, null, OP_SIZE_WL, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**00")))),
|
||||||
"ext",
|
|
||||||
"Sign Extend",
|
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(AllowedAdrMode(DREG_ONLY, null, OP_SIZE_WL, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**00")))
|
|
||||||
),
|
|
||||||
|
|
||||||
// Logical Instructions
|
// Logical Instructions
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"and", "Logical AND",
|
"and", "Logical AND",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -705,7 +566,6 @@ object M68kIsa {
|
|||||||
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**00"))
|
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**00"))
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"andi", "Logical AND Immediate",
|
"andi", "Logical AND Immediate",
|
||||||
altMnemonics = listOf("and"),
|
altMnemonics = listOf("and"),
|
||||||
@ -718,7 +578,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"eor", "Logical Exclusive-OR",
|
"eor", "Logical Exclusive-OR",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -730,7 +589,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"eori", "Logical Exclusive-OR Immediate", altMnemonics = listOf("eor"),
|
"eori", "Logical Exclusive-OR Immediate", altMnemonics = listOf("eor"),
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -742,7 +600,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"or", "Logical Inclusive-OR",
|
"or", "Logical Inclusive-OR",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -750,7 +607,6 @@ object M68kIsa {
|
|||||||
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**00"))
|
AllowedAdrMode(DREG_ONLY, INDIRECT_MODES, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE, affectedCc = cc("-**00"))
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"ori", "Logical Inclusive-OR Immediate", altMnemonics = listOf("or"),
|
"ori", "Logical Inclusive-OR Immediate", altMnemonics = listOf("or"),
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -762,23 +618,20 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"not", "Logical Complement",
|
"not", "Logical Complement",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**00")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, null, modInfo = RWM_MODIFY_OP1_OPSIZE, affectedCc = cc("-**00")))
|
||||||
),
|
),
|
||||||
|
|
||||||
// Shift and Rotate Instructions
|
// Shift and Rotate Instructions
|
||||||
IsaData("asl", "Arithmetic Shift Left", modes = ASL_MODES),
|
IsaData("asl", "Arithmetic Shift Left", modes = ASD_LSD_MODES),
|
||||||
IsaData("asr", "Arithmetic Shift Right", modes = ASR_LSD_MODES),
|
IsaData("asr", "Arithmetic Shift Right", modes = ASD_LSD_MODES),
|
||||||
IsaData("lsl", "Logical Shift Left", modes = ASR_LSD_MODES),
|
IsaData("lsl", "Logical Shift Left", modes = ASD_LSD_MODES),
|
||||||
IsaData("lsr", "Logical Shift Right", modes = ASR_LSD_MODES),
|
IsaData("lsr", "Logical Shift Right", modes = ASD_LSD_MODES),
|
||||||
IsaData("rol", "Rotate Left", modes = ROD_MODES),
|
IsaData("rol", "Rotate Left", modes = ROD_MODES),
|
||||||
IsaData("ror", "Rotate Right", modes = ROD_MODES),
|
IsaData("ror", "Rotate Right", modes = ROD_MODES),
|
||||||
IsaData("roxl", "Rotate with Extend Left", modes = ROXD_MODES),
|
IsaData("roxl", "Rotate with Extend Left", modes = ROXD_MODES),
|
||||||
IsaData("roxr", "Rotate with Extend Right", modes = ROXD_MODES),
|
IsaData("roxr", "Rotate with Extend Right", modes = ROXD_MODES),
|
||||||
),
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"swap",
|
"swap",
|
||||||
"Swap Register Words",
|
"Swap Register Words",
|
||||||
@ -786,19 +639,14 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// Bit Manipulation Instructions
|
// Bit Manipulation Instructions
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
IsaData("bchg", "Test Bit and Change", modes = BCHG_BCLR_BSET_MODES),
|
IsaData("bchg", "Test Bit and Change", modes = BCHG_BCLR_BSET_MODES),
|
||||||
IsaData("bclr", "Test Bit and Clear", modes = BCHG_BCLR_BSET_MODES),
|
IsaData("bclr", "Test Bit and Clear", modes = BCHG_BCLR_BSET_MODES),
|
||||||
IsaData("bset", "Test Bit and Set", modes = BCHG_BCLR_BSET_MODES),
|
IsaData("bset", "Test Bit and Set", modes = BCHG_BCLR_BSET_MODES),
|
||||||
IsaData("btst", "Test Bit", modes = BTST_MODES),
|
IsaData("btst", "Test Bit", modes = BTST_MODES),
|
||||||
),
|
|
||||||
|
|
||||||
// Binary-Coded Decimal Instructions
|
// Binary-Coded Decimal Instructions
|
||||||
IsaData(
|
IsaData(
|
||||||
"abcd", "Add Decimal with Extend",
|
"abcd", "Add Decimal with Extend",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
DREG_ONLY, DREG_ONLY, OP_SIZE_B, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE,
|
DREG_ONLY, DREG_ONLY, OP_SIZE_B, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE,
|
||||||
@ -815,7 +663,6 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
IsaData(
|
IsaData(
|
||||||
"sbcd", "Subtract Decimal with Extend",
|
"sbcd", "Subtract Decimal with Extend",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
DREG_ONLY, DREG_ONLY, OP_SIZE_B, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE,
|
DREG_ONLY, DREG_ONLY, OP_SIZE_B, modInfo = RWM_READ_OP1_OPSIZE or RWM_MODIFY_OP2_OPSIZE,
|
||||||
@ -830,9 +677,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"nbcd", "Negate Decimal with Extend",
|
"nbcd", "Negate Decimal with Extend",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -841,7 +685,6 @@ object M68kIsa {
|
|||||||
affectedCc = cc("CUAU*"), testedCc = cc("?-?--")
|
affectedCc = cc("CUAU*"), testedCc = cc("?-?--")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// Program Control Instructions
|
// Program Control Instructions
|
||||||
@ -870,10 +713,6 @@ object M68kIsa {
|
|||||||
modes = listOf(AllowedAdrMode(DREG_ONLY, setOf(AddressMode.ABSOLUTE_ADDRESS), OP_SIZE_W, modInfo = RWM_MODIFY_OP1_W, testedCc = cc("-????"))),
|
modes = listOf(AllowedAdrMode(DREG_ONLY, setOf(AddressMode.ABSOLUTE_ADDRESS), OP_SIZE_W, modInfo = RWM_MODIFY_OP1_W, testedCc = cc("-????"))),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"sCC", "Set Conditionally", conditionCodes = conditionCodes,
|
"sCC", "Set Conditionally", conditionCodes = conditionCodes,
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, null, OP_SIZE_B, modInfo = RWM_SET_OP2_B, testedCc = cc("-????")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, null, OP_SIZE_B, modInfo = RWM_SET_OP2_B, testedCc = cc("-????")))
|
||||||
@ -910,30 +749,24 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
IsaData("nop", "No Operation", hasOps = false, modes = NO_OPS_UNSIZED),
|
||||||
IsaData("nop", "No Operation", machine = ALL_MACHINES, hasOps = false, modes = NO_OPS_UNSIZED),
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"rtr",
|
"rtr",
|
||||||
"Return and Restore",
|
"Return and Restore",
|
||||||
machine = ALL_MACHINES,
|
|
||||||
hasOps = false,
|
hasOps = false,
|
||||||
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK, affectedCc = cc("*****"))),
|
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK, affectedCc = cc("*****"))),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
),
|
),
|
||||||
IsaData(
|
IsaData(
|
||||||
"rts", "Return from Subroutine", hasOps = false,
|
"rts", "Return from Subroutine", hasOps = false,
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
|
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"tst", "Test Operand",
|
"tst", "Test Operand", modes = listOf(
|
||||||
machine = MC68000_ONLY,
|
|
||||||
modes = listOf(
|
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, null, modInfo = RWM_READ_OP1_OPSIZE,
|
ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL, null, modInfo = RWM_READ_OP1_OPSIZE,
|
||||||
affectedCc = cc("-**00")
|
affectedCc = cc("-**00")
|
||||||
@ -941,25 +774,9 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
|
||||||
"tst", "Test Operand",
|
|
||||||
machine = MC68020_PLUS,
|
|
||||||
modes = listOf(
|
|
||||||
AllowedAdrMode(
|
|
||||||
ALL_68020_MODES.minus(AddressMode.ADDRESS_REGISTER_DIRECT), null, modInfo = RWM_READ_OP1_OPSIZE,
|
|
||||||
affectedCc = cc("-**00")
|
|
||||||
),
|
|
||||||
AllowedAdrMode(
|
|
||||||
setOf(AddressMode.ADDRESS_REGISTER_DIRECT), null, OP_SIZE_WL, modInfo = RWM_READ_OP1_OPSIZE,
|
|
||||||
affectedCc = cc("-**00")
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
// System Control Instructions
|
// System Control Instructions
|
||||||
IsaData(
|
IsaData(
|
||||||
"andi", "AND Immediate to Status Register", id = "andi to SR", altMnemonics = listOf("and"), isPrivileged = true,
|
"andi", "AND Immediate to Status Register", id = "andi to SR", altMnemonics = listOf("and"), isPrivileged = true,
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.IMMEDIATE_DATA), setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "sr",
|
setOf(AddressMode.IMMEDIATE_DATA), setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "sr",
|
||||||
@ -969,7 +786,6 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
IsaData(
|
IsaData(
|
||||||
"eori", "Exclusive-OR Immediate to Status Register", id = "eori to SR", altMnemonics = listOf("eor"), isPrivileged = true,
|
"eori", "Exclusive-OR Immediate to Status Register", id = "eori to SR", altMnemonics = listOf("eor"), isPrivileged = true,
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.IMMEDIATE_DATA), setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "sr",
|
setOf(AddressMode.IMMEDIATE_DATA), setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "sr",
|
||||||
@ -979,7 +795,6 @@ object M68kIsa {
|
|||||||
),
|
),
|
||||||
IsaData(
|
IsaData(
|
||||||
"ori", "Inclusive-OR Immediate to Status Register", id = "ori to SR", altMnemonics = listOf("or"), isPrivileged = true,
|
"ori", "Inclusive-OR Immediate to Status Register", id = "ori to SR", altMnemonics = listOf("or"), isPrivileged = true,
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.IMMEDIATE_DATA), setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "sr",
|
setOf(AddressMode.IMMEDIATE_DATA), setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "sr",
|
||||||
@ -987,10 +802,8 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"move", "Move from Status Register", id = "move from SR",
|
"move", "Move from Status Register", id = "move from SR",
|
||||||
machine = MC68000_ONLY,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(
|
AllowedAdrMode(
|
||||||
setOf(AddressMode.SPECIAL_REGISTER_DIRECT),
|
setOf(AddressMode.SPECIAL_REGISTER_DIRECT),
|
||||||
@ -1002,25 +815,6 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
|
||||||
"move", "Move from Status Register", id = "move from SR", isPrivileged = true,
|
|
||||||
machine = EnumSet.range(Machine.MC68010, Machine.MC68060),
|
|
||||||
modes = listOf(
|
|
||||||
AllowedAdrMode(
|
|
||||||
setOf(AddressMode.SPECIAL_REGISTER_DIRECT),
|
|
||||||
ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL,
|
|
||||||
OP_SIZE_W,
|
|
||||||
"sr",
|
|
||||||
modInfo = RWM_SET_OP2_W,
|
|
||||||
testedCc = cc("?????")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"move", "Move to Status Register", id = "move to SR", isPrivileged = true,
|
"move", "Move to Status Register", id = "move to SR", isPrivileged = true,
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
@ -1029,85 +823,34 @@ object M68kIsa {
|
|||||||
affectedCc = cc("*****")
|
affectedCc = cc("*****")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"move", "Move User Stack Pointer", id = "move USP", isPrivileged = true,
|
"move", "Move User Stack Pointer", id = "move USP", isPrivileged = true,
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(setOf(AddressMode.SPECIAL_REGISTER_DIRECT), AREG_ONLY, OP_SIZE_L, "usp", modInfo = RWM_SET_OP2_L),
|
AllowedAdrMode(setOf(AddressMode.SPECIAL_REGISTER_DIRECT), AREG_ONLY, OP_SIZE_L, "usp", modInfo = RWM_SET_OP2_L),
|
||||||
AllowedAdrMode(AREG_ONLY, setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_L, "usp", modInfo = RWM_READ_OP1_L),
|
AllowedAdrMode(AREG_ONLY, setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_L, "usp", modInfo = RWM_READ_OP1_L),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
IsaData("reset", "Reset External Devices", isPrivileged = true, hasOps = false, modes = NO_OPS_UNSIZED),
|
||||||
IsaData(
|
IsaData(
|
||||||
"movec", "Move Control Register", isPrivileged = true,
|
"rte", "Return from Exception", isPrivileged = true, hasOps = false,
|
||||||
machine = EnumSet.range(Machine.MC68010, Machine.MC68060),
|
|
||||||
modes = listOf(
|
|
||||||
AllowedAdrMode(setOf(AddressMode.SPECIAL_REGISTER_DIRECT), DREG_AREG, OP_SIZE_L, "sfc|dfc|usp|vbr", modInfo = RWM_SET_OP2_L),
|
|
||||||
AllowedAdrMode(DREG_AREG, setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_L, "sfc|dfc|usp|vbr", modInfo = RWM_READ_OP1_L),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
IsaData(
|
|
||||||
"moves", "Move Address Space", isPrivileged = true,
|
|
||||||
machine = EnumSet.range(Machine.MC68010, Machine.MC68060),
|
|
||||||
modes = listOf(
|
|
||||||
AllowedAdrMode(
|
|
||||||
ALL_68020_MODES_EXCEPT_IMMEDIATE_AND_PC_REL.minus(
|
|
||||||
listOf(
|
|
||||||
AddressMode.DATA_REGISTER_DIRECT,
|
|
||||||
AddressMode.ADDRESS_REGISTER_DIRECT
|
|
||||||
)
|
|
||||||
), DREG_AREG, modInfo = RWM_SET_OP2_OPSIZE
|
|
||||||
),
|
|
||||||
AllowedAdrMode(
|
|
||||||
DREG_AREG, ALL_68020_MODES_EXCEPT_IMMEDIATE_AND_PC_REL.minus(
|
|
||||||
listOf(
|
|
||||||
AddressMode.DATA_REGISTER_DIRECT,
|
|
||||||
AddressMode.ADDRESS_REGISTER_DIRECT
|
|
||||||
)
|
|
||||||
), modInfo = RWM_READ_OP1_OPSIZE
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
IsaData("reset", "Reset External Devices", machine = ALL_MACHINES, isPrivileged = true, hasOps = false, modes = NO_OPS_UNSIZED),
|
|
||||||
|
|
||||||
IsaData(
|
|
||||||
"rte", "Return from Exception",
|
|
||||||
machine = ALL_MACHINES, isPrivileged = true, hasOps = false,
|
|
||||||
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
|
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, modInfo = RWM_MODIFY_STACK)),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
),
|
),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"stop", "Stop",
|
"stop", "Stop", isPrivileged = true,
|
||||||
machine = ALL_MACHINES, isPrivileged = true,
|
|
||||||
modes = listOf(AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), null, OP_UNSIZED))
|
modes = listOf(AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), null, OP_UNSIZED))
|
||||||
),
|
),
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"chk", "Check Register Against Bound",
|
"chk", "Check Register Against Bound",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_W or RWM_READ_OP2_W, affectedCc = cc("-*UUU")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_AREG, DREG_ONLY, OP_SIZE_W, modInfo = RWM_READ_OP1_W or RWM_READ_OP2_W, affectedCc = cc("-*UUU")))
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
IsaData("illegal", "Take Illegal Instruction Trap", hasOps = false, modes = NO_OPS_UNSIZED, changesControlFlow = true),
|
||||||
IsaData("illegal", "Take Illegal Instruction Trap", machine = ALL_MACHINES, hasOps = false, modes = NO_OPS_UNSIZED, changesControlFlow = true),
|
IsaData("trap", "Trap", modes = listOf(AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), null, OP_UNSIZED)), changesControlFlow = true),
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"trap",
|
"trapv", "Trap on Overflow", hasOps = false,
|
||||||
"Trap",
|
|
||||||
machine = ALL_MACHINES,
|
|
||||||
modes = listOf(AllowedAdrMode(setOf(AddressMode.IMMEDIATE_DATA), null, OP_UNSIZED)),
|
|
||||||
changesControlFlow = true
|
|
||||||
),
|
|
||||||
IsaData(
|
|
||||||
"trapv", "Trap on Overflow",
|
|
||||||
machine = ALL_MACHINES, hasOps = false,
|
|
||||||
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, testedCc = cc("---?-"))),
|
modes = listOf(AllowedAdrMode(size = OP_UNSIZED, testedCc = cc("---?-"))),
|
||||||
changesControlFlow = true
|
changesControlFlow = true
|
||||||
),
|
),
|
||||||
@ -1139,72 +882,19 @@ object M68kIsa {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
|
|
||||||
IsaData(
|
|
||||||
"move", "Move from Condition Code Register", id = "move from CCR",
|
|
||||||
machine = EnumSet.of(Machine.MC68010),
|
|
||||||
modes = listOf(
|
|
||||||
AllowedAdrMode(
|
|
||||||
setOf(AddressMode.SPECIAL_REGISTER_DIRECT),
|
|
||||||
ALL_EXCEPT_AREG_IMMEDIATE_AND_PC_REL,
|
|
||||||
OP_SIZE_W,
|
|
||||||
"ccr",
|
|
||||||
modInfo = RWM_SET_OP2_W,
|
|
||||||
testedCc = cc("?????")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"move", "Move to Condition Code Register", id = "move to CCR",
|
"move", "Move to Condition Code Register", id = "move to CCR",
|
||||||
modes = listOf(
|
modes = listOf(
|
||||||
AllowedAdrMode(ALL_EXCEPT_AREG, setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "ccr", affectedCc = cc("*****")),
|
AllowedAdrMode(ALL_EXCEPT_AREG, setOf(AddressMode.SPECIAL_REGISTER_DIRECT), OP_SIZE_W, "ccr", affectedCc = cc("*****")),
|
||||||
)
|
)
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// Multiprocessor Instructions
|
// Multiprocessor Instructions
|
||||||
*autoExpandForOtherCpus(
|
|
||||||
MC68020_PLUS,
|
|
||||||
IsaData(
|
IsaData(
|
||||||
"tas", "Test Operand and Set",
|
"tas", "Test Operand and Set",
|
||||||
modes = listOf(AllowedAdrMode(ALL_EXCEPT_IMMEDIATE_AND_PC_REL, null, OP_SIZE_B, modInfo = RWM_MODIFY_OP1_B, affectedCc = cc("-**00")))
|
modes = listOf(AllowedAdrMode(ALL_EXCEPT_IMMEDIATE_AND_PC_REL, null, OP_SIZE_B, modInfo = RWM_MODIFY_OP1_B, affectedCc = cc("-**00")))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
private fun autoExpandForOtherCpus(machines: Set<Machine>, vararg isaDatas: IsaData): Array<out IsaData> {
|
|
||||||
val allIsaData = ArrayList<IsaData>()
|
|
||||||
for (isaData in isaDatas) {
|
|
||||||
val newModes = isaData.modes.map { it.copy(op1 = add68020Modes(it.op1), op2 = add68020Modes(it.op2)) }
|
|
||||||
allIsaData.add(isaData.copy(machine = machines, modes = newModes))
|
|
||||||
}
|
|
||||||
return allIsaData.toTypedArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun add68020Modes(oldModes: Set<AddressMode>?) = if (oldModes != null) {
|
|
||||||
val newModes = oldModes.toMutableSet()
|
|
||||||
if (oldModes.contains(AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX)) {
|
|
||||||
newModes.add(AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_SCALED_INDEX)
|
|
||||||
newModes.add(AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_BASE_DISPLACEMENT)
|
|
||||||
newModes.add(AddressMode.MEMORY_INDIRECT)
|
|
||||||
newModes.add(AddressMode.MEMORY_INDIRECT_POSTINDEXED)
|
|
||||||
newModes.add(AddressMode.MEMORY_INDIRECT_PREINDEXED)
|
|
||||||
}
|
|
||||||
if (oldModes.contains(AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX)) {
|
|
||||||
newModes.add(AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_SCALED_INDEX)
|
|
||||||
newModes.add(AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_BASE_DISPLACEMENT)
|
|
||||||
newModes.add(AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT)
|
|
||||||
newModes.add(AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT_POSTINDEXED)
|
|
||||||
newModes.add(AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT_PREINDEXED)
|
|
||||||
}
|
|
||||||
newModes
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
private val mnemonicLookupMap = isaData.asSequence()
|
private val mnemonicLookupMap = isaData.asSequence()
|
||||||
.flatMap {
|
.flatMap {
|
||||||
@ -1254,5 +944,5 @@ object M68kIsa {
|
|||||||
private fun isAddressModeMatching(am: AllowedAdrMode, op1: AddressMode?, op2: AddressMode?, specialReg: String?) =
|
private fun isAddressModeMatching(am: AllowedAdrMode, op1: AddressMode?, op2: AddressMode?, specialReg: String?) =
|
||||||
((((op1 == null) && (am.op1 == null)) || am.op1?.contains(op1) ?: false)
|
((((op1 == null) && (am.op1 == null)) || am.op1?.contains(op1) ?: false)
|
||||||
&& (((op2 == null) && (am.op2 == null)) || am.op2?.contains(op2) ?: false)
|
&& (((op2 == null) && (am.op2 == null)) || am.op2?.contains(op2) ?: false)
|
||||||
&& ((specialReg == null) || (am.specialReg?.split('|')?.any { it.equals(specialReg, true) } ?: false)))
|
&& ((specialReg == null) || (specialReg == am.specialReg)))
|
||||||
}
|
}
|
@ -1,39 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.documentation
|
|
||||||
|
|
||||||
import com.intellij.lang.documentation.AbstractDocumentationProvider
|
|
||||||
import com.intellij.lang.documentation.DocumentationMarkup
|
|
||||||
import com.intellij.openapi.util.text.HtmlBuilder
|
|
||||||
import com.intellij.openapi.util.text.HtmlChunk
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kNamedElement
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kPsiWalkUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.settings.M68kProjectSettings
|
|
||||||
|
|
||||||
abstract class AbstractM68kDocumentationProvider : AbstractDocumentationProvider() {
|
|
||||||
|
|
||||||
fun getSettings(element: PsiElement): M68kLexerPrefs = element.project.getService(M68kProjectSettings::class.java).settings
|
|
||||||
|
|
||||||
fun getComments(element: PsiElement): HtmlChunk {
|
|
||||||
val builder = HtmlBuilder()
|
|
||||||
val comments = M68kPsiWalkUtil.collectRelatedComments(element).map { HtmlChunk.text(it.text) }
|
|
||||||
builder.appendWithSeparators(HtmlChunk.br(), comments)
|
|
||||||
return if (comments.isNotEmpty()) builder.wrapWith(HtmlChunk.span().attr("class", "grayed")) else HtmlChunk.empty()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getDefinition(element: M68kNamedElement) = getDefinition(HtmlChunk.text(element.name!!).code())
|
|
||||||
|
|
||||||
fun getDefinition(value: String) = getDefinition(HtmlChunk.text(value))
|
|
||||||
|
|
||||||
fun getDefinition(chunk: HtmlChunk) =
|
|
||||||
HtmlBuilder().append(chunk).wrapWith(DocumentationMarkup.DEFINITION_ELEMENT)
|
|
||||||
|
|
||||||
fun getContent(element: PsiElement) =
|
|
||||||
HtmlBuilder().append(HtmlChunk.text(element.text).code()).wrapWith(DocumentationMarkup.CONTENT_ELEMENT)
|
|
||||||
|
|
||||||
fun getContent(chunk: HtmlChunk) =
|
|
||||||
HtmlBuilder().append(chunk).wrapWith(DocumentationMarkup.CONTENT_ELEMENT)
|
|
||||||
|
|
||||||
fun getContent(value: String) =
|
|
||||||
HtmlBuilder().append(value).wrapWith(DocumentationMarkup.CONTENT_ELEMENT)
|
|
||||||
}
|
|
@ -92,8 +92,8 @@ class M68kInstructionDocumentationProvider : AbstractDocumentationProvider() {
|
|||||||
val cellsPerRow = ArrayList<HtmlChunk>(3)
|
val cellsPerRow = ArrayList<HtmlChunk>(3)
|
||||||
cellsPerRow.add(contentBuilder.toFragment())
|
cellsPerRow.add(contentBuilder.toFragment())
|
||||||
|
|
||||||
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op1, allowedAdrMode.specialReg))
|
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op1))
|
||||||
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op2, allowedAdrMode.specialReg))
|
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op2))
|
||||||
|
|
||||||
addressModeInfoRows.append(HtmlChunk.tag("tr").children(cellsPerRow.map { it.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL) }))
|
addressModeInfoRows.append(HtmlChunk.tag("tr").children(cellsPerRow.map { it.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL) }))
|
||||||
addressModeInfoRows.toFragment()
|
addressModeInfoRows.toFragment()
|
||||||
@ -126,12 +126,11 @@ class M68kInstructionDocumentationProvider : AbstractDocumentationProvider() {
|
|||||||
return defBuilder
|
return defBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun collectAddressModes(addressModes: Set<AddressMode>?, specialReg: String?): HtmlChunk {
|
private fun collectAddressModes(addressModes: Set<AddressMode>?): HtmlChunk {
|
||||||
if (addressModes == null) return HtmlChunk.text("")
|
if (addressModes == null) return HtmlChunk.text("")
|
||||||
val modes = HtmlBuilder()
|
val modes = HtmlBuilder()
|
||||||
addressModes.sortedBy(AddressMode::ordinal)
|
addressModes.sortedBy(AddressMode::ordinal)
|
||||||
.map { if (it == AddressMode.SPECIAL_REGISTER_DIRECT) specialReg!! else it.syntax }
|
.forEach { modes.append(HtmlChunk.text(it.syntax).wrapWith(HtmlChunk.div())) }
|
||||||
.forEach { modes.append(HtmlChunk.text(it).wrapWith(HtmlChunk.div())) }
|
|
||||||
return modes.toFragment()
|
return modes.toFragment()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.documentation
|
|
||||||
|
|
||||||
import com.intellij.openapi.util.text.HtmlBuilder
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kNamedElement
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kStatement
|
|
||||||
|
|
||||||
class M68kLabelDefinitionDocumentationProvider : AbstractM68kDocumentationProvider() {
|
|
||||||
|
|
||||||
override fun getQuickNavigateInfo(element: PsiElement, originalElement: PsiElement?): String? {
|
|
||||||
return generateDoc(element, originalElement)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
|
||||||
return if (element is M68kGlobalLabel || element is M68kLocalLabel) {
|
|
||||||
// TODO find out how we can generate inner links for more symbol references inside the expression (DocumentationManagerUtil)
|
|
||||||
val statement = element.parent as M68kStatement
|
|
||||||
var preprocessorDirective = statement.preprocessorDirective
|
|
||||||
if ((preprocessorDirective == null) && (statement.asmInstruction == null) && (statement.macroCall == null)) {
|
|
||||||
val nextLineStatement = PsiTreeUtil.skipWhitespacesAndCommentsForward(PsiTreeUtil.skipWhitespacesAndCommentsForward(statement))
|
|
||||||
as? M68kStatement
|
|
||||||
preprocessorDirective = nextLineStatement?.preprocessorDirective
|
|
||||||
}
|
|
||||||
val builder = HtmlBuilder()
|
|
||||||
builder.append(getComments(statement))
|
|
||||||
builder.append(getDefinition(element as M68kNamedElement))
|
|
||||||
if (preprocessorDirective != null) builder.append(getContent(preprocessorDirective))
|
|
||||||
builder.toString()
|
|
||||||
} else null
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.documentation
|
|
||||||
|
|
||||||
import com.intellij.openapi.util.text.HtmlBuilder
|
|
||||||
import com.intellij.openapi.util.text.HtmlChunk
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroDefinition
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kMacroExpansionUtil
|
|
||||||
|
|
||||||
class M68kMacroDefinitionDocumentationProvider : AbstractM68kDocumentationProvider() {
|
|
||||||
|
|
||||||
override fun getQuickNavigateInfo(element: PsiElement, originalElement: PsiElement?): String? {
|
|
||||||
return generateDoc(element, originalElement)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
|
||||||
return if (element is M68kMacroDefinition) createDoc(element, originalElement, getSettings(element).maxLongDocumentationLines) else null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun generateHoverDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
|
||||||
return if (element is M68kMacroDefinition) createDoc(element, originalElement, getSettings(element).maxShortDocumentationLines) else null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createDoc(macrodef: M68kMacroDefinition, originalElement: PsiElement?, linesLimit: Int): String {
|
|
||||||
val macroCall = PsiTreeUtil.getParentOfType(originalElement, M68kMacroCall::class.java)
|
|
||||||
val expandedMacro = M68kMacroExpansionUtil.expandMacro(macrodef, macroCall)
|
|
||||||
val builder = HtmlBuilder()
|
|
||||||
return builder
|
|
||||||
.append(getComments(macrodef))
|
|
||||||
.append(getDefinition(HtmlChunk.text(macrodef.name!!).code()))
|
|
||||||
.append(
|
|
||||||
getContent(
|
|
||||||
HtmlBuilder().appendWithSeparators(
|
|
||||||
HtmlChunk.br(),
|
|
||||||
expandedMacro.take(linesLimit).map { HtmlChunk.text(it).code() }.toList()
|
|
||||||
).toFragment()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.toString()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.documentation
|
package de.platon42.intellij.plugins.m68k.documentation
|
||||||
|
|
||||||
|
import com.intellij.lang.documentation.AbstractDocumentationProvider
|
||||||
import com.intellij.lang.documentation.DocumentationMarkup
|
import com.intellij.lang.documentation.DocumentationMarkup
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.text.HtmlBuilder
|
import com.intellij.openapi.util.text.HtmlBuilder
|
||||||
@ -18,18 +19,18 @@ import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.findExactIsaDataAndAl
|
|||||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.getOpSizeOrDefault
|
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.getOpSizeOrDefault
|
||||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.modifyRwmWithOpsize
|
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.modifyRwmWithOpsize
|
||||||
|
|
||||||
class M68kRegisterFlowDocumentationProvider : AbstractM68kDocumentationProvider() {
|
class M68kRegisterFlowDocumentationProvider : AbstractDocumentationProvider() {
|
||||||
|
|
||||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||||
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
||||||
return createDoc(element as M68kRegister, getSettings(element).maxLongDocumentationLines)
|
return createDoc(element as M68kRegister, 100) // TODO make this configurable
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun generateHoverDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
override fun generateHoverDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||||
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
||||||
return createDoc(element as M68kRegister, getSettings(element).maxShortDocumentationLines)
|
return createDoc(element as M68kRegister, 4) // TODO make this configurable
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -78,19 +79,24 @@ class M68kRegisterFlowDocumentationProvider : AbstractM68kDocumentationProvider(
|
|||||||
)
|
)
|
||||||
|
|
||||||
backtrace.addAll(analyseFlow(register, missingBits, true, initialStatement, linesLimit) {
|
backtrace.addAll(analyseFlow(register, missingBits, true, initialStatement, linesLimit) {
|
||||||
PsiTreeUtil.getPrevSiblingOfType(it, M68kStatement::class.java)
|
PsiTreeUtil.getPrevSiblingOfType(
|
||||||
|
it,
|
||||||
|
M68kStatement::class.java
|
||||||
|
)
|
||||||
})
|
})
|
||||||
backtrace.reverse()
|
backtrace.reverse()
|
||||||
val remLines = linesLimit - backtrace.size.coerceAtLeast(1)
|
|
||||||
val traceBits = (cursorRwm or (cursorRwm ushr RWM_MODIFY_SHIFT) or (cursorRwm ushr RWM_READ_SHIFT)) and RWM_SIZE_MASK
|
val traceBits = (cursorRwm or (cursorRwm ushr RWM_MODIFY_SHIFT) or (cursorRwm ushr RWM_READ_SHIFT)) and RWM_SIZE_MASK
|
||||||
backtrace.addAll(analyseFlow(register, traceBits, false, initialStatement, remLines) {
|
backtrace.addAll(analyseFlow(register, traceBits, false, initialStatement, linesLimit) {
|
||||||
PsiTreeUtil.getNextSiblingOfType(it, M68kStatement::class.java)
|
PsiTreeUtil.getNextSiblingOfType(
|
||||||
|
it,
|
||||||
|
M68kStatement::class.java
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
val statementRows = HtmlBuilder()
|
val statementRows = HtmlBuilder()
|
||||||
backtrace.forEach(statementRows::append)
|
backtrace.forEach(statementRows::append)
|
||||||
val builder = HtmlBuilder()
|
val builder = HtmlBuilder()
|
||||||
builder.append(getDefinition(thisInfo))
|
builder.append(HtmlChunk.text(thisInfo).wrapWith(DocumentationMarkup.DEFINITION_ELEMENT))
|
||||||
builder.append(statementRows.wrapWith(DocumentationMarkup.SECTIONS_TABLE.style("padding-left: 8pt; padding-right: 8pt")))
|
builder.append(statementRows.wrapWith(DocumentationMarkup.SECTIONS_TABLE.style("padding-left: 8pt; padding-right: 8pt")))
|
||||||
return builder.toString()
|
return builder.toString()
|
||||||
}
|
}
|
||||||
@ -107,7 +113,7 @@ class M68kRegisterFlowDocumentationProvider : AbstractM68kDocumentationProvider(
|
|||||||
var currStatement = startingStatement
|
var currStatement = startingStatement
|
||||||
val statementLines = ArrayList<HtmlChunk>()
|
val statementLines = ArrayList<HtmlChunk>()
|
||||||
val rn = register.regname
|
val rn = register.regname
|
||||||
var addAbbrevDots = false
|
var addAbrevDots = false
|
||||||
var lines = 0
|
var lines = 0
|
||||||
while (missingBits > 0) {
|
while (missingBits > 0) {
|
||||||
val globalLabel = PsiTreeUtil.findChildOfType(currStatement, M68kGlobalLabel::class.java)
|
val globalLabel = PsiTreeUtil.findChildOfType(currStatement, M68kGlobalLabel::class.java)
|
||||||
@ -121,17 +127,17 @@ class M68kRegisterFlowDocumentationProvider : AbstractM68kDocumentationProvider(
|
|||||||
currStatement = direction.invoke(currStatement) ?: break
|
currStatement = direction.invoke(currStatement) ?: break
|
||||||
val currAsmInstruction = PsiTreeUtil.getChildOfType(currStatement, M68kAsmInstruction::class.java) ?: continue
|
val currAsmInstruction = PsiTreeUtil.getChildOfType(currStatement, M68kAsmInstruction::class.java) ?: continue
|
||||||
if (checkIfInstructionUsesRegister(currAsmInstruction, register)) {
|
if (checkIfInstructionUsesRegister(currAsmInstruction, register)) {
|
||||||
if (addAbbrevDots) {
|
if (addAbrevDots) {
|
||||||
++lines
|
++lines
|
||||||
statementLines.add(createAbbreviationDots())
|
statementLines.add(createAbbreviationDots())
|
||||||
}
|
}
|
||||||
if (++lines > linesLimit) {
|
if (++lines > linesLimit) {
|
||||||
if (!addAbbrevDots) {
|
if (!addAbrevDots) {
|
||||||
statementLines.add(createAbbreviationDots())
|
statementLines.add(createAbbreviationDots())
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
addAbbrevDots = false
|
addAbrevDots = false
|
||||||
val (_, currAdrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(currAsmInstruction) ?: continue
|
val (_, currAdrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(currAsmInstruction) ?: continue
|
||||||
|
|
||||||
val localLabelName = PsiTreeUtil.findChildOfType(currStatement, M68kLocalLabel::class.java)?.name ?: " "
|
val localLabelName = PsiTreeUtil.findChildOfType(currStatement, M68kLocalLabel::class.java)?.name ?: " "
|
||||||
@ -157,7 +163,7 @@ class M68kRegisterFlowDocumentationProvider : AbstractM68kDocumentationProvider(
|
|||||||
.children(lineBuilder.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL))
|
.children(lineBuilder.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL))
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
addAbbrevDots = true
|
addAbrevDots = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return statementLines
|
return statementLines
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.documentation
|
package de.platon42.intellij.plugins.m68k.documentation
|
||||||
|
|
||||||
import com.intellij.openapi.util.text.HtmlBuilder
|
import com.intellij.lang.documentation.AbstractDocumentationProvider
|
||||||
|
import com.intellij.lang.documentation.DocumentationMarkup
|
||||||
|
import com.intellij.openapi.util.text.StringUtil
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kAssignment
|
import de.platon42.intellij.plugins.m68k.psi.M68kAssignment
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||||
|
|
||||||
class M68kSymbolDefinitionDocumentationProvider : AbstractM68kDocumentationProvider() {
|
class M68kSymbolDefinitionDocumentationProvider : AbstractDocumentationProvider() {
|
||||||
|
|
||||||
override fun getQuickNavigateInfo(element: PsiElement, originalElement: PsiElement?): String? {
|
override fun getQuickNavigateInfo(element: PsiElement, originalElement: PsiElement?): String? {
|
||||||
return generateDoc(element, originalElement)
|
return generateDoc(element, originalElement)
|
||||||
@ -14,12 +16,9 @@ class M68kSymbolDefinitionDocumentationProvider : AbstractM68kDocumentationProvi
|
|||||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||||
return if (element is M68kSymbolDefinition) {
|
return if (element is M68kSymbolDefinition) {
|
||||||
// TODO find out how we can generate inner links for more symbol references inside the expression (DocumentationManagerUtil)
|
// TODO find out how we can generate inner links for more symbol references inside the expression (DocumentationManagerUtil)
|
||||||
val assignment = element.parent as M68kAssignment
|
val value = (element.getParent() as M68kAssignment).expr.text
|
||||||
HtmlBuilder()
|
DocumentationMarkup.DEFINITION_START + StringUtil.escapeXmlEntities(element.name!!) + DocumentationMarkup.DEFINITION_END +
|
||||||
.append(getComments(assignment.parent))
|
DocumentationMarkup.CONTENT_START + StringUtil.escapeXmlEntities(value) + DocumentationMarkup.CONTENT_END
|
||||||
.append(getDefinition(element))
|
|
||||||
.append(getContent(assignment.expr))
|
|
||||||
.toString()
|
|
||||||
} else null
|
} else null
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,67 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.folding
|
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode
|
|
||||||
import com.intellij.lang.folding.FoldingBuilderEx
|
|
||||||
import com.intellij.lang.folding.FoldingDescriptor
|
|
||||||
import com.intellij.openapi.editor.Document
|
|
||||||
import com.intellij.openapi.project.DumbAware
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import com.intellij.refactoring.suggested.endOffset
|
|
||||||
import com.intellij.refactoring.suggested.startOffset
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroDefinition
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kStatement
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kPsiWalkUtil.getBeginningOfRelatedComment
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kPsiWalkUtil.isSignificantLine
|
|
||||||
|
|
||||||
class M68kFoldingBuilder : FoldingBuilderEx(), DumbAware {
|
|
||||||
|
|
||||||
override fun buildFoldRegions(root: PsiElement, document: Document, quick: Boolean): Array<FoldingDescriptor> {
|
|
||||||
if (root !is M68kFile) return FoldingDescriptor.EMPTY
|
|
||||||
|
|
||||||
val descriptors = ArrayList<FoldingDescriptor>()
|
|
||||||
var lineElement = root.firstChild
|
|
||||||
var foldingOpen = false
|
|
||||||
var foldingStart: PsiElement? = null
|
|
||||||
var foldingName: String? = null
|
|
||||||
var lastStatement = lineElement as? M68kStatement
|
|
||||||
while (lineElement != null) {
|
|
||||||
if (lineElement is M68kMacroDefinition) {
|
|
||||||
val fd = FoldingDescriptor(lineElement, lineElement.startOffset, lineElement.endOffset, null, "[[[ MACRO " + lineElement.name!! + " ]]]")
|
|
||||||
descriptors.add(fd)
|
|
||||||
}
|
|
||||||
if (lineElement is M68kStatement) {
|
|
||||||
val label = lineElement.globalLabel
|
|
||||||
if (label != null) {
|
|
||||||
foldingOpen = true
|
|
||||||
foldingStart = getBeginningOfRelatedComment(lineElement)
|
|
||||||
foldingName = "[[[ ${label.name} ]]]"
|
|
||||||
}
|
|
||||||
lastStatement = lineElement
|
|
||||||
}
|
|
||||||
lineElement = PsiTreeUtil.skipWhitespacesAndCommentsForward(lineElement)
|
|
||||||
if (foldingOpen) {
|
|
||||||
val stopIt = (lineElement == null) || isSignificantLine(lineElement)
|
|
||||||
if (stopIt) {
|
|
||||||
val fd = FoldingDescriptor(
|
|
||||||
foldingStart!!.parent!!,
|
|
||||||
foldingStart.startOffsetInParent, lastStatement!!.textRangeInParent.endOffset,
|
|
||||||
null, foldingName!!
|
|
||||||
)
|
|
||||||
descriptors.add(fd)
|
|
||||||
foldingOpen = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return descriptors.toArray(FoldingDescriptor.EMPTY)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPlaceholderText(node: ASTNode): String? {
|
|
||||||
return "..."
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isCollapsedByDefault(node: ASTNode): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
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<Block>()
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
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.TokenType
|
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
|
||||||
import com.intellij.psi.formatter.common.AbstractBlock
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
|
||||||
|
|
||||||
class M68kAsmBlock(
|
|
||||||
node: ASTNode, wrap: Wrap?, alignment: Alignment?,
|
|
||||||
val column: Int,
|
|
||||||
private val codeStyleSettings: CodeStyleSettings
|
|
||||||
) : AbstractBlock(node, wrap, alignment) {
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isLeaf() = (node.firstChildNode == null)
|
|
||||||
|
|
||||||
override fun buildChildren(): List<Block> {
|
|
||||||
val subBlocks = ArrayList<Block>()
|
|
||||||
if (myNode.elementType == M68kTypes.ASM_OP) {
|
|
||||||
return subBlocks
|
|
||||||
}
|
|
||||||
|
|
||||||
var child = myNode.firstChildNode
|
|
||||||
var newColumn = column
|
|
||||||
while (child != null) {
|
|
||||||
if (child.elementType != TokenType.WHITE_SPACE) {
|
|
||||||
subBlocks.add(
|
|
||||||
M68kAsmBlock(
|
|
||||||
child,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
newColumn,
|
|
||||||
codeStyleSettings
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (child.elementType == M68kTypes.ASM_OP) {
|
|
||||||
newColumn += 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
child = child.treeNext
|
|
||||||
}
|
|
||||||
return subBlocks
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
|
||||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings
|
|
||||||
|
|
||||||
class M68kAsmCodeStyleSettings(container: CodeStyleSettings) : CustomCodeStyleSettings("MC68000AsmCodeStyleSettings", container) {
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
import com.intellij.application.options.CodeStyleAbstractConfigurable
|
|
||||||
import com.intellij.application.options.CodeStyleAbstractPanel
|
|
||||||
import com.intellij.application.options.TabbedLanguageCodeStylePanel
|
|
||||||
import com.intellij.psi.codeStyle.CodeStyleConfigurable
|
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
|
||||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider
|
|
||||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings
|
|
||||||
import de.platon42.intellij.plugins.m68k.MC68000Language
|
|
||||||
|
|
||||||
|
|
||||||
class M68kAsmCodeStyleSettingsProvider : CodeStyleSettingsProvider() {
|
|
||||||
|
|
||||||
override fun createCustomSettings(settings: CodeStyleSettings): CustomCodeStyleSettings {
|
|
||||||
return M68kAsmCodeStyleSettings(settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createConfigurable(settings: CodeStyleSettings, modelSettings: CodeStyleSettings): CodeStyleConfigurable {
|
|
||||||
return object : CodeStyleAbstractConfigurable(settings, modelSettings, configurableDisplayName) {
|
|
||||||
override fun createPanel(settings: CodeStyleSettings): CodeStyleAbstractPanel {
|
|
||||||
return M68kAsmCodeStyleMainPanel(currentSettings, settings)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getConfigurableDisplayName() = "M68k"
|
|
||||||
|
|
||||||
private class M68kAsmCodeStyleMainPanel(currentSettings: CodeStyleSettings, settings: CodeStyleSettings) :
|
|
||||||
TabbedLanguageCodeStylePanel(MC68000Language.INSTANCE, currentSettings, settings)
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
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<Block>()
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
import com.intellij.formatting.Block
|
|
||||||
import com.intellij.lang.ASTNode
|
|
||||||
import com.intellij.psi.formatter.common.AbstractBlock
|
|
||||||
|
|
||||||
class M68kAsmEolBlock(node: ASTNode) : AbstractBlock(node, null, null) {
|
|
||||||
|
|
||||||
override fun getSpacing(child1: Block?, child2: Block) = null
|
|
||||||
|
|
||||||
override fun isLeaf() = true
|
|
||||||
|
|
||||||
override fun buildChildren() = emptyList<Block>()
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
import com.intellij.formatting.FormattingContext
|
|
||||||
import com.intellij.formatting.FormattingModel
|
|
||||||
import com.intellij.formatting.FormattingModelBuilder
|
|
||||||
import com.intellij.formatting.FormattingModelProvider
|
|
||||||
|
|
||||||
class M68kAsmFormattingModelBuilder : FormattingModelBuilder {
|
|
||||||
|
|
||||||
override fun createModel(formattingContext: FormattingContext): FormattingModel {
|
|
||||||
val codeStyleSettings = formattingContext.codeStyleSettings
|
|
||||||
|
|
||||||
return FormattingModelProvider.createFormattingModelForPsiFile(
|
|
||||||
formattingContext.containingFile,
|
|
||||||
M68kAsmRootBlock(formattingContext.node, codeStyleSettings),
|
|
||||||
codeStyleSettings
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
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 M68kAsmLabelBlock(
|
|
||||||
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<Block>()
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
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<Block>()
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
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.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())
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isLeaf(): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun buildChildren(): List<Block> {
|
|
||||||
val subBlocks = ArrayList<Block>()
|
|
||||||
var child = myNode.firstChildNode
|
|
||||||
while (child != null) {
|
|
||||||
if (child.elementType == M68kTypes.EOL) {
|
|
||||||
subBlocks.add(M68kAsmEolBlock(child))
|
|
||||||
} 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, null, null, 0, codeStyleSettings))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
child = child.treeNext
|
|
||||||
}
|
|
||||||
return subBlocks
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
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
|
|
||||||
import com.intellij.psi.formatter.common.AbstractBlock
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*
|
|
||||||
|
|
||||||
class M68kAsmStatementBlock(node: ASTNode, private val codeStyleSettings: CodeStyleSettings) :
|
|
||||||
AbstractBlock(node, null, null) {
|
|
||||||
|
|
||||||
override fun getIndent(): Indent? {
|
|
||||||
val statement = myNode.psi as M68kStatement
|
|
||||||
if (((statement.asmInstruction != null) || (statement.asmInstruction != null) || (statement.preprocessorDirective != null)
|
|
||||||
|| (statement.macroCall != null))
|
|
||||||
&& ((statement.localLabel == null) && (statement.globalLabel == null))
|
|
||||||
) {
|
|
||||||
return null
|
|
||||||
} else {
|
|
||||||
return Indent.getAbsoluteNoneIndent()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSpacing(child1: Block?, child2: Block): Spacing? {
|
|
||||||
if (child2 is M68kAsmBlock) {
|
|
||||||
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(0, 0, 1, true, 0)
|
|
||||||
} else {
|
|
||||||
return Spacing.createSpacing(spacesLeft, spacesLeft, 0, true, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Spacing.createSpacing(indentSize, indentSize, 0, true, 0)
|
|
||||||
}
|
|
||||||
if (child2 is M68kAsmLabelBlock || child2 is M68kAsmAssignmentBlock) {
|
|
||||||
return Spacing.createSpacing(0, 0, 0, true, 0)
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isLeaf() = false
|
|
||||||
|
|
||||||
override fun buildChildren(): List<Block> {
|
|
||||||
val subBlocks = ArrayList<Block>()
|
|
||||||
var child = myNode.firstChildNode
|
|
||||||
while (child != null) {
|
|
||||||
if (child.elementType != TokenType.WHITE_SPACE) {
|
|
||||||
val element = child.psi
|
|
||||||
when (element) {
|
|
||||||
is M68kAssignment -> subBlocks.add(M68kAsmAssignmentBlock(child, null, null, codeStyleSettings))
|
|
||||||
|
|
||||||
is M68kAsmInstruction, is M68kPreprocessorDirective, is M68kMacroCall ->
|
|
||||||
subBlocks.add(M68kAsmBlock(child, null, null, 2, codeStyleSettings))
|
|
||||||
|
|
||||||
is M68kGlobalLabel, is M68kLocalLabel ->
|
|
||||||
subBlocks.add(M68kAsmLabelBlock(child, null, null, codeStyleSettings))
|
|
||||||
|
|
||||||
else -> subBlocks.add(M68kAsmBlock(child, null, null, 1, codeStyleSettings))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
child = child.treeNext
|
|
||||||
}
|
|
||||||
return subBlocks
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.formatter
|
|
||||||
|
|
||||||
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider
|
|
||||||
import de.platon42.intellij.plugins.m68k.MC68000Language
|
|
||||||
|
|
||||||
class M68kLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvider() {
|
|
||||||
override fun getLanguage() = MC68000Language.INSTANCE
|
|
||||||
|
|
||||||
override fun getCodeSample(settingsType: SettingsType) = """; This is an example assembly language program
|
|
||||||
PIC_HEIGHT = 256
|
|
||||||
|
|
||||||
include "../includes/hardware/custom.i"
|
|
||||||
|
|
||||||
BLTHOGON MACRO ; macro definition
|
|
||||||
move.w #DMAF_SETCLR|DMAF_BLITHOG,dmacon(a5) ; hog!
|
|
||||||
ENDM
|
|
||||||
|
|
||||||
demo_init ; global label
|
|
||||||
tst.w d1
|
|
||||||
beq.s .skip
|
|
||||||
PUSHM d0-d7/a0-a6 ; this is a macro call
|
|
||||||
lea hello(pc),a1
|
|
||||||
lea pd_ModViewTable(a4,d1.w),a0
|
|
||||||
moveq.l #0,d0
|
|
||||||
move.w #PIC_HEIGHT-1,d7
|
|
||||||
.loop move.l d0,(a0)+ ; local label
|
|
||||||
dbra d7,.loop
|
|
||||||
POPM
|
|
||||||
.skip rts
|
|
||||||
|
|
||||||
irq: move.l a0,-(sp)
|
|
||||||
move usp,a0
|
|
||||||
move.l a0,${'$'}400.w
|
|
||||||
move.l (sp)+,a0
|
|
||||||
rte
|
|
||||||
|
|
||||||
hello: dc.b 'Hello World!',10,0
|
|
||||||
even
|
|
||||||
dc.w *-hello ; length of string
|
|
||||||
"""
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.inspections
|
|
||||||
|
|
||||||
import com.intellij.codeInspection.InspectionSuppressor
|
|
||||||
import com.intellij.codeInspection.ProblemDescriptor
|
|
||||||
import com.intellij.codeInspection.SuppressQuickFix
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.psi.PsiComment
|
|
||||||
import com.intellij.psi.PsiDocumentManager
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kPsiElement
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kStatement
|
|
||||||
|
|
||||||
class M68kInspectionSuppressor : InspectionSuppressor {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val MARKER = "suppress "
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean {
|
|
||||||
if (element !is M68kPsiElement) return false
|
|
||||||
val statement = PsiTreeUtil.getParentOfType(element, M68kStatement::class.java) ?: return false
|
|
||||||
val nextToken = PsiTreeUtil.skipWhitespacesForward(statement)
|
|
||||||
return isSuppressedWithComment(nextToken, toolId) || isSuppressedWithComment(PsiTreeUtil.skipWhitespacesBackward(statement), toolId)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSuppressActions(element: PsiElement?, toolId: String): Array<SuppressQuickFix> {
|
|
||||||
return arrayOf(LineSuppressQuickFix(toolId))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isSuppressedWithComment(nextToken: PsiElement?, toolId: String): Boolean {
|
|
||||||
return if (nextToken is PsiComment) {
|
|
||||||
val comment = nextToken.text
|
|
||||||
comment.contains(MARKER) && comment.contains(toolId)
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LineSuppressQuickFix(private val toolId: String) : SuppressQuickFix {
|
|
||||||
|
|
||||||
override fun getFamilyName() = "Suppress for statement"
|
|
||||||
|
|
||||||
override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
|
|
||||||
val statement = PsiTreeUtil.getParentOfType(descriptor.startElement, M68kStatement::class.java) ?: return
|
|
||||||
|
|
||||||
val document = PsiDocumentManager.getInstance(project).getDocument(statement.containingFile) ?: return
|
|
||||||
val lineNumber = document.getLineNumber(statement.textOffset)
|
|
||||||
var usePrevLine = false
|
|
||||||
val nextToken = PsiTreeUtil.skipWhitespacesForward(statement)
|
|
||||||
if (nextToken is PsiComment) {
|
|
||||||
val comment = nextToken.text
|
|
||||||
if (comment.contains(MARKER)) {
|
|
||||||
if (!comment.contains(toolId)) {
|
|
||||||
document.insertString(document.getLineEndOffset(lineNumber), " $toolId")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
usePrevLine = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val prevToken = PsiTreeUtil.skipWhitespacesBackward(statement)
|
|
||||||
if (prevToken is PsiComment) {
|
|
||||||
val comment = prevToken.text
|
|
||||||
if (comment.contains(MARKER)) {
|
|
||||||
if (!comment.contains(toolId)) {
|
|
||||||
document.insertString(document.getLineEndOffset(document.getLineNumber(prevToken.textOffset)), " $toolId")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (usePrevLine) {
|
|
||||||
document.insertString(document.getLineStartOffset(lineNumber), "; $MARKER$toolId\n")
|
|
||||||
} else {
|
|
||||||
document.insertString(document.getLineEndOffset(lineNumber), "\t; $MARKER$toolId")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isAvailable(project: Project, context: PsiElement) = true
|
|
||||||
|
|
||||||
override fun isSuppressAll() = false
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.inspections
|
|
||||||
|
|
||||||
import com.intellij.codeInspection.LocalInspectionToolSession
|
|
||||||
import com.intellij.codeInspection.ProblemHighlightType
|
|
||||||
import com.intellij.codeInspection.ProblemsHolder
|
|
||||||
import com.intellij.psi.PsiElementVisitor
|
|
||||||
import com.intellij.psi.PsiPolyVariantReference
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor
|
|
||||||
import de.platon42.intellij.plugins.m68k.refs.M68kGlobalLabelSymbolReference
|
|
||||||
|
|
||||||
class M68kUnresolvedReferenceInspection : AbstractBaseM68kLocalInspectionTool() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val DISPLAY_NAME = "Unresolved label/symbol/macro reference"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getDisplayName() = DISPLAY_NAME
|
|
||||||
|
|
||||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
|
|
||||||
return object : M68kVisitor() {
|
|
||||||
override fun visitMacroCall(macroCall: M68kMacroCall) {
|
|
||||||
val reference = macroCall.reference as? PsiPolyVariantReference ?: return
|
|
||||||
val resolve = reference.multiResolve(false)
|
|
||||||
if (resolve.isEmpty()) {
|
|
||||||
holder.registerProblem(reference)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun visitSymbolReference(symbolReference: M68kSymbolReference) {
|
|
||||||
val references = symbolReference.references
|
|
||||||
if (references.isEmpty()) return
|
|
||||||
val resolve = references.mapNotNull { it as? PsiPolyVariantReference }
|
|
||||||
.firstNotNullOfOrNull { it.multiResolve(false).ifEmpty { null } }
|
|
||||||
if (resolve == null) {
|
|
||||||
// TODO currently, because macro invocations are not evaluated, mark missing symbols only as weak warning
|
|
||||||
val makeWeak = references.any { it is M68kGlobalLabelSymbolReference }
|
|
||||||
if (makeWeak) {
|
|
||||||
holder.registerProblem(references.first(), ProblemHighlightType.WEAK_WARNING)
|
|
||||||
} else {
|
|
||||||
holder.registerProblem(references.first())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,17 +19,11 @@ object LexerUtil {
|
|||||||
&& text.dropLast(1).endsWith('.')
|
&& text.dropLast(1).endsWith('.')
|
||||||
&& mnemonics.contains(text.dropLast(2).toString().lowercase())
|
&& mnemonics.contains(text.dropLast(2).toString().lowercase())
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun isEndDirective(text: CharSequence) = text.contentEquals("end", ignoreCase = true)
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isDataDirective(text: CharSequence) = AssemblerDirectives.dataDirectives.contains(text.toString().lowercase())
|
fun isDataDirective(text: CharSequence) = AssemblerDirectives.dataDirectives.contains(text.toString().lowercase())
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isPlainDirective(text: CharSequence) = AssemblerDirectives.plainDirectives.contains(text.toString().lowercase())
|
fun isOtherDirective(text: CharSequence) = AssemblerDirectives.otherDirective.contains(text.toString().lowercase())
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun isOtherDirective(text: CharSequence) = AssemblerDirectives.otherDirectives.contains(text.toString().lowercase())
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun pushbackAssignment(text: CharSequence): Int {
|
fun pushbackAssignment(text: CharSequence): Int {
|
||||||
@ -58,7 +52,7 @@ object LexerUtil {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun handleMacroMode(lexer: _M68kLexer): IElementType {
|
fun handleMacroMode(lexer: _M68kLexer): IElementType {
|
||||||
if (lexer.lexerPrefs.macroParametersUnparsed) {
|
if (lexer.lexerPrefs.macroParametersUnparsed) {
|
||||||
lexer.yybegin(_M68kLexer.PLAINPARAMS)
|
lexer.yybegin(_M68kLexer.MACROCALL)
|
||||||
} else {
|
} else {
|
||||||
lexer.yybegin(_M68kLexer.ASMOPS)
|
lexer.yybegin(_M68kLexer.ASMOPS)
|
||||||
}
|
}
|
||||||
@ -75,13 +69,4 @@ object LexerUtil {
|
|||||||
lexer.yybegin(_M68kLexer.MACROLINE)
|
lexer.yybegin(_M68kLexer.MACROLINE)
|
||||||
return TokenType.WHITE_SPACE
|
return TokenType.WHITE_SPACE
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unquoteString(string: String) = string.run {
|
|
||||||
when {
|
|
||||||
startsWith('"') -> removeSurrounding("\"")
|
|
||||||
startsWith('\'') -> removeSurrounding("'")
|
|
||||||
startsWith('<') -> removeSurrounding("<", ">")
|
|
||||||
else -> this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -4,8 +4,5 @@ data class M68kLexerPrefs(
|
|||||||
var spaceIntroducesComment: Boolean = false,
|
var spaceIntroducesComment: Boolean = false,
|
||||||
var maxLinesPerMacro: Int = 250,
|
var maxLinesPerMacro: Int = 250,
|
||||||
var macroSectionUnparsed: Boolean = false,
|
var macroSectionUnparsed: Boolean = false,
|
||||||
var macroParametersUnparsed: Boolean = true,
|
var macroParametersUnparsed: Boolean = true
|
||||||
|
|
||||||
var maxShortDocumentationLines: Int = 5,
|
|
||||||
var maxLongDocumentationLines: Int = 100,
|
|
||||||
)
|
)
|
@ -72,7 +72,7 @@ HASH_COMMENT=([#;*].*+)
|
|||||||
SKIP_TO_EOL=[^\r\n]+
|
SKIP_TO_EOL=[^\r\n]+
|
||||||
PLAIN_MACRO_LINE=[^;\r\n]+
|
PLAIN_MACRO_LINE=[^;\r\n]+
|
||||||
|
|
||||||
%state NOSOL,INSTRPART,ASMINSTR,ASMOPS,ASMOPS_OP,ASSIGNMENT,EXPR,EXPR_OP,PLAINPARAMS,WAITEOL,MACRODEF,MACROLINE,MACROTERMINATION,MACROWAITEOL
|
%state NOSOL,INSTRPART,ASMINSTR,ASMOPS,ASMOPS_OP,ASSIGNMENT,EXPR,EXPR_OP,MACROCALL,WAITEOL,MACRODEF,MACROLINE,MACROTERMINATION,MACROWAITEOL
|
||||||
|
|
||||||
%%
|
%%
|
||||||
<YYINITIAL, NOSOL>
|
<YYINITIAL, NOSOL>
|
||||||
@ -81,7 +81,7 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{HASH_COMMENT} { yybegin(YYINITIAL); return COMMENT; }
|
{HASH_COMMENT} { yybegin(YYINITIAL); return COMMENT; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<INSTRPART,ASMINSTR,PLAINPARAMS,ASSIGNMENT,EXPR,EXPR_OP,ASMOPS,ASMOPS_OP>
|
<INSTRPART,ASMINSTR,MACROCALL,ASSIGNMENT,EXPR,EXPR_OP,ASMOPS,ASMOPS_OP>
|
||||||
{
|
{
|
||||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||||
@ -92,7 +92,7 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<PLAINPARAMS, EXPR, EXPR_OP, ASMOPS, ASMOPS_OP> {
|
<MACROCALL, EXPR, EXPR_OP, ASMOPS, ASMOPS_OP> {
|
||||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,6 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{MACRO_DEF_LEFT} { yybegin(MACRODEF); yypushback(pushbackAfterFirstToken(yytext())); return MACRO_NAME; }
|
{MACRO_DEF_LEFT} { yybegin(MACRODEF); yypushback(pushbackAfterFirstToken(yytext())); return MACRO_NAME; }
|
||||||
{LOCAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
|
{LOCAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
|
||||||
{GLOBAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
|
{GLOBAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
|
||||||
"." { yybegin(INSTRPART); eatOneWhitespace = false; return LOCAL_LABEL_DEF; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<NOSOL> {
|
<NOSOL> {
|
||||||
@ -117,10 +116,8 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{DIRECTIVE_KEYWORD} {
|
{DIRECTIVE_KEYWORD} {
|
||||||
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
||||||
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
|
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
|
||||||
//if(isEndDirective(yytext())) { yybegin(YYINITIAL); zzAtEOF = true; return null; }
|
if(isDataDirective(yytext())) { startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; }
|
||||||
if(isDataDirective(yytext())) { eatOneWhitespace = true; startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; }
|
if(isOtherDirective(yytext())) { startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; }
|
||||||
if(isPlainDirective(yytext())) { eatOneWhitespace = true; yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; }
|
|
||||||
if(isOtherDirective(yytext())) { eatOneWhitespace = true; startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; }
|
|
||||||
return handleMacroMode(this);
|
return handleMacroMode(this);
|
||||||
}
|
}
|
||||||
{MACRONAME} { return handleMacroMode(this); }
|
{MACRONAME} { return handleMacroMode(this); }
|
||||||
@ -139,7 +136,7 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{OPSIZE_L} { return OPSIZE_L; }
|
{OPSIZE_L} { return OPSIZE_L; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<PLAINPARAMS> {
|
<MACROCALL> {
|
||||||
"," { return SEPARATOR; }
|
"," { return SEPARATOR; }
|
||||||
|
|
||||||
{PLAINPARAM} { return STRINGLIT; }
|
{PLAINPARAM} { return STRINGLIT; }
|
||||||
@ -168,6 +165,7 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
"+" { return OP_PLUS; }
|
"+" { return OP_PLUS; }
|
||||||
"-" { return OP_MINUS; }
|
"-" { return OP_MINUS; }
|
||||||
"*" { yybegin(exprOpState); return CURRENT_PC_SYMBOL; }
|
"*" { yybegin(exprOpState); return CURRENT_PC_SYMBOL; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<EXPR> {
|
<EXPR> {
|
||||||
@ -215,12 +213,8 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
"sr" { yybegin(exprOpState); return REG_SR; }
|
"sr" { yybegin(exprOpState); return REG_SR; }
|
||||||
"usp" { yybegin(exprOpState); return REG_USP; }
|
"usp" { yybegin(exprOpState); return REG_USP; }
|
||||||
"vbr" { yybegin(exprOpState); return REG_VBR; }
|
"vbr" { yybegin(exprOpState); return REG_VBR; }
|
||||||
"dfc" { yybegin(exprOpState); return REG_DFC; }
|
|
||||||
"sfc" { yybegin(exprOpState); return REG_SFC; }
|
|
||||||
|
|
||||||
"#" { return HASH; }
|
"#" { return HASH; }
|
||||||
"\[" { return SQUARE_L; }
|
|
||||||
// "\]" { return SQUARE_R; }
|
|
||||||
|
|
||||||
{SYMBOL} { yybegin(exprOpState); return SYMBOL; }
|
{SYMBOL} { yybegin(exprOpState); return SYMBOL; }
|
||||||
}
|
}
|
||||||
@ -229,8 +223,6 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{OPSIZE_BS} { return OPSIZE_BS; }
|
{OPSIZE_BS} { return OPSIZE_BS; }
|
||||||
{OPSIZE_W} { return OPSIZE_W; }
|
{OPSIZE_W} { return OPSIZE_W; }
|
||||||
{OPSIZE_L} { return OPSIZE_L; }
|
{OPSIZE_L} { return OPSIZE_L; }
|
||||||
"\[" { return SQUARE_L; }
|
|
||||||
"\]" { return SQUARE_R; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<WAITEOL>
|
<WAITEOL>
|
||||||
|
@ -121,10 +121,11 @@ M68kFile ::= line*
|
|||||||
private line ::= !<<eof>> (MacroDefinition | statement) (<<eof>>|EOL)
|
private line ::= !<<eof>> (MacroDefinition | statement) (<<eof>>|EOL)
|
||||||
|
|
||||||
statement ::= (Assignment
|
statement ::= (Assignment
|
||||||
|
| PreprocessorDirective
|
||||||
| LabelInsts)
|
| LabelInsts)
|
||||||
{pin = 1 recoverWhile = statement_recover}
|
{pin=1 recoverWhile=statement_recover};
|
||||||
|
|
||||||
private statement_recover ::= !(EOL) { consumeTokenMethod = "consumeTokenFast" }
|
private statement_recover ::= !(EOL)
|
||||||
|
|
||||||
SymbolDefinition ::= SYMBOLDEF {
|
SymbolDefinition ::= SYMBOLDEF {
|
||||||
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
|
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
|
||||||
@ -136,10 +137,11 @@ SymbolDefinition ::= SYMBOLDEF {
|
|||||||
|
|
||||||
Assignment ::= SymbolDefinition COLON? (OP_ASSIGN|EQU) expr
|
Assignment ::= SymbolDefinition COLON? (OP_ASSIGN|EQU) expr
|
||||||
|
|
||||||
private LabelInsts ::= LabelWithInstruction | LabelOnly | Instruction
|
private LabelInsts ::= LabelWithInstruction | LabelOnly | InstructionOnly
|
||||||
|
|
||||||
private LabelOnly ::= Label
|
private LabelOnly ::= Label
|
||||||
private LabelWithInstruction ::= Label Instruction
|
private LabelWithInstruction ::= Label Instruction
|
||||||
|
private InstructionOnly ::= Instruction
|
||||||
|
|
||||||
LocalLabel ::= LOCAL_LABEL_DEF COLON? {
|
LocalLabel ::= LOCAL_LABEL_DEF COLON? {
|
||||||
name = "local label"
|
name = "local label"
|
||||||
@ -163,7 +165,6 @@ OperandSize ::= (OPSIZE_BS|OPSIZE_W|OPSIZE_L) {
|
|||||||
name = ".s|.b|.w|.l"
|
name = ".s|.b|.w|.l"
|
||||||
methods = [getSize]
|
methods = [getSize]
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressSize ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
|
AddressSize ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
|
||||||
DataWidth ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
|
DataWidth ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
|
||||||
|
|
||||||
@ -172,11 +173,8 @@ AsmOp ::= MNEMONIC OperandSize? {
|
|||||||
methods = [getMnemonic getOpSize]
|
methods = [getMnemonic getOpSize]
|
||||||
}
|
}
|
||||||
|
|
||||||
PreprocessorKeyword ::= (DATA_DIRECTIVE | OTHER_DIRECTIVE)
|
PreprocessorDirective ::= Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE)
|
||||||
|
PreprocessorOperands?
|
||||||
PreprocessorDirective ::= PreprocessorKeyword PreprocessorOperands? {
|
|
||||||
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorDirectiveMixin"
|
|
||||||
}
|
|
||||||
|
|
||||||
MacroPlainLine ::= MACRO_LINE
|
MacroPlainLine ::= MACRO_LINE
|
||||||
MacroNameDefinition ::= MACRO_NAME
|
MacroNameDefinition ::= MACRO_NAME
|
||||||
@ -198,7 +196,7 @@ MacroCall ::= MACRO_INVOCATION PlainOperands? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AsmInstruction ::= AsmOp AsmOperands?
|
AsmInstruction ::= AsmOp AsmOperands?
|
||||||
private Instruction ::= AsmInstruction | MacroCall | PreprocessorDirective
|
private Instruction ::= AsmInstruction | MacroCall
|
||||||
//external Instruction ::= parseMacroCallOrAsmInstruction
|
//external Instruction ::= parseMacroCallOrAsmInstruction
|
||||||
|
|
||||||
private AsmOperands ::= AddressingMode (SEPARATOR AddressingMode)?
|
private AsmOperands ::= AddressingMode (SEPARATOR AddressingMode)?
|
||||||
@ -227,7 +225,7 @@ AddressRegister ::= AREG | REG_SP {
|
|||||||
extends = Register
|
extends = Register
|
||||||
}
|
}
|
||||||
|
|
||||||
SpecialRegister ::= REG_CCR | REG_SR | REG_USP | REG_VBR | REG_SFC | REG_DFC {
|
SpecialRegister ::= REG_CCR | REG_SR | REG_USP | REG_VBR {
|
||||||
name = "special register"
|
name = "special register"
|
||||||
extends = Register
|
extends = Register
|
||||||
}
|
}
|
||||||
@ -236,26 +234,14 @@ Register ::= DataRegister | AddressRegister | SpecialRegister
|
|||||||
|
|
||||||
private DataOrAddressRegister ::= DataRegister | AddressRegister { name = "data or address register"}
|
private DataOrAddressRegister ::= DataRegister | AddressRegister { name = "data or address register"}
|
||||||
|
|
||||||
BaseDisplacement ::= expr DataWidth?
|
IndexRegister ::= DataOrAddressRegister DataWidth?
|
||||||
OuterDisplacement ::= expr DataWidth?
|
|
||||||
|
|
||||||
IndexRegister ::= DataOrAddressRegister DataWidth? (OP_AR_MUL IndexScale)?
|
|
||||||
{
|
{
|
||||||
name = "index register"
|
name = "index register"
|
||||||
methods = [
|
methods = [
|
||||||
indexRegister = "DataOrAddressRegister"
|
|
||||||
isLongWidth
|
isLongWidth
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexScale ::= expr
|
|
||||||
{
|
|
||||||
name = "scale value"
|
|
||||||
methods = [
|
|
||||||
indexScale = "expr"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
AddressingMode ::= ImmediateData
|
AddressingMode ::= ImmediateData
|
||||||
| AddressRegisterIndirectPreDecAddressingMode
|
| AddressRegisterIndirectPreDecAddressingMode
|
||||||
| AddressRegisterIndirectPostIncAddressingMode
|
| AddressRegisterIndirectPostIncAddressingMode
|
||||||
@ -268,14 +254,6 @@ AddressingMode ::= ImmediateData
|
|||||||
| ProgramCounterIndirectWithDisplacementOldAddressingMode
|
| ProgramCounterIndirectWithDisplacementOldAddressingMode
|
||||||
| AddressRegisterIndirectWithIndexOldAddressingMode
|
| AddressRegisterIndirectWithIndexOldAddressingMode
|
||||||
| ProgramCounterIndirectWithIndexOldAddressingMode
|
| ProgramCounterIndirectWithIndexOldAddressingMode
|
||||||
| AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode
|
|
||||||
| ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode
|
|
||||||
| MemoryIndirectAddressingMode
|
|
||||||
| ProgramCounterMemoryIndirectAddressingMode
|
|
||||||
| MemoryIndirectPostIndexedAddressingMode
|
|
||||||
| ProgramCounterMemoryIndirectPostIndexedAddressingMode
|
|
||||||
| MemoryIndirectPreIndexedAddressingMode
|
|
||||||
| ProgramCounterMemoryIndirectPreIndexedAddressingMode
|
|
||||||
| SpecialRegisterDirectAddressingMode
|
| SpecialRegisterDirectAddressingMode
|
||||||
| DataRegisterDirectAddressingMode
|
| DataRegisterDirectAddressingMode
|
||||||
| AddressRegisterDirectAddressingMode
|
| AddressRegisterDirectAddressingMode
|
||||||
@ -288,7 +266,6 @@ AddressRegisterDirectAddressingMode ::= AddressRegister !(OP_MINUS|OP_AR_DIV)
|
|||||||
AddressRegisterIndirectAddressingMode ::= ROUND_L AddressRegister ROUND_R !OP_PLUS { implements = "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect" }
|
AddressRegisterIndirectAddressingMode ::= ROUND_L AddressRegister ROUND_R !OP_PLUS { implements = "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect" }
|
||||||
AddressRegisterIndirectPostIncAddressingMode ::= ROUND_L AddressRegister ROUND_R OP_PLUS { implements = "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect" }
|
AddressRegisterIndirectPostIncAddressingMode ::= ROUND_L AddressRegister ROUND_R OP_PLUS { implements = "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect" }
|
||||||
AddressRegisterIndirectPreDecAddressingMode ::= OP_MINUS ROUND_L AddressRegister ROUND_R { implements = "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect" }
|
AddressRegisterIndirectPreDecAddressingMode ::= OP_MINUS ROUND_L AddressRegister ROUND_R { implements = "de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect" }
|
||||||
|
|
||||||
AddressRegisterIndirectWithDisplacementOldAddressingMode ::= expr ROUND_L AddressRegister ROUND_R
|
AddressRegisterIndirectWithDisplacementOldAddressingMode ::= expr ROUND_L AddressRegister ROUND_R
|
||||||
{
|
{
|
||||||
implements = [
|
implements = [
|
||||||
@ -299,7 +276,6 @@ AddressRegisterIndirectWithDisplacementOldAddressingMode ::= expr ROUND_L Addres
|
|||||||
displacement = "expr"
|
displacement = "expr"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressRegisterIndirectWithDisplacementNewAddressingMode ::= ROUND_L expr SEPARATOR AddressRegister ROUND_R
|
AddressRegisterIndirectWithDisplacementNewAddressingMode ::= ROUND_L expr SEPARATOR AddressRegister ROUND_R
|
||||||
{
|
{
|
||||||
implements = [
|
implements = [
|
||||||
@ -335,77 +311,6 @@ AddressRegisterIndirectWithIndexNewAddressingMode ::= ROUND_L (expr SEPARATOR)?
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
private internalBaseDisplacementOption1 ::= (BaseDisplacement SEPARATOR)? (AddressRegister SEPARATOR)? IndexRegister
|
|
||||||
private internalBaseDisplacementOption2 ::= (BaseDisplacement SEPARATOR)? AddressRegister (SEPARATOR IndexRegister)?
|
|
||||||
private internalBaseDisplacementOption3 ::= BaseDisplacement (SEPARATOR AddressRegister)? (SEPARATOR IndexRegister)?
|
|
||||||
|
|
||||||
AddressRegisterIndirectWithIndexBaseDisplacementAddressingMode ::= ROUND_L (internalBaseDisplacementOption1|internalBaseDisplacementOption2|internalBaseDisplacementOption3)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalAddressRegisterIndirect"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalIndexRegister"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgramCounterIndirectWithIndexBaseDisplacementAddressingMode ::= ROUND_L (BaseDisplacement SEPARATOR)? PC (SEPARATOR IndexRegister)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalIndexRegister"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
MemoryIndirectAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? AddressRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithAddressRegisterIndirect"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
outerDisplacement = "OuterDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
private internalMemoryIndirectPostIndexedOption1 ::= (BaseDisplacement SEPARATOR)? AddressRegister
|
|
||||||
private internalMemoryIndirectPostIndexedOption2 ::= BaseDisplacement (SEPARATOR AddressRegister)?
|
|
||||||
|
|
||||||
MemoryIndirectPostIndexedAddressingMode ::= ROUND_L (SQUARE_L (internalMemoryIndirectPostIndexedOption1|internalMemoryIndirectPostIndexedOption2) SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalAddressRegisterIndirect"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithIndexRegister"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
outerDisplacement = "OuterDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
MemoryIndirectPreIndexedAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? (AddressRegister SEPARATOR)? IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOptionalAddressRegisterIndirect"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithIndexRegister"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
outerDisplacement = "OuterDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgramCounterIndirectWithDisplacementOldAddressingMode ::= (ROUND_L PC ROUND_R) | (expr ROUND_L PC ROUND_R)
|
ProgramCounterIndirectWithDisplacementOldAddressingMode ::= (ROUND_L PC ROUND_R) | (expr ROUND_L PC ROUND_R)
|
||||||
{
|
{
|
||||||
implements = ["de.platon42.intellij.plugins.m68k.psi.M68kWithDisplacement"]
|
implements = ["de.platon42.intellij.plugins.m68k.psi.M68kWithDisplacement"]
|
||||||
@ -444,44 +349,6 @@ ProgramCounterIndirectWithIndexNewAddressingMode ::= ROUND_L (expr SEPARATOR)? P
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgramCounterMemoryIndirectAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? PC SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
outerDisplacement = "OuterDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgramCounterMemoryIndirectPostIndexedAddressingMode ::= ROUND_L (SQUARE_L (BaseDisplacement SEPARATOR)? PC SQUARE_R SEPARATOR)? IndexRegister (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithIndexRegister"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
outerDisplacement = "OuterDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgramCounterMemoryIndirectPreIndexedAddressingMode ::= ROUND_L SQUARE_L (BaseDisplacement SEPARATOR)? PC SEPARATOR IndexRegister SQUARE_R (SEPARATOR OuterDisplacement)? ROUND_R
|
|
||||||
{
|
|
||||||
implements = [
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithBaseDisplacement"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithIndexRegister"
|
|
||||||
"de.platon42.intellij.plugins.m68k.psi.M68kWithOuterDisplacement"
|
|
||||||
]
|
|
||||||
methods = [
|
|
||||||
baseDisplacement = "BaseDisplacement"
|
|
||||||
outerDisplacement = "OuterDisplacement"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
AbsoluteAddressAddressingMode ::= expr AddressSize? !ROUND_L
|
AbsoluteAddressAddressingMode ::= expr AddressSize? !ROUND_L
|
||||||
|
|
||||||
RegisterRange ::= (DataRegister OP_MINUS DataRegister) | (AddressRegister OP_MINUS AddressRegister) | (DataRegister OP_MINUS AddressRegister) {
|
RegisterRange ::= (DataRegister OP_MINUS DataRegister) | (AddressRegister OP_MINUS AddressRegister) | (DataRegister OP_MINUS AddressRegister) {
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.navigation
|
|
||||||
|
|
||||||
import com.intellij.ide.navigationToolbar.AbstractNavBarModelExtension
|
|
||||||
import com.intellij.ide.ui.UISettings
|
|
||||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.project.IndexNotReadyException
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.M68kIcons
|
|
||||||
import de.platon42.intellij.plugins.m68k.MC68000Language
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kPsiWalkUtil.findStatementForElement
|
|
||||||
import org.jetbrains.annotations.Nullable
|
|
||||||
import javax.swing.Icon
|
|
||||||
|
|
||||||
class M68kStructureAwareNavbar : AbstractNavBarModelExtension() {
|
|
||||||
|
|
||||||
override fun getLeafElement(dataContext: DataContext): PsiElement? {
|
|
||||||
if (UISettings.getInstance().showMembersInNavigationBar) {
|
|
||||||
val psiFile = CommonDataKeys.PSI_FILE.getData(dataContext)
|
|
||||||
val editor = CommonDataKeys.EDITOR.getData(dataContext)
|
|
||||||
if (psiFile == null || !psiFile.isValid || editor == null) return null
|
|
||||||
val psiElement = psiFile.findElementAt(editor.caretModel.offset)
|
|
||||||
if (isAcceptableLanguage(psiElement)) {
|
|
||||||
try {
|
|
||||||
var statement = findStatementForElement(psiElement!!) ?: return null
|
|
||||||
do {
|
|
||||||
if (statement.localLabel != null) return statement.localLabel
|
|
||||||
if (statement.globalLabel != null) return statement.globalLabel
|
|
||||||
statement = PsiTreeUtil.getPrevSiblingOfType(statement, M68kStatement::class.java) ?: return null
|
|
||||||
} while (true)
|
|
||||||
} catch (ignored: IndexNotReadyException) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isAcceptableLanguage(psiElement: @Nullable PsiElement?) = psiElement?.language == MC68000Language.INSTANCE
|
|
||||||
|
|
||||||
override fun getPresentableText(obj: Any?): String? {
|
|
||||||
return when (obj) {
|
|
||||||
is M68kFile -> obj.name
|
|
||||||
is M68kGlobalLabel -> obj.name
|
|
||||||
is M68kLocalLabel -> obj.name
|
|
||||||
is M68kSymbolDefinition -> obj.name
|
|
||||||
is M68kMacroDefinition -> obj.macroNameDefinition.text
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getParent(psiElement: PsiElement): PsiElement? {
|
|
||||||
if (!isAcceptableLanguage(psiElement)) return null
|
|
||||||
var statement = findStatementForElement(psiElement) ?: return null
|
|
||||||
if (statement.localLabel != null) {
|
|
||||||
do {
|
|
||||||
if (statement.globalLabel != null) return statement.globalLabel
|
|
||||||
statement = PsiTreeUtil.getPrevSiblingOfType(statement, M68kStatement::class.java) ?: return null
|
|
||||||
} while (true)
|
|
||||||
}
|
|
||||||
return psiElement.containingFile
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getIcon(obj: Any?): Icon? {
|
|
||||||
return when (obj) {
|
|
||||||
is M68kFile -> M68kIcons.FILE
|
|
||||||
is M68kGlobalLabel -> M68kIcons.GLOBAL_LABEL
|
|
||||||
is M68kLocalLabel -> M68kIcons.LOCAL_LABEL
|
|
||||||
is M68kSymbolDefinition -> M68kIcons.SYMBOL_DEF
|
|
||||||
is M68kMacroDefinition -> M68kIcons.MACRO_DEF
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,14 +10,15 @@ import de.platon42.intellij.plugins.m68k.lexer.M68kLexer
|
|||||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||||
import de.platon42.intellij.plugins.m68k.settings.M68kProjectSettings
|
|
||||||
import de.platon42.intellij.plugins.m68k.stubs.M68kElementTypes
|
import de.platon42.intellij.plugins.m68k.stubs.M68kElementTypes
|
||||||
|
|
||||||
class M68kParserDefinition : ParserDefinition {
|
class M68kParserDefinition : ParserDefinition {
|
||||||
|
|
||||||
|
val lexerPrefs = M68kLexerPrefs() // TODO make this configurable
|
||||||
|
|
||||||
override fun createLexer(project: Project): Lexer {
|
override fun createLexer(project: Project): Lexer {
|
||||||
val settings = project.getService(M68kProjectSettings::class.java)
|
// TODO take prefs from project somehow
|
||||||
return M68kLexer(settings?.settings ?: M68kLexerPrefs())
|
return M68kLexer(lexerPrefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createParser(project: Project) = M68kParser()
|
override fun createParser(project: Project) = M68kParser()
|
||||||
|
@ -12,20 +12,12 @@ object M68kAddressModeUtil {
|
|||||||
is M68kAddressRegisterIndirectPreDecAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_PRE_DEC
|
is M68kAddressRegisterIndirectPreDecAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_PRE_DEC
|
||||||
is M68kAddressRegisterIndirectWithDisplacementNewAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT
|
is M68kAddressRegisterIndirectWithDisplacementNewAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT
|
||||||
is M68kAddressRegisterIndirectWithDisplacementOldAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT
|
is M68kAddressRegisterIndirectWithDisplacementOldAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT
|
||||||
is M68kAddressRegisterIndirectWithIndexNewAddressingMode -> if (hasScale(addressingMode)) AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_SCALED_INDEX else AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX
|
is M68kAddressRegisterIndirectWithIndexNewAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX
|
||||||
is M68kAddressRegisterIndirectWithIndexOldAddressingMode -> if (hasScale(addressingMode)) AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_SCALED_INDEX else AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX
|
is M68kAddressRegisterIndirectWithIndexOldAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_INDEX
|
||||||
is M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode -> AddressMode.ADDRESS_REGISTER_INDIRECT_WITH_BASE_DISPLACEMENT
|
|
||||||
is M68kProgramCounterIndirectWithDisplacementNewAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT
|
is M68kProgramCounterIndirectWithDisplacementNewAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT
|
||||||
is M68kProgramCounterIndirectWithDisplacementOldAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT
|
is M68kProgramCounterIndirectWithDisplacementOldAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT
|
||||||
is M68kProgramCounterIndirectWithIndexNewAddressingMode -> if (hasScale(addressingMode)) AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_SCALED_INDEX else AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX
|
is M68kProgramCounterIndirectWithIndexNewAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX
|
||||||
is M68kProgramCounterIndirectWithIndexOldAddressingMode -> if (hasScale(addressingMode)) AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_SCALED_INDEX else AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX
|
is M68kProgramCounterIndirectWithIndexOldAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_INDEX
|
||||||
is M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode -> AddressMode.PROGRAM_COUNTER_INDIRECT_WITH_BASE_DISPLACEMENT
|
|
||||||
is M68kMemoryIndirectAddressingMode -> AddressMode.MEMORY_INDIRECT
|
|
||||||
is M68kMemoryIndirectPreIndexedAddressingMode -> AddressMode.MEMORY_INDIRECT_PREINDEXED
|
|
||||||
is M68kMemoryIndirectPostIndexedAddressingMode -> AddressMode.MEMORY_INDIRECT_POSTINDEXED
|
|
||||||
is M68kProgramCounterMemoryIndirectAddressingMode -> AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT
|
|
||||||
is M68kProgramCounterMemoryIndirectPreIndexedAddressingMode -> AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT_PREINDEXED
|
|
||||||
is M68kProgramCounterMemoryIndirectPostIndexedAddressingMode -> AddressMode.PROGRAM_COUNTER_MEMORY_INDIRECT_POSTINDEXED
|
|
||||||
is M68kSpecialRegisterDirectAddressingMode -> AddressMode.SPECIAL_REGISTER_DIRECT
|
is M68kSpecialRegisterDirectAddressingMode -> AddressMode.SPECIAL_REGISTER_DIRECT
|
||||||
is M68kDataRegisterDirectAddressingMode -> AddressMode.DATA_REGISTER_DIRECT
|
is M68kDataRegisterDirectAddressingMode -> AddressMode.DATA_REGISTER_DIRECT
|
||||||
is M68kAddressRegisterDirectAddressingMode -> AddressMode.ADDRESS_REGISTER_DIRECT
|
is M68kAddressRegisterDirectAddressingMode -> AddressMode.ADDRESS_REGISTER_DIRECT
|
||||||
@ -35,9 +27,6 @@ object M68kAddressModeUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add evaluation of constant expressions and allow scale == 1 as false
|
|
||||||
private fun hasScale(addressingMode: M68kWithIndexRegister) = addressingMode.indexRegister.indexScale != null
|
|
||||||
|
|
||||||
fun getOtherReadWriteModifyRegisters(rwm: Int): List<Pair<Register, Int>> {
|
fun getOtherReadWriteModifyRegisters(rwm: Int): List<Pair<Register, Int>> {
|
||||||
if (rwm and RWM_MODIFY_STACK > 0) {
|
if (rwm and RWM_MODIFY_STACK > 0) {
|
||||||
return listOf(Register.A7 to RWM_MODIFY_L)
|
return listOf(Register.A7 to RWM_MODIFY_L)
|
||||||
@ -48,20 +37,36 @@ object M68kAddressModeUtil {
|
|||||||
fun getReadWriteModifyRegisters(addressingMode: M68kAddressingMode?, rwm: Int): List<Pair<Register, Int>> {
|
fun getReadWriteModifyRegisters(addressingMode: M68kAddressingMode?, rwm: Int): List<Pair<Register, Int>> {
|
||||||
if (addressingMode == null) return emptyList()
|
if (addressingMode == null) return emptyList()
|
||||||
return when (addressingMode) {
|
return when (addressingMode) {
|
||||||
|
is M68kImmediateData,
|
||||||
|
is M68kSpecialRegisterDirectAddressingMode,
|
||||||
|
is M68kProgramCounterIndirectWithDisplacementNewAddressingMode,
|
||||||
|
is M68kProgramCounterIndirectWithDisplacementOldAddressingMode,
|
||||||
|
is M68kAbsoluteAddressAddressingMode -> emptyList()
|
||||||
|
|
||||||
is M68kAddressRegisterIndirectPostIncAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to (RWM_READ_L or RWM_MODIFY_L))
|
is M68kAddressRegisterIndirectPostIncAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to (RWM_READ_L or RWM_MODIFY_L))
|
||||||
is M68kAddressRegisterIndirectPreDecAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to (RWM_READ_L or RWM_MODIFY_L))
|
is M68kAddressRegisterIndirectPreDecAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to (RWM_READ_L or RWM_MODIFY_L))
|
||||||
is M68kWithAddressRegisterIndirect -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to RWM_READ_L)
|
is M68kWithAddressRegisterIndirect -> {
|
||||||
is M68kWithOptionalAddressRegisterIndirect -> if (addressingMode.addressRegister != null) listOf(Register.getRegFromName(addressingMode.addressRegister!!.text) to RWM_READ_L) else emptyList()
|
if (addressingMode is M68kWithIndexRegister) {
|
||||||
|
listOf(
|
||||||
|
Register.getRegFromName(addressingMode.addressRegister.text) to RWM_READ_L,
|
||||||
|
Register.getRegFromName(addressingMode.indexRegister.register.text) to if (addressingMode.indexRegister.isLongWidth) RWM_READ_L else RWM_READ_W
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
listOf(Register.getRegFromName(addressingMode.addressRegister.text) to RWM_READ_L)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is M68kWithIndexRegister -> listOf(Register.getRegFromName(addressingMode.indexRegister.register.text) to if (addressingMode.indexRegister.isLongWidth) RWM_READ_L else RWM_READ_W)
|
||||||
is M68kDataRegisterDirectAddressingMode -> listOf(Register.getRegFromName(addressingMode.dataRegister.text) to rwm)
|
is M68kDataRegisterDirectAddressingMode -> listOf(Register.getRegFromName(addressingMode.dataRegister.text) to rwm)
|
||||||
is M68kAddressRegisterDirectAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to rwm)
|
is M68kAddressRegisterDirectAddressingMode -> listOf(Register.getRegFromName(addressingMode.addressRegister.text) to rwm)
|
||||||
is M68kRegisterListAddressingMode -> addressingMode.registers.map { it to rwm }
|
is M68kRegisterListAddressingMode -> addressingMode.registers.map { it to rwm }
|
||||||
else -> emptyList()
|
else -> throw IllegalArgumentException("Unknown addressing mode $addressingMode")
|
||||||
}.plus(
|
}
|
||||||
when (addressingMode) {
|
}
|
||||||
is M68kWithIndexRegister -> listOf(Register.getRegFromName(addressingMode.indexRegister.register.text) to if (addressingMode.indexRegister.isLongWidth) RWM_READ_L else RWM_READ_W)
|
|
||||||
is M68kWithOptionalIndexRegister -> if (addressingMode.indexRegister != null) listOf(Register.getRegFromName(addressingMode.indexRegister!!.register.text) to if (addressingMode.indexRegister!!.isLongWidth) RWM_READ_L else RWM_READ_W) else emptyList()
|
fun mergeReadWriteModifyRegisters(regset: Set<Pair<Register, Int>>): Set<Pair<Register, Int>> {
|
||||||
else -> emptyList()
|
if (regset.size <= 1) return regset
|
||||||
}
|
return regset.groupBy({ it.first }) { it.second }
|
||||||
)
|
.map { it.key to if (it.value.size == 1) it.value.single() else it.value.reduce(Int::or) }
|
||||||
|
.toSet()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -37,11 +37,6 @@ object M68kElementFactory {
|
|||||||
return PsiTreeUtil.findChildOfType(file, M68kMacroCall::class.java)!!
|
return PsiTreeUtil.findChildOfType(file, M68kMacroCall::class.java)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createIncludeStatement(project: Project, path: String): M68kPreprocessorDirective {
|
|
||||||
val file = createFile(project, " include \"$path\"\n")
|
|
||||||
return PsiTreeUtil.findChildOfType(file, M68kPreprocessorDirective::class.java)!!
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createFile(project: Project, content: String): M68kFile {
|
fun createFile(project: Project, content: String): M68kFile {
|
||||||
return PsiFileFactory.getInstance(project).createFileFromText("dummy.m68k", INSTANCE, content) as M68kFile
|
return PsiFileFactory.getInstance(project).createFileFromText("dummy.m68k", INSTANCE, content) as M68kFile
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,21 @@ package de.platon42.intellij.plugins.m68k.psi
|
|||||||
|
|
||||||
import com.intellij.extapi.psi.ASTWrapperPsiElement
|
import com.intellij.extapi.psi.ASTWrapperPsiElement
|
||||||
import com.intellij.lang.ASTNode
|
import com.intellij.lang.ASTNode
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.LexerUtil
|
|
||||||
|
|
||||||
abstract class M68kLiteralExprMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kLiteralExpr {
|
abstract class M68kLiteralExprMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kLiteralExpr {
|
||||||
override fun getValue(): Any? {
|
override fun getValue(): Any? {
|
||||||
val childNode = firstChild.node
|
val childNode = firstChild.node
|
||||||
when (childNode.elementType) {
|
when (childNode.elementType) {
|
||||||
M68kTypes.STRINGLIT -> LexerUtil.unquoteString(childNode.text)
|
M68kTypes.STRINGLIT -> {
|
||||||
|
return text.run {
|
||||||
|
when {
|
||||||
|
startsWith('"') -> removeSurrounding("\"")
|
||||||
|
startsWith('\'') -> removeSurrounding("'")
|
||||||
|
startsWith('<') -> removeSurrounding(">")
|
||||||
|
else -> this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
M68kTypes.DECIMAL -> {
|
M68kTypes.DECIMAL -> {
|
||||||
try {
|
try {
|
||||||
return childNode.text.toInt()
|
return childNode.text.toInt()
|
||||||
@ -38,6 +46,6 @@ abstract class M68kLiteralExprMixin(node: ASTNode) : ASTWrapperPsiElement(node),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return childNode.text
|
return text
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,9 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi.utils
|
package de.platon42.intellij.plugins.m68k.psi
|
||||||
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.psi.search.GlobalSearchScope
|
import com.intellij.psi.search.GlobalSearchScope
|
||||||
import com.intellij.psi.stubs.StubIndex
|
import com.intellij.psi.stubs.StubIndex
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*
|
|
||||||
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStubIndex
|
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStubIndex
|
||||||
import de.platon42.intellij.plugins.m68k.stubs.M68kMacroDefinitionStubIndex
|
import de.platon42.intellij.plugins.m68k.stubs.M68kMacroDefinitionStubIndex
|
||||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStubIndex
|
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStubIndex
|
@ -7,10 +7,6 @@ import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry
|
|||||||
|
|
||||||
abstract class M68kMacroCallMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kMacroCall {
|
abstract class M68kMacroCallMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kMacroCall {
|
||||||
|
|
||||||
override fun getReference(): PsiReference? {
|
|
||||||
return references.firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getReferences(): Array<PsiReference> {
|
override fun getReferences(): Array<PsiReference> {
|
||||||
return ReferenceProvidersRegistry.getReferencesFromProviders(this)
|
return ReferenceProvidersRegistry.getReferencesFromProviders(this)
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi
|
|
||||||
|
|
||||||
import com.intellij.extapi.psi.ASTWrapperPsiElement
|
|
||||||
import com.intellij.lang.ASTNode
|
|
||||||
import com.intellij.psi.PsiReference
|
|
||||||
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry
|
|
||||||
|
|
||||||
abstract class M68kPreprocessorDirectiveMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kPreprocessorDirective {
|
|
||||||
|
|
||||||
override fun getReference(): PsiReference? {
|
|
||||||
return references.firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getReferences(): Array<PsiReference> {
|
|
||||||
return ReferenceProvidersRegistry.getReferencesFromProviders(this)
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,7 +29,7 @@ object M68kPsiImplUtil {
|
|||||||
|
|
||||||
// Local Label
|
// Local Label
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getName(element: M68kLocalLabel): String? = element.firstChild?.text
|
fun getName(element: M68kLocalLabel): String? = element.firstChild.text
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setName(element: M68kLocalLabel, name: String): PsiElement {
|
fun setName(element: M68kLocalLabel, name: String): PsiElement {
|
||||||
@ -105,7 +105,7 @@ object M68kPsiImplUtil {
|
|||||||
// OperandSize
|
// OperandSize
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getSize(element: M68kOperandSize): Int =
|
fun getSize(element: M68kOperandSize): Int =
|
||||||
when (element.text?.lowercase()) {
|
when (element.text) {
|
||||||
null -> OP_UNSIZED
|
null -> OP_UNSIZED
|
||||||
".w" -> OP_SIZE_W
|
".w" -> OP_SIZE_W
|
||||||
".l" -> OP_SIZE_L
|
".l" -> OP_SIZE_L
|
||||||
|
@ -7,10 +7,6 @@ import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry
|
|||||||
|
|
||||||
abstract class M68kSymbolReferenceMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kSymbolReference {
|
abstract class M68kSymbolReferenceMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kSymbolReference {
|
||||||
|
|
||||||
override fun getReference(): PsiReference? {
|
|
||||||
return references.firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getReferences(): Array<PsiReference> {
|
override fun getReferences(): Array<PsiReference> {
|
||||||
return ReferenceProvidersRegistry.getReferencesFromProviders(this)
|
return ReferenceProvidersRegistry.getReferencesFromProviders(this)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi
|
|
||||||
|
|
||||||
interface M68kWithBaseDisplacement : M68kAddressingMode {
|
|
||||||
|
|
||||||
val baseDisplacement: M68kBaseDisplacement?
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi
|
|
||||||
|
|
||||||
interface M68kWithOptionalAddressRegisterIndirect : M68kAddressingMode {
|
|
||||||
|
|
||||||
val addressRegister: M68kAddressRegister?
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi
|
|
||||||
|
|
||||||
interface M68kWithOptionalIndexRegister : M68kAddressingMode {
|
|
||||||
|
|
||||||
val indexRegister: M68kIndexRegister?
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi
|
|
||||||
|
|
||||||
interface M68kWithOuterDisplacement : M68kAddressingMode {
|
|
||||||
|
|
||||||
val outerDisplacement: M68kOuterDisplacement?
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi.utils
|
|
||||||
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroDefinition
|
|
||||||
|
|
||||||
object M68kMacroExpansionUtil {
|
|
||||||
|
|
||||||
fun expandMacro(macroDefinition: M68kMacroDefinition, macroCall: M68kMacroCall?): List<String> {
|
|
||||||
val params = macroCall?.exprList?.map { it.text }?.toTypedArray() ?: emptyArray()
|
|
||||||
|
|
||||||
if (params.isEmpty()) return macroDefinition.macroPlainLineList.map { it.text }
|
|
||||||
|
|
||||||
val originalContent = macroDefinition.macroPlainLineList.joinToString("\n", transform = { it.text })
|
|
||||||
var modifiedContent = originalContent
|
|
||||||
for (param in params.withIndex()) {
|
|
||||||
val paramRef = when (param.index) {
|
|
||||||
in 0..8 -> "\\" + (param.index + 1)
|
|
||||||
in 9..34 -> "\\" + ('a' + (param.index - 9))
|
|
||||||
else -> "seriously?"
|
|
||||||
}
|
|
||||||
modifiedContent = modifiedContent.replace(paramRef, param.value)
|
|
||||||
}
|
|
||||||
return modifiedContent.split("\n")
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.psi.utils
|
|
||||||
|
|
||||||
import com.intellij.psi.PsiComment
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.PsiWhiteSpace
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import com.intellij.util.SmartList
|
|
||||||
import com.intellij.util.containers.addIfNotNull
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroDefinition
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kStatement
|
|
||||||
|
|
||||||
object M68kPsiWalkUtil {
|
|
||||||
|
|
||||||
fun collectRelatedComments(element: PsiElement): List<PsiComment> {
|
|
||||||
val comments = SmartList<PsiComment>()
|
|
||||||
val eolComment = if (element is M68kMacroDefinition) {
|
|
||||||
// macro definition needs special handling of EOL comments
|
|
||||||
PsiTreeUtil.findChildOfType(element, PsiComment::class.java)
|
|
||||||
} else {
|
|
||||||
PsiTreeUtil.skipWhitespacesForward(element) as? PsiComment
|
|
||||||
}
|
|
||||||
|
|
||||||
comments.addIfNotNull(eolComment)
|
|
||||||
var prevToken: PsiElement? = element
|
|
||||||
do {
|
|
||||||
prevToken = PsiTreeUtil.skipWhitespacesBackward(prevToken)
|
|
||||||
if (prevToken !is PsiComment) break
|
|
||||||
comments.add(prevToken)
|
|
||||||
} while (true)
|
|
||||||
|
|
||||||
return comments.reversed()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getBeginningOfRelatedComment(lineElement: PsiElement): PsiElement {
|
|
||||||
// go back to catch comments that are not more than one empty line away
|
|
||||||
var relStart = lineElement
|
|
||||||
var prevLine = relStart.prevSibling ?: return lineElement
|
|
||||||
var eolCount = 2
|
|
||||||
do {
|
|
||||||
if (prevLine is PsiComment) {
|
|
||||||
relStart = prevLine
|
|
||||||
eolCount = 1
|
|
||||||
} else if (prevLine is PsiWhiteSpace) {
|
|
||||||
if (--eolCount < 0) break
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
prevLine = prevLine.prevSibling ?: break
|
|
||||||
} while (true)
|
|
||||||
return relStart
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isSignificantLine(element: PsiElement) = when (element) {
|
|
||||||
is M68kStatement -> (element.assignment != null) || (element.globalLabel != null)
|
|
||||||
is M68kMacroDefinition -> true
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
|
|
||||||
fun findStatementForElement(psiElement: PsiElement): M68kStatement? {
|
|
||||||
if (psiElement is M68kStatement) return psiElement
|
|
||||||
if (psiElement.parent is M68kFile) {
|
|
||||||
return PsiTreeUtil.getPrevSiblingOfType(psiElement, M68kStatement::class.java)
|
|
||||||
}
|
|
||||||
return PsiTreeUtil.getParentOfType(psiElement, M68kStatement::class.java);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,8 +6,8 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder
|
|||||||
import com.intellij.patterns.PlatformPatterns
|
import com.intellij.patterns.PlatformPatterns
|
||||||
import com.intellij.util.ProcessingContext
|
import com.intellij.util.ProcessingContext
|
||||||
import de.platon42.intellij.plugins.m68k.M68kIcons
|
import de.platon42.intellij.plugins.m68k.M68kIcons
|
||||||
|
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kLookupUtil
|
|
||||||
|
|
||||||
class M68kGlobalLabelSymbolCompletionContributor : CompletionContributor() {
|
class M68kGlobalLabelSymbolCompletionContributor : CompletionContributor() {
|
||||||
|
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.refs
|
|
||||||
|
|
||||||
import com.intellij.psi.*
|
|
||||||
import com.intellij.psi.impl.source.resolve.ResolveCache
|
|
||||||
import com.intellij.psi.search.FileTypeIndex
|
|
||||||
import com.intellij.psi.search.GlobalSearchScope
|
|
||||||
import de.platon42.intellij.plugins.m68k.M68kFileType
|
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.LexerUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorDirective
|
|
||||||
|
|
||||||
class M68kIncludeFileReference(element: M68kPreprocessorDirective) : PsiPolyVariantReferenceBase<M68kPreprocessorDirective>(element, true) {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val INSTANCE = Resolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
class Resolver : ResolveCache.PolyVariantResolver<M68kIncludeFileReference> {
|
|
||||||
override fun resolve(ref: M68kIncludeFileReference, incompleteCode: Boolean): Array<ResolveResult> {
|
|
||||||
val project = ref.element.project
|
|
||||||
val allFiles = FileTypeIndex.getFiles(M68kFileType.INSTANCE, GlobalSearchScope.allScope(project))
|
|
||||||
|
|
||||||
val pathName = LexerUtil.unquoteString(ref.element.exprList.first().text).replace('\\', '/')
|
|
||||||
val fileMatched = ((allFiles.firstOrNull { it.path.equals(pathName, ignoreCase = true) }
|
|
||||||
?: allFiles.firstOrNull { it.path.endsWith(pathName.removePrefix("../"), ignoreCase = true) })
|
|
||||||
?: allFiles.firstOrNull { it.path.endsWith(pathName.substringAfterLast('/'), ignoreCase = true) }) ?: return emptyArray()
|
|
||||||
return PsiElementResolveResult.createResults(PsiManager.getInstance(project).findFile(fileMatched))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun multiResolve(incompleteCode: Boolean): Array<ResolveResult> =
|
|
||||||
ResolveCache.getInstance(element.project)
|
|
||||||
.resolveWithCaching(this, INSTANCE, false, incompleteCode)
|
|
||||||
|
|
||||||
override fun resolve(): PsiElement? = multiResolve(false).singleOrNull()?.element
|
|
||||||
|
|
||||||
override fun getVariants(): Array<Any> = emptyArray()
|
|
||||||
|
|
||||||
// override fun getRangeInElement(): TextRange {
|
|
||||||
// val unquoted = LexerUtil.unquoteString(element.text)
|
|
||||||
//
|
|
||||||
// val path = element.exprList.first()
|
|
||||||
// return TextRange.from(
|
|
||||||
// path.textRange.startOffset + path.text.indexOf(unquoted), unquoted.length
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.refs
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.completion.*
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
|
||||||
import com.intellij.patterns.PlatformPatterns
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import com.intellij.util.ProcessingContext
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.*
|
|
||||||
|
|
||||||
class M68kLocalLabelDefCompletionContributor : CompletionContributor() {
|
|
||||||
|
|
||||||
init {
|
|
||||||
extend(
|
|
||||||
CompletionType.BASIC,
|
|
||||||
PlatformPatterns.or(PlatformPatterns.psiElement(M68kTypes.LOCAL_LABEL_DEF), PlatformPatterns.psiElement(M68kTypes.GLOBAL_LABEL_DEF)),
|
|
||||||
object : CompletionProvider<CompletionParameters>() {
|
|
||||||
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, resultSet: CompletionResultSet) {
|
|
||||||
var topLevelElement = parameters.originalFile.findElementAt(parameters.offset)
|
|
||||||
while (topLevelElement?.parent !is M68kFile) {
|
|
||||||
topLevelElement = topLevelElement?.parent ?: return
|
|
||||||
}
|
|
||||||
// TODO find out if we can cache this somehow
|
|
||||||
val affectedStatements = ArrayList<M68kStatement>()
|
|
||||||
val definedLocalLabels = HashSet<String>()
|
|
||||||
val referencedLocalLabels = HashSet<String>()
|
|
||||||
findUndefinedLocalLabels(topLevelElement, affectedStatements, definedLocalLabels, referencedLocalLabels) {
|
|
||||||
PsiTreeUtil.getNextSiblingOfType(it, M68kStatement::class.java)
|
|
||||||
}
|
|
||||||
findUndefinedLocalLabels(topLevelElement, affectedStatements, definedLocalLabels, referencedLocalLabels) {
|
|
||||||
PsiTreeUtil.getPrevSiblingOfType(it, M68kStatement::class.java)
|
|
||||||
}
|
|
||||||
referencedLocalLabels.removeAll(definedLocalLabels)
|
|
||||||
resultSet.addAllElements(
|
|
||||||
if (parameters.originalPosition?.text?.startsWith(".") == true) {
|
|
||||||
referencedLocalLabels.map { LookupElementBuilder.create(it.removePrefix(".")) }
|
|
||||||
} else {
|
|
||||||
referencedLocalLabels.map(LookupElementBuilder::create)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun findUndefinedLocalLabels(
|
|
||||||
topLevelElement: PsiElement,
|
|
||||||
affectedStatements: MutableList<M68kStatement>,
|
|
||||||
definedLocalLabels: MutableSet<String>,
|
|
||||||
referencedLocalLabels: MutableSet<String>,
|
|
||||||
direction: (topLevelElement: PsiElement) -> M68kStatement?
|
|
||||||
) {
|
|
||||||
var currStatement = topLevelElement
|
|
||||||
while (true) {
|
|
||||||
currStatement = direction.invoke(currStatement) ?: break
|
|
||||||
val globalLabel = PsiTreeUtil.findChildOfType(currStatement, M68kGlobalLabel::class.java)
|
|
||||||
if (globalLabel != null) break
|
|
||||||
affectedStatements.add(currStatement)
|
|
||||||
val localLabel = PsiTreeUtil.findChildOfType(currStatement, M68kLocalLabel::class.java)
|
|
||||||
if (localLabel != null) definedLocalLabels.add(localLabel.name!!)
|
|
||||||
val symbolReferences = PsiTreeUtil.findChildrenOfAnyType(currStatement, M68kSymbolReference::class.java)
|
|
||||||
if (symbolReferences.isNotEmpty()) {
|
|
||||||
referencedLocalLabels.addAll(
|
|
||||||
symbolReferences.filter(M68kSymbolReference::isLocalLabelRef).map(M68kSymbolReference::getSymbolName)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.refs
|
package de.platon42.intellij.plugins.m68k.refs
|
||||||
|
|
||||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
@ -15,15 +14,11 @@ import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel
|
|||||||
import de.platon42.intellij.plugins.m68k.psi.M68kStatement
|
import de.platon42.intellij.plugins.m68k.psi.M68kStatement
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
||||||
|
|
||||||
class M68kLocalLabelReference(element: M68kSymbolReference) :
|
class M68kLocalLabelReference(element: M68kSymbolReference) : PsiPolyVariantReferenceBase<M68kSymbolReference>(element, TextRange(0, element.textLength)) {
|
||||||
PsiPolyVariantReferenceBase<M68kSymbolReference>(element, TextRange(0, element.textLength)),
|
|
||||||
EmptyResolveMessageProvider {
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val INSTANCE = Resolver()
|
val INSTANCE = Resolver()
|
||||||
|
|
||||||
private const val UNRESOLVED_MESSAGE_PATTERN = "Cannot resolve local label ''{0}''"
|
|
||||||
|
|
||||||
fun findLocalLabels(element: M68kSymbolReference, predicate: (M68kLocalLabel) -> Boolean): List<M68kLocalLabel> {
|
fun findLocalLabels(element: M68kSymbolReference, predicate: (M68kLocalLabel) -> Boolean): List<M68kLocalLabel> {
|
||||||
val statement = PsiTreeUtil.getStubOrPsiParentOfType(element, M68kStatement::class.java)!!
|
val statement = PsiTreeUtil.getStubOrPsiParentOfType(element, M68kStatement::class.java)!!
|
||||||
val results = SmartList<M68kLocalLabel>()
|
val results = SmartList<M68kLocalLabel>()
|
||||||
@ -47,8 +42,6 @@ class M68kLocalLabelReference(element: M68kSymbolReference) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getUnresolvedMessagePattern() = UNRESOLVED_MESSAGE_PATTERN
|
|
||||||
|
|
||||||
class Resolver : ResolveCache.PolyVariantResolver<M68kLocalLabelReference> {
|
class Resolver : ResolveCache.PolyVariantResolver<M68kLocalLabelReference> {
|
||||||
override fun resolve(ref: M68kLocalLabelReference, incompleteCode: Boolean): Array<ResolveResult> {
|
override fun resolve(ref: M68kLocalLabelReference, incompleteCode: Boolean): Array<ResolveResult> {
|
||||||
val refName = ref.element.symbolName
|
val refName = ref.element.symbolName
|
||||||
|
@ -4,8 +4,8 @@ import com.intellij.codeInsight.completion.*
|
|||||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||||
import com.intellij.patterns.PlatformPatterns
|
import com.intellij.patterns.PlatformPatterns
|
||||||
import com.intellij.util.ProcessingContext
|
import com.intellij.util.ProcessingContext
|
||||||
|
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kLookupUtil
|
|
||||||
|
|
||||||
class M68kMacroCallCompletionContributor : CompletionContributor() {
|
class M68kMacroCallCompletionContributor : CompletionContributor() {
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.refs
|
package de.platon42.intellij.plugins.m68k.refs
|
||||||
|
|
||||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider
|
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiElementResolveResult
|
import com.intellij.psi.PsiElementResolveResult
|
||||||
@ -15,16 +14,12 @@ import de.platon42.intellij.plugins.m68k.psi.M68kMacroDefinition
|
|||||||
import de.platon42.intellij.plugins.m68k.stubs.M68kMacroDefinitionStubIndex
|
import de.platon42.intellij.plugins.m68k.stubs.M68kMacroDefinitionStubIndex
|
||||||
|
|
||||||
class M68kMacroReference(element: M68kMacroCall) :
|
class M68kMacroReference(element: M68kMacroCall) :
|
||||||
PsiPolyVariantReferenceBase<M68kMacroCall>(element, TextRange(0, element.macroName.length)), EmptyResolveMessageProvider {
|
PsiPolyVariantReferenceBase<M68kMacroCall>(element, TextRange(0, element.macroName.length)) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val INSTANCE = Resolver()
|
val INSTANCE = Resolver()
|
||||||
|
|
||||||
private const val UNRESOLVED_MESSAGE_PATTERN = "Cannot resolve macro ''{0}''"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getUnresolvedMessagePattern() = UNRESOLVED_MESSAGE_PATTERN
|
|
||||||
|
|
||||||
class Resolver : ResolveCache.PolyVariantResolver<M68kMacroReference> {
|
class Resolver : ResolveCache.PolyVariantResolver<M68kMacroReference> {
|
||||||
override fun resolve(ref: M68kMacroReference, incompleteCode: Boolean): Array<ResolveResult> {
|
override fun resolve(ref: M68kMacroReference, incompleteCode: Boolean): Array<ResolveResult> {
|
||||||
val macroName = ref.element.macroName
|
val macroName = ref.element.macroName
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.refs
|
|
||||||
|
|
||||||
import com.intellij.history.core.Paths
|
|
||||||
import com.intellij.openapi.util.TextRange
|
|
||||||
import com.intellij.psi.AbstractElementManipulator
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import com.intellij.util.IncorrectOperationException
|
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.LexerUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kElementFactory
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kLiteralExpr
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorDirective
|
|
||||||
|
|
||||||
class M68kPreprocessorDirectiveElementManipulator : AbstractElementManipulator<M68kPreprocessorDirective>() {
|
|
||||||
|
|
||||||
@Throws(IncorrectOperationException::class)
|
|
||||||
override fun handleContentChange(element: M68kPreprocessorDirective, range: TextRange, newContent: String): M68kPreprocessorDirective {
|
|
||||||
val oldPath = LexerUtil.unquoteString(element.exprList.first().text)
|
|
||||||
.replace('\\', '/')
|
|
||||||
.substringBeforeLast('/', missingDelimiterValue = "")
|
|
||||||
val newIncludeStatement = M68kElementFactory.createIncludeStatement(element.project, Paths.appended(oldPath, newContent))
|
|
||||||
PsiTreeUtil.findChildOfType(element, M68kLiteralExpr::class.java)!!.replace(newIncludeStatement.exprList.first())
|
|
||||||
return element
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRangeInElement(element: M68kPreprocessorDirective): TextRange {
|
|
||||||
val pathExpr = element.exprList.first()
|
|
||||||
val unquotedPath = LexerUtil.unquoteString(pathExpr.text)
|
|
||||||
return if (unquotedPath.length < pathExpr.textLength) {
|
|
||||||
TextRange.from(pathExpr.startOffsetInParent + 1, unquotedPath.length)
|
|
||||||
} else {
|
|
||||||
pathExpr.textRangeInParent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,9 +3,7 @@ package de.platon42.intellij.plugins.m68k.refs
|
|||||||
import com.intellij.patterns.PlatformPatterns
|
import com.intellij.patterns.PlatformPatterns
|
||||||
import com.intellij.psi.*
|
import com.intellij.psi.*
|
||||||
import com.intellij.util.ProcessingContext
|
import com.intellij.util.ProcessingContext
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kLiteralExpr
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall
|
import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorDirective
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
||||||
|
|
||||||
class M68kReferenceContributor : PsiReferenceContributor() {
|
class M68kReferenceContributor : PsiReferenceContributor() {
|
||||||
@ -14,14 +12,12 @@ class M68kReferenceContributor : PsiReferenceContributor() {
|
|||||||
val localLabelReferenceProvider = LocalLabelReferenceProvider()
|
val localLabelReferenceProvider = LocalLabelReferenceProvider()
|
||||||
val globalLabelReferenceProvider = GlobalLabelSymbolReferenceProvider()
|
val globalLabelReferenceProvider = GlobalLabelSymbolReferenceProvider()
|
||||||
val macroReferenceProvider = MacroReferenceProvider()
|
val macroReferenceProvider = MacroReferenceProvider()
|
||||||
val includeFileReferenceProvider = IncludeFileReferenceProvider()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) {
|
override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) {
|
||||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kSymbolReference::class.java), localLabelReferenceProvider)
|
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kSymbolReference::class.java), localLabelReferenceProvider)
|
||||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kSymbolReference::class.java), globalLabelReferenceProvider)
|
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kSymbolReference::class.java), globalLabelReferenceProvider)
|
||||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kMacroCall::class.java), macroReferenceProvider)
|
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kMacroCall::class.java), macroReferenceProvider)
|
||||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(M68kPreprocessorDirective::class.java), includeFileReferenceProvider)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalLabelReferenceProvider : PsiReferenceProvider() {
|
class LocalLabelReferenceProvider : PsiReferenceProvider() {
|
||||||
@ -44,16 +40,4 @@ class M68kReferenceContributor : PsiReferenceContributor() {
|
|||||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> =
|
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> =
|
||||||
arrayOf(M68kMacroReference(element as M68kMacroCall))
|
arrayOf(M68kMacroReference(element as M68kMacroCall))
|
||||||
}
|
}
|
||||||
|
|
||||||
class IncludeFileReferenceProvider : PsiReferenceProvider() {
|
|
||||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
|
|
||||||
val directive = element as M68kPreprocessorDirective
|
|
||||||
if (directive.exprList.firstOrNull() !is M68kLiteralExpr) return emptyArray()
|
|
||||||
return if (directive.preprocessorKeyword.text.equals("include", ignoreCase = true)) {
|
|
||||||
arrayOf(M68kIncludeFileReference(directive))
|
|
||||||
} else {
|
|
||||||
emptyArray()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.scanner
|
package de.platon42.intellij.plugins.m68k.scanner
|
||||||
|
|
||||||
import com.intellij.lang.HelpID
|
|
||||||
import com.intellij.lang.cacheBuilder.DefaultWordsScanner
|
import com.intellij.lang.cacheBuilder.DefaultWordsScanner
|
||||||
import com.intellij.lang.cacheBuilder.WordsScanner
|
import com.intellij.lang.cacheBuilder.WordsScanner
|
||||||
import com.intellij.lang.findUsages.FindUsagesProvider
|
import com.intellij.lang.findUsages.FindUsagesProvider
|
||||||
@ -23,19 +22,14 @@ class M68kFindUsagesProvider : FindUsagesProvider {
|
|||||||
TokenSet.EMPTY
|
TokenSet.EMPTY
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun canFindUsagesFor(psiElement: PsiElement): Boolean =
|
override fun canFindUsagesFor(psiElement: PsiElement): Boolean = psiElement is M68kNamedElement
|
||||||
when (psiElement) {
|
|
||||||
is M68kNamedElement, is M68kSymbolReference, is M68kMacroCall, is M68kFile, is M68kRegister -> true
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getHelpId(psiElement: PsiElement): @NonNls String = HelpID.FIND_OTHER_USAGES
|
override fun getHelpId(psiElement: PsiElement): @NonNls String? = null
|
||||||
|
|
||||||
override fun getType(element: PsiElement): @Nls String {
|
override fun getType(element: PsiElement): @Nls String {
|
||||||
return when (element) {
|
return when (element) {
|
||||||
is M68kGlobalLabel -> "global label"
|
is M68kGlobalLabel -> "global label"
|
||||||
is M68kLocalLabel -> "local label"
|
is M68kLocalLabel -> "local label"
|
||||||
is M68kPreprocessorDirective -> "preprocessor directive"
|
|
||||||
is M68kSymbolDefinition -> "symbol definition"
|
is M68kSymbolDefinition -> "symbol definition"
|
||||||
is M68kSymbolReference -> "symbol reference"
|
is M68kSymbolReference -> "symbol reference"
|
||||||
is M68kMacroDefinition -> "macro definition"
|
is M68kMacroDefinition -> "macro definition"
|
||||||
@ -50,7 +44,6 @@ class M68kFindUsagesProvider : FindUsagesProvider {
|
|||||||
return when (element) {
|
return when (element) {
|
||||||
is M68kGlobalLabel -> element.name!!
|
is M68kGlobalLabel -> element.name!!
|
||||||
is M68kLocalLabel -> element.name!!
|
is M68kLocalLabel -> element.name!!
|
||||||
is M68kPreprocessorDirective -> element.text
|
|
||||||
is M68kSymbolDefinition -> element.parent.text
|
is M68kSymbolDefinition -> element.parent.text
|
||||||
is M68kSymbolReference -> element.symbolName
|
is M68kSymbolReference -> element.symbolName
|
||||||
is M68kMacroDefinition -> element.macroNameDefinition.text
|
is M68kMacroDefinition -> element.macroNameDefinition.text
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.scanner
|
|
||||||
|
|
||||||
import com.intellij.openapi.fileTypes.FileType
|
|
||||||
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
|
||||||
import com.intellij.psi.impl.include.FileIncludeInfo
|
|
||||||
import com.intellij.psi.impl.include.FileIncludeProvider
|
|
||||||
import com.intellij.psi.impl.source.tree.LightTreeUtil
|
|
||||||
import com.intellij.util.Consumer
|
|
||||||
import com.intellij.util.PathUtilRt
|
|
||||||
import com.intellij.util.indexing.FileContent
|
|
||||||
import com.intellij.util.indexing.PsiDependentFileContent
|
|
||||||
import de.platon42.intellij.plugins.m68k.M68kFileType.Companion.INSTANCE
|
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.LexerUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
|
||||||
|
|
||||||
class M68kIncludeFileProvider : FileIncludeProvider() {
|
|
||||||
|
|
||||||
override fun getId(): String {
|
|
||||||
return "mc68000_include"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun acceptFile(file: VirtualFile): Boolean {
|
|
||||||
return FileTypeRegistry.getInstance().isFileOfType(file, INSTANCE)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun registerFileTypesUsedForIndexing(fileTypeSink: Consumer<in FileType?>) {
|
|
||||||
fileTypeSink.consume(INSTANCE)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getIncludeInfos(content: FileContent): Array<FileIncludeInfo> {
|
|
||||||
if (content.contentAsText.indexOfAny(listOf("include", "incbin"), ignoreCase = true) < 0) return emptyArray()
|
|
||||||
|
|
||||||
val tree = (content as PsiDependentFileContent).lighterAST
|
|
||||||
val statements = LightTreeUtil.getChildrenOfType(tree, tree.root, M68kTypes.STATEMENT).asSequence()
|
|
||||||
.mapNotNull { LightTreeUtil.firstChildOfType(tree, it, M68kTypes.PREPROCESSOR_DIRECTIVE) }
|
|
||||||
.mapNotNull {
|
|
||||||
val keywordNode = LightTreeUtil.firstChildOfType(tree, it, M68kTypes.PREPROCESSOR_KEYWORD) ?: return@mapNotNull null
|
|
||||||
val keyword = LightTreeUtil.toFilteredString(tree, keywordNode, null)
|
|
||||||
if (keyword.equals("include", true) || keyword.equals("incbin", true)) {
|
|
||||||
keyword to it
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.mapNotNull {
|
|
||||||
val pathNode = LightTreeUtil.firstChildOfType(tree, it.second, M68kTypes.LITERAL_EXPR) ?: return@mapNotNull null
|
|
||||||
val path = LexerUtil.unquoteString(LightTreeUtil.toFilteredString(tree, pathNode, null)).replace('\\', '/')
|
|
||||||
if (it.first.equals("include", true)) {
|
|
||||||
FileIncludeInfo(path)
|
|
||||||
} else {
|
|
||||||
FileIncludeInfo(PathUtilRt.getFileName(path), path, 0, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.toList()
|
|
||||||
|
|
||||||
return statements.toTypedArray()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.settings
|
|
||||||
|
|
||||||
import com.intellij.openapi.components.PersistentStateComponent
|
|
||||||
import com.intellij.openapi.components.State
|
|
||||||
import com.intellij.openapi.components.Storage
|
|
||||||
import com.intellij.openapi.components.StoragePathMacros
|
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
|
||||||
|
|
||||||
@State(name = "M68k.Settings", storages = [Storage(StoragePathMacros.WORKSPACE_FILE)])
|
|
||||||
class M68kProjectSettings : PersistentStateComponent<M68kLexerPrefs> {
|
|
||||||
|
|
||||||
var settings: M68kLexerPrefs = M68kLexerPrefs()
|
|
||||||
|
|
||||||
override fun getState() = settings
|
|
||||||
|
|
||||||
override fun loadState(state: M68kLexerPrefs) {
|
|
||||||
settings = state
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.settings
|
|
||||||
|
|
||||||
import com.intellij.openapi.options.Configurable
|
|
||||||
import com.intellij.openapi.options.ConfigurationException
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.openapi.util.NlsContexts.ConfigurableName
|
|
||||||
import com.intellij.ui.components.JBCheckBox
|
|
||||||
import com.intellij.uiDesigner.core.Spacer
|
|
||||||
import com.intellij.util.ui.FormBuilder
|
|
||||||
import com.intellij.util.ui.UIUtil
|
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
|
||||||
import java.text.NumberFormat
|
|
||||||
import java.text.ParseException
|
|
||||||
import javax.swing.JComponent
|
|
||||||
import javax.swing.JFormattedTextField
|
|
||||||
import javax.swing.JLabel
|
|
||||||
import javax.swing.text.DefaultFormatterFactory
|
|
||||||
import javax.swing.text.NumberFormatter
|
|
||||||
|
|
||||||
class M68kProjectSettingsConfigurable(project: Project?) : Configurable {
|
|
||||||
|
|
||||||
private val settings = project?.getService(M68kProjectSettings::class.java)
|
|
||||||
|
|
||||||
private val spacesOptionField = JBCheckBox("Space introduces comment (-spaces)", settings?.settings?.spaceIntroducesComment ?: false)
|
|
||||||
|
|
||||||
private val maxLinesPerMacroField = createNumberField(settings?.settings?.maxLinesPerMacro)
|
|
||||||
private val maxShortDocumentationLinesField = createNumberField(settings?.settings?.maxShortDocumentationLines)
|
|
||||||
private val maxLongDocumentationLinesField = createNumberField(settings?.settings?.maxLongDocumentationLines)
|
|
||||||
|
|
||||||
override fun getDisplayName(): @ConfigurableName String = "M68k"
|
|
||||||
|
|
||||||
override fun createComponent(): JComponent? {
|
|
||||||
return FormBuilder.createFormBuilder()
|
|
||||||
.setAlignLabelOnRight(false)
|
|
||||||
.setHorizontalGap(UIUtil.DEFAULT_HGAP)
|
|
||||||
.setVerticalGap(UIUtil.DEFAULT_VGAP)
|
|
||||||
.addComponent(spacesOptionField)
|
|
||||||
.addLabeledComponent(JLabel("Maximum lines parsed inside macro"), maxLinesPerMacroField)
|
|
||||||
.addSeparator()
|
|
||||||
.addLabeledComponent(JLabel("Lines of code in hovered documentation"), maxShortDocumentationLinesField)
|
|
||||||
.addLabeledComponent(JLabel("Lines of code in full documentation"), maxLongDocumentationLinesField)
|
|
||||||
.addComponentFillVertically(Spacer(), 0)
|
|
||||||
.panel
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createNumberField(value: Any?): JFormattedTextField {
|
|
||||||
val valueField = JFormattedTextField()
|
|
||||||
valueField.columns = 4
|
|
||||||
val formatter = NumberFormat.getIntegerInstance()
|
|
||||||
formatter.isParseIntegerOnly = true
|
|
||||||
valueField.formatterFactory = DefaultFormatterFactory(NumberFormatter(formatter))
|
|
||||||
valueField.value = value
|
|
||||||
return valueField
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isModified(): Boolean {
|
|
||||||
val prefs = settings?.settings ?: return false
|
|
||||||
|
|
||||||
return prefs.spaceIntroducesComment != spacesOptionField.isSelected
|
|
||||||
|| fieldDiffers(maxLinesPerMacroField, prefs.maxLinesPerMacro)
|
|
||||||
|| fieldDiffers(maxShortDocumentationLinesField, prefs.maxShortDocumentationLines)
|
|
||||||
|| fieldDiffers(maxLongDocumentationLinesField, prefs.maxLongDocumentationLines)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(ConfigurationException::class)
|
|
||||||
override fun apply() {
|
|
||||||
val prefs = settings?.settings ?: return
|
|
||||||
prefs.spaceIntroducesComment = spacesOptionField.isSelected
|
|
||||||
getFieldValue(maxLinesPerMacroField).let { if (it != null) prefs.maxLinesPerMacro = it }
|
|
||||||
getFieldValue(maxShortDocumentationLinesField).let { if (it != null) prefs.maxShortDocumentationLines = it }
|
|
||||||
getFieldValue(maxLongDocumentationLinesField).let { if (it != null) prefs.maxLongDocumentationLines = it }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fieldDiffers(field: JFormattedTextField, value: Int?): Boolean {
|
|
||||||
val fieldValue = getFieldValue(field)
|
|
||||||
return (fieldValue != null) && (value != null) && (fieldValue != value)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getFieldValue(field: JFormattedTextField): Int? {
|
|
||||||
return try {
|
|
||||||
val value = field.value
|
|
||||||
(value as Number).toInt()
|
|
||||||
} catch (ex: ParseException) {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun reset() {
|
|
||||||
settings?.settings = M68kLexerPrefs()
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,8 +6,8 @@ import com.intellij.navigation.ItemPresentation
|
|||||||
import com.intellij.psi.NavigatablePsiElement
|
import com.intellij.psi.NavigatablePsiElement
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kLookupUtil
|
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil
|
||||||
import de.platon42.intellij.plugins.m68k.psi.utils.M68kLookupUtil.findAllLocalLabels
|
import de.platon42.intellij.plugins.m68k.psi.M68kLookupUtil.findAllLocalLabels
|
||||||
|
|
||||||
class M68kStructureViewElement(private val myElement: NavigatablePsiElement) : StructureViewTreeElement {
|
class M68kStructureViewElement(private val myElement: NavigatablePsiElement) : StructureViewTreeElement {
|
||||||
override fun getValue(): Any = myElement
|
override fun getValue(): Any = myElement
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.syntax
|
package de.platon42.intellij.plugins.m68k.syntax
|
||||||
|
|
||||||
import com.intellij.codeHighlighting.RainbowHighlighter
|
|
||||||
import com.intellij.openapi.editor.colors.TextAttributesKey
|
import com.intellij.openapi.editor.colors.TextAttributesKey
|
||||||
import com.intellij.openapi.fileTypes.SyntaxHighlighter
|
import com.intellij.openapi.fileTypes.SyntaxHighlighter
|
||||||
import com.intellij.openapi.options.colors.AttributesDescriptor
|
import com.intellij.openapi.options.colors.AttributesDescriptor
|
||||||
import com.intellij.openapi.options.colors.ColorDescriptor
|
import com.intellij.openapi.options.colors.ColorDescriptor
|
||||||
import com.intellij.openapi.options.colors.RainbowColorSettingsPage
|
import com.intellij.openapi.options.colors.ColorSettingsPage
|
||||||
import de.platon42.intellij.plugins.m68k.M68kIcons.FILE
|
import de.platon42.intellij.plugins.m68k.M68kIcons.FILE
|
||||||
import de.platon42.intellij.plugins.m68k.MC68000Language
|
|
||||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.AREG
|
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.AREG
|
||||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.BAD_CHARACTER
|
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.BAD_CHARACTER
|
||||||
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.COLON
|
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.COLON
|
||||||
@ -36,9 +34,7 @@ import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.
|
|||||||
import org.jetbrains.annotations.NonNls
|
import org.jetbrains.annotations.NonNls
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
|
|
||||||
class M68kColorSettingsPage : RainbowColorSettingsPage {
|
class M68kColorSettingsPage : ColorSettingsPage {
|
||||||
|
|
||||||
override fun getLanguage() = MC68000Language.INSTANCE
|
|
||||||
|
|
||||||
override fun getIcon(): Icon {
|
override fun getIcon(): Icon {
|
||||||
return FILE
|
return FILE
|
||||||
@ -53,8 +49,6 @@ class M68kColorSettingsPage : RainbowColorSettingsPage {
|
|||||||
return """; This is an example assembly language program
|
return """; This is an example assembly language program
|
||||||
PIC_HEIGHT = 256
|
PIC_HEIGHT = 256
|
||||||
|
|
||||||
* Semantic highlighting is available for registers and local labels
|
|
||||||
|
|
||||||
include "../includes/hardware/custom.i"
|
include "../includes/hardware/custom.i"
|
||||||
|
|
||||||
BLTHOGON MACRO ; macro definition
|
BLTHOGON MACRO ; macro definition
|
||||||
@ -86,21 +80,23 @@ hello: dc.b 'Hello World!',10,0
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAdditionalHighlightingTagToDescriptorMap(): Map<String, TextAttributesKey> {
|
override fun getAdditionalHighlightingTagToDescriptorMap(): Map<String, TextAttributesKey>? {
|
||||||
return RainbowHighlighter.createRainbowHLM()
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isRainbowType(type: TextAttributesKey) = RAINBOW_TYPES.contains(type)
|
override fun getAttributeDescriptors(): Array<AttributesDescriptor> {
|
||||||
|
return DESCRIPTORS
|
||||||
|
}
|
||||||
|
|
||||||
override fun getAttributeDescriptors() = DESCRIPTORS
|
override fun getColorDescriptors(): Array<ColorDescriptor> {
|
||||||
|
return ColorDescriptor.EMPTY_ARRAY
|
||||||
|
}
|
||||||
|
|
||||||
override fun getColorDescriptors() = ColorDescriptor.EMPTY_ARRAY
|
override fun getDisplayName(): String {
|
||||||
|
return "M68k Assembly"
|
||||||
override fun getDisplayName() = "M68k Assembly"
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val RAINBOW_TYPES = setOf(AREG, DREG, LOCAL_LABEL)
|
|
||||||
|
|
||||||
private val DESCRIPTORS = arrayOf(
|
private val DESCRIPTORS = arrayOf(
|
||||||
AttributesDescriptor("Global labels", GLOBAL_LABEL),
|
AttributesDescriptor("Global labels", GLOBAL_LABEL),
|
||||||
AttributesDescriptor("Local labels", LOCAL_LABEL),
|
AttributesDescriptor("Local labels", LOCAL_LABEL),
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.syntax
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.daemon.RainbowVisitor
|
|
||||||
import com.intellij.codeInsight.daemon.impl.HighlightVisitor
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.PsiFile
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegister
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kDataRegister
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel
|
|
||||||
|
|
||||||
class M68kRainbowVisitor : RainbowVisitor() {
|
|
||||||
|
|
||||||
override fun suitableForFile(file: PsiFile): Boolean = file is M68kFile
|
|
||||||
|
|
||||||
override fun visit(element: PsiElement) {
|
|
||||||
when (element) {
|
|
||||||
is M68kAddressRegister -> addInfo(getInfo(element.containingFile, element, element.text, M68kSyntaxHighlighter.AREG))
|
|
||||||
is M68kDataRegister -> addInfo(getInfo(element.containingFile, element, element.text, M68kSyntaxHighlighter.DREG))
|
|
||||||
// is M68kGlobalLabel -> addInfo(getInfo(element.containingFile, element, element.text, M68kSyntaxHighlighter.GLOBAL_LABEL))
|
|
||||||
is M68kLocalLabel -> addInfo(getInfo(element.containingFile, element, element.text, M68kSyntaxHighlighter.LOCAL_LABEL))
|
|
||||||
// is M68kMacroCall -> addInfo(getInfo(element.containingFile, element.firstChild, element.macroName, M68kSyntaxHighlighter.MACRO_CALL))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun clone(): HighlightVisitor = M68kRainbowVisitor()
|
|
||||||
|
|
||||||
}
|
|
@ -11,13 +11,15 @@ import com.intellij.psi.tree.IElementType
|
|||||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexer
|
import de.platon42.intellij.plugins.m68k.lexer.M68kLexer
|
||||||
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||||
import de.platon42.intellij.plugins.m68k.settings.M68kProjectSettings
|
|
||||||
|
|
||||||
class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() {
|
class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() {
|
||||||
private val settings = project?.getService(M68kProjectSettings::class.java)
|
|
||||||
|
|
||||||
override fun getHighlightingLexer(): Lexer {
|
override fun getHighlightingLexer(): Lexer {
|
||||||
return M68kLexer(settings?.settings ?: M68kLexerPrefs()) // Use some defaults
|
if (project == null) {
|
||||||
|
return M68kLexer(M68kLexerPrefs()) // Use some defaults
|
||||||
|
} else {
|
||||||
|
// FIXME Where do we get the prefs from?
|
||||||
|
return M68kLexer(M68kLexerPrefs())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTokenHighlights(tokenType: IElementType): Array<TextAttributesKey> {
|
override fun getTokenHighlights(tokenType: IElementType): Array<TextAttributesKey> {
|
||||||
@ -42,7 +44,7 @@ class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() {
|
|||||||
M68kTypes.AREG -> arrayOf(AREG)
|
M68kTypes.AREG -> arrayOf(AREG)
|
||||||
M68kTypes.REG_SP -> arrayOf(STACK_POINTER)
|
M68kTypes.REG_SP -> arrayOf(STACK_POINTER)
|
||||||
M68kTypes.DREG -> arrayOf(DREG)
|
M68kTypes.DREG -> arrayOf(DREG)
|
||||||
M68kTypes.REG_USP, M68kTypes.REG_SR, M68kTypes.REG_CCR, M68kTypes.REG_VBR, M68kTypes.REG_SFC, M68kTypes.REG_DFC -> arrayOf(SPECIAL_REG)
|
M68kTypes.REG_USP, M68kTypes.REG_SR, M68kTypes.REG_CCR, M68kTypes.REG_VBR -> arrayOf(SPECIAL_REG)
|
||||||
M68kTypes.COMMENT -> arrayOf(COMMENT)
|
M68kTypes.COMMENT -> arrayOf(COMMENT)
|
||||||
M68kTypes.DECIMAL, M68kTypes.HEXADECIMAL, M68kTypes.OCTAL -> arrayOf(NUMBER)
|
M68kTypes.DECIMAL, M68kTypes.HEXADECIMAL, M68kTypes.OCTAL -> arrayOf(NUMBER)
|
||||||
M68kTypes.STRINGLIT -> arrayOf(STRING)
|
M68kTypes.STRINGLIT -> arrayOf(STRING)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user