Compare commits
63 Commits
Author | SHA1 | Date | |
---|---|---|---|
aed9ed686d | |||
e3efc545a8 | |||
df2a220473 | |||
130f6a106d | |||
def6fe306f | |||
cd0bcd22ff | |||
f87bc7fea9 | |||
64b7042208 | |||
b785b716bb | |||
87cca67049 | |||
5e2099f019 | |||
ae92da7878 | |||
85b2596c64 | |||
e0bd6981e3 | |||
0ae17046d6 | |||
031d5ff4ab | |||
653f8dc9fc | |||
a92630e5c7 | |||
3f1ef0e55a | |||
722d4437ec | |||
f1110ac3c9 | |||
7462c5b02d | |||
9b93ea05fc | |||
680b811e22 | |||
cbffc3d841 | |||
435b30efc3 | |||
62f7f13323 | |||
c4051a0377 | |||
a03de6c394 | |||
1bff1a12c2 | |||
665947827b | |||
3bb6165a58 | |||
89bd964fe7 | |||
0cb90ff8d7 | |||
431caf64fd | |||
a3f7ddb4f7 | |||
593719043e | |||
e0cdfef42b | |||
8d7977927f | |||
ddf78ec210 | |||
2c3daf28f7 | |||
1dcf288d27 | |||
2abb5af8b0 | |||
6c9a726b86 | |||
921449cbb8 | |||
6f99c2ffcc | |||
5881dcdaf8 | |||
71398f51d2 | |||
eb26793a20 | |||
954f42bf63 | |||
94001c8b87 | |||
55403f89a6 | |||
7744b589d4 | |||
19e3b519db | |||
587b284d25 | |||
719460ebfe | |||
44a4721d77 | |||
09a4e62c7c | |||
ce3cdbbed6 | |||
27b7593de8 | |||
3aeb415974 | |||
128330d2c7 | |||
ef900e9c19 |
13
LICENSE.TXT
Normal file
13
LICENSE.TXT
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright 2021 Chris Hodges <chrisly@platon42.de>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
224
README.md
224
README.md
@ -1,55 +1,145 @@
|
||||
# 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
|
||||
|
||||
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
|
||||
|
||||

|
||||

|
||||
|
||||
## Purpose
|
||||
|
||||
This plugin delivers support for MC68000 assembly language files ([VAsm](http://sun.hasenbraten.de/vasm/) / DevPac-Style).
|
||||
This plugin delivers support for MC680xx 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.
|
||||
|
||||
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
|
||||
learning curve.
|
||||
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
|
||||
plugins has a steep learning curve.
|
||||
|
||||
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. At the time of writing, his plugin however, has not been release yet. Nevertheless, it has a lot of
|
||||
awesome features and is pretty advanced. Check it out. You can install both plugins at the same time and see what suits you more.
|
||||
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)
|
||||
who has been working on the same topic for quite some time. *On 01-Oct-21, he released
|
||||
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
|
||||
time and see what suits you more.
|
||||
|
||||
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 about a week's effort. I released a really early first version it because I think
|
||||
it's "good enough" to get started, and I can return to demo coding with its current state.
|
||||
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"
|
||||
to get started, and I can return to demo coding with its current state.
|
||||
|
||||
## Features
|
||||
|
||||
- Parser / Lexer for MC68000 (yes, only 68000 right now!) assembly language files in VAsm / DevPac style
|
||||
- Parser / Lexer for MC680xx 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!)
|
||||
- Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!)
|
||||
- Mnemonics code completion
|
||||
- Symbols / Labels / Macros code completion
|
||||
- References / Refactoring support for local and global labels, symbol assignments, and macros.
|
||||
- Symbols / labels / macros code completion
|
||||
- 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)
|
||||
- Brace matching
|
||||
- Quote handler
|
||||
- Goto Symbol support
|
||||
- Structure view
|
||||
- Documentation provider for symbol definitions and mnemonics (listing available addressing modes etc.).
|
||||
|
||||
### 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
|
||||
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:
|
||||
|
||||
- Instruction _mnemonic_ not supported on selected cpu (you won't get this currently as only MC68000 is supported)
|
||||
- No operands expected for _mnemonic_
|
||||
- Second operand _op_ unexpected for _mnemonic_
|
||||
- Unsupported addressing mode for _mnemonic_
|
||||
- Unsupported addressing mode _op_ for first operand of _mnemonic_
|
||||
- Unsupported addressing mode _op_ for second operand of _mnemonic_
|
||||
- Unsupported addressing modes for operands in this order for _mnemonic_ (try swapping)
|
||||
- Instruction _mnemonic_ is unsized (you tried to specify `.b`, `.w` or `.l`)
|
||||
- Operation size _(.b,.w,.l)_ unsupported for _mnemonic_
|
||||
- Operation size _(.b,.w,.l)_ unsupported (should be _(.b,.w,.l)_)
|
||||
|
||||
#### M68kDeadWrite - 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
|
||||
anything useful was done with it.
|
||||
|
||||
Analysis is aborted at global labels, flow control instructions, directives
|
||||
(e.g. conditional assembly) and macros with the register names as parameter.
|
||||
|
||||
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`.
|
||||
|
||||
#### M68kUnexpectedConditionalInstruction - 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.
|
||||
`movea`, `adda` and `suba` come to my mind.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
#### M68kSymbolDefinition
|
||||
|
||||
Provides the assigned value of a `=`, `set` or `equ` symbol definition when hovering over a symbol.
|
||||
|
||||
#### M68kMacroDefinition
|
||||
|
||||
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
|
||||
show all read, changes of the register contents. It does this until an instruction is found that defines (sets) the contents of the register
|
||||
(according to the size of the instruction where the cursor was placed).
|
||||
|
||||
The analysis ignores all code flow instructions and might be inaccurate for branches, macro use, etc. It also stops at global labels.
|
||||
|
||||
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).
|
||||
|
||||
#### M68kInstruction
|
||||
|
||||
When hovering over a mnemonic, it will show a short description of the assembly instruction.
|
||||
|
||||
For the documentation window, affected condition codes, allowed operation sizes and addressing modes are listed for the selected instruction
|
||||
(so only stuff from `cmpa` is listed when you're looking at a `cmp.w a0,a1` instruction).
|
||||
|
||||
If the current statement has no valid syntax, the instruction details of all matching mnemonics will be shown instead.
|
||||
|
||||
## Known issues
|
||||
|
||||
- `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`).
|
||||
- No support for includes. Scoping is for global symbols and labels is currently the whole project.
|
||||
- Scoping for global symbols, labels and macros is currently the whole project.
|
||||
- No support for register replacement (e.g. registers replaced by `EQUR` or `EQURL` will cause syntax errors)
|
||||
- While the Lexer supports the -spaces option (where a space introduces a comment), this cannot be configured yet (default is off).
|
||||
- No support for other processor instructions, FPU or 68020+ address modes.
|
||||
- No semantic checking for allowed address modes or data widths yet.
|
||||
- No support for other processor instructions and FPU. Yet.
|
||||
- The pretty esoteric use of `ZPC`, `ZA0-ZA7` or `ZSP` for zero (omitted) address in 68020 addressing modes is unsupported.
|
||||
- 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).
|
||||
- Code flow sometimes outputs "uhm?"
|
||||
- Missing but planned features:
|
||||
- Macro evaluation on invocation
|
||||
- Folding
|
||||
- Semantic inspections
|
||||
- Quick fixes
|
||||
- Formatter + Code Style Settings
|
||||
- More semantic inspections
|
||||
- Quick fixes
|
||||
- Maybe formatter + Code Style Settings
|
||||
- Register use analysis (but this only makes sense after macro evaluation)
|
||||
- Cycle counting
|
||||
|
||||
@ -60,21 +150,105 @@ to highlight the same address and data registers while editing (see new `View ->
|
||||
|
||||
## Development notice
|
||||
|
||||
This plugin has been written in Kotlin 1.5 using Grammar-Kit.
|
||||
This plugin has been written in Kotlin 1.9 using Grammar-Kit.
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for your projects (with attribution).
|
||||
|
||||
## Feedback
|
||||
|
||||
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.
|
||||
|
||||
Feedback and [rating](https://plugins.jetbrains.com/plugin/17268-mc68000-assembly-language-support/reviews)
|
||||
are appreciated. It really is keeping me motivated to continue development.
|
||||
|
||||
## Changelog
|
||||
|
||||
### V0.10 (20-Feb-24)
|
||||
|
||||
- Decided to release some features that have been sitting on my harddrive for almost two years, but never got released,
|
||||
because I was unable to get that damn formatter working in a way that was acceptable (the API and the docs are easily one
|
||||
the worst abominations I've come across).
|
||||
- Maintenance. Updated all dependencies to the latest versions.
|
||||
- New: Added semantic highlighting. Currently available for data and address registers and local labels.
|
||||
- Bugfix: addq/subq for address register stated it would affect the condition codes, which it in fact doesn't.
|
||||
- New: Added simple custom navigation bar.
|
||||
- New: Added folding support for functions and macro definitions.
|
||||
- New: Added assembler directives to code completion (only lower-case except for other directives like IF
|
||||
and MACRO, which are only suggested for upper-case).
|
||||
|
||||
### V0.9 (16-Aug-22)
|
||||
|
||||
- Maintenance. Updated all dependencies to the latest versions.
|
||||
- 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)
|
||||
|
||||
- Bugfix: `movem` ISA was wrong regarding the `movem.w <ea>,<registerlist>` (sign extends registers).
|
||||
- Cosmetics: Changed Register Flow Documentation wording from _reads_ to _uses_ and from _modifies_ to _changes_.
|
||||
- Bugfix: Minor fix for `andi/eori/ori to ccr` which were not byte sized in ISA.
|
||||
- Bugfix: Added alternate condition code tests `HS (=CC)` and `LO (=CS)`.
|
||||
- Performance: Optimized mnemonic lookup.
|
||||
- Enhancement: Reworked Instruction Documentation provider, now shows condition codes.
|
||||
- Bugfix: In ISA `exg` is no longer treated as setting a definitive value.
|
||||
- New: Added inspection to find dead writes to registers!
|
||||
- New: Added inspection to warn about unexpected condition code unaffecting instructions before conditional instructions.
|
||||
|
||||
### V0.4 (03-Aug-21)
|
||||
|
||||
- Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3.
|
||||
- Enhancement: Added Structure View filters.
|
||||
- New: Added inspection to validate the correctness of a MC68000 instruction regarding operation size and address modes.
|
||||
- Bugfix: Added several missing assembler directives (`opt`, `machine`, etc.).
|
||||
- Bugfix: Uppercase hexadecimal literals were not parsed (JFlex bug?).
|
||||
- Bugfix: Interpretation of register lists was wrong in BNF.
|
||||
- New: Added Documentation Provider for symbol definitions (shows assigned declaration).
|
||||
- New: Added Documentation Provider for mnemonics (simple version, generated out of ISA information).
|
||||
- Bugfix: Macro definitions with colons and without space supported (as found in P61a source).
|
||||
- New: When asking for documentation on registers, a code flow analysis is done. Cool stuff!
|
||||
|
||||
### V0.3 (28-Jul-21)
|
||||
|
||||
- Enhancement: Macro contents are no longer parsed, added syntax highlighting options for macros.
|
||||
- Enhancement: Macro definitions are now word and stub indexed, macro calls reference to definition.
|
||||
- Enhancement: Macro definition refactoring and find usages support.
|
||||
- New: Macro definition refactoring and find usages support.
|
||||
- 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.
|
||||
- Performance: Reference search for global labels and symbols now uses stub index.
|
||||
- Compatibility: Restored compatibility with IDE versions < 2021.1.
|
||||
@ -90,4 +264,4 @@ make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.
|
||||
|
||||
### V0.1 (20-Jul-21)
|
||||
|
||||
- Initial public release.
|
||||
- Initial public release.
|
||||
|
81
build.gradle
81
build.gradle
@ -1,82 +1,64 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.intellij' version '1.1.3'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.21'
|
||||
id 'org.jetbrains.intellij' version '1.17.1'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
|
||||
id 'jacoco'
|
||||
id 'com.github.kt3k.coveralls' version '2.11.0'
|
||||
}
|
||||
|
||||
group = 'de.platon42'
|
||||
version = '0.3'
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
version = '0.10'
|
||||
sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
/*
|
||||
To run tests in IntelliJ use these VM Options for run configuration
|
||||
To run tests in IntelliJ use these VM Options for run configuration
|
||||
-ea -Didea.system.path=build/idea-sandbox/system-test -Didea.config.path=build/idea-sandbox/config-test -Didea.plugins.path=build/idea-sandbox/plugins-test
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
testImplementation "org.assertj:assertj-core:3.20.2"
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0-M1'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0-M1'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||
testImplementation 'org.assertj:assertj-core:3.25.3'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2'
|
||||
// testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
intellij {
|
||||
setVersion("2021.1.3") // LATEST-EAP-SNAPSHOT
|
||||
setVersion("2022.3") // LATEST-EAP-SNAPSHOT
|
||||
setUpdateSinceUntilBuild(false)
|
||||
// setPlugins(["com.intellij.java"])
|
||||
}
|
||||
|
||||
runPluginVerifier {
|
||||
ideVersions = ["IC-193.5662.53", "IC-211.7628.21", // 2019.3.1 - 2021.1.3
|
||||
"CL-193.5233.103", "CL-193.7288.25", // 2019.3
|
||||
"CL-201.6668.126", "CL-201.8743.17", // 2020.1
|
||||
"CL-202.6397.106", "CL-202.8194.17", // 2020.2
|
||||
"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"
|
||||
ideVersions = ["IC-203.6682.168", "IC-233.14015.106", // 2020.3 - 2023.3
|
||||
"CL-203.8084.11", "CL-233.14015.92"] // 2020.3 - 2023.3
|
||||
|
||||
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier"
|
||||
}
|
||||
|
||||
patchPluginXml {
|
||||
setChangeNotes("""
|
||||
<h4>V0.3 (28-Jul-21)</h4>
|
||||
<h4>V0.10 (20-Feb-24)</h4>
|
||||
<ul>
|
||||
<li>Enhancement: Macro contents are no longer parsed, added syntax highlighting options for macros.
|
||||
<li>Enhancement: Macro definitions are now word and stub indexed, macro calls reference to definition.
|
||||
<li>Enhancement: Macro definition refactoring and find usages support.
|
||||
<li>Enhancement: Structural View also shows macro definitions.
|
||||
<li>Bugfix: Missing REPT and ENDR assembler directives added.
|
||||
<li>Cosmetics: Changed or added some icons at various places.
|
||||
<li>Performance: Reference search for global labels and symbols now uses stub index.
|
||||
<li>Compatibility: Restored compatibility with IDE versions < 2021.1.
|
||||
<li>Performance: Optimized lexer.
|
||||
<li>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).
|
||||
<li>Maintenance. Updated all dependencies to the latest versions.
|
||||
<li>New: Added semantic highlighting. Currently available for data and address registers and local labels.
|
||||
<li>Bugfix: addq/subq for address register stated it would affect the condition codes, which it in fact doesn't.
|
||||
<li>New: Added simple custom navigation bar.
|
||||
<li>New: Added folding support for functions and macro definitions.
|
||||
<li>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).
|
||||
</ul>
|
||||
<h4>V0.2 (27-Jul-21)</h4>
|
||||
<ul>
|
||||
<li>Cosmetics: Added (same) icon for plugin as for file type.
|
||||
<li>Performance: Use Word-Index for global labels and symbols instead of iterating over the file.
|
||||
<li>Performance: Use Stub-Index for global labels and symbols.
|
||||
<li>Bugfix: No longer reports a syntax error when file lacks terminating End-Of-Line.
|
||||
<li>Enhancement: Registers are now offered for code completion, making editing less annoying.
|
||||
</ul>
|
||||
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
|
||||
<p>Full changelog available at <a href="https://git.platon42.de/chrisly42/mc68000-asm-plugin#changelog">Gitea project site</a>.</p>
|
||||
""")
|
||||
}
|
||||
|
||||
@ -87,10 +69,13 @@ test {
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
runIde {
|
||||
jvmArgs '--add-exports', 'java.base/jdk.internal.vm=ALL-UNNAMED'
|
||||
}
|
||||
}
|
||||
|
||||
jacoco {
|
||||
toolVersion = '0.8.7'
|
||||
toolVersion = '0.8.8'
|
||||
}
|
||||
|
||||
jacocoTestReport {
|
||||
@ -102,4 +87,4 @@ jacocoTestReport {
|
||||
|
||||
publishPlugin {
|
||||
setToken(intellijPublishToken)
|
||||
}
|
||||
}
|
||||
|
BIN
docs/example.png
Normal file
BIN
docs/example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
Binary file not shown.
Before Width: | Height: | Size: 91 KiB |
@ -1,4 +1,4 @@
|
||||
kotlin.code.style=official
|
||||
kotlin.incremental=true
|
||||
intellijPublishToken=perm:dummy
|
||||
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"
|
||||
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
17
plans.txt
Normal file
17
plans.txt
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
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
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAddressRegisterIndirectAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
@ -3,7 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAddressRegisterIndirectPostIncAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectPostIncAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
@ -3,7 +3,7 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAddressRegisterIndirectPreDecAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectPreDecAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
@ -3,12 +3,12 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAddressRegisterIndirectWithDisplacementNewAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectWithDisplacementNewAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithDisplacement {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
||||
@NotNull
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAddressRegisterIndirectWithDisplacementOldAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectWithDisplacementOldAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithDisplacement {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
||||
@NotNull
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -4,18 +4,15 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kAddressRegisterIndirectWithIndexNewAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectWithIndexNewAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithDisplacement, M68kWithIndexRegister {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
||||
@Nullable
|
||||
M68kDataWidth getDataWidth();
|
||||
|
||||
@NotNull
|
||||
M68kRegister getRegister();
|
||||
M68kIndexRegister getIndexRegister();
|
||||
|
||||
@Nullable
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -4,18 +4,15 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kAddressRegisterIndirectWithIndexOldAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kAddressRegisterIndirectWithIndexOldAddressingMode extends M68kAddressingMode, M68kWithAddressRegisterIndirect, M68kWithDisplacement, M68kWithIndexRegister {
|
||||
|
||||
@NotNull
|
||||
M68kAddressRegister getAddressRegister();
|
||||
|
||||
@Nullable
|
||||
M68kDataWidth getDataWidth();
|
||||
|
||||
@NotNull
|
||||
M68kRegister getRegister();
|
||||
M68kIndexRegister getIndexRegister();
|
||||
|
||||
@Nullable
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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 M68kAsmOp extends M68kPsiElement {
|
||||
@ -8,4 +9,9 @@ public interface M68kAsmOp extends M68kPsiElement {
|
||||
@Nullable
|
||||
M68kOperandSize getOperandSize();
|
||||
|
||||
@NotNull
|
||||
String getMnemonic();
|
||||
|
||||
int getOpSize();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// 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 M68kIndexRegister extends M68kPsiElement {
|
||||
|
||||
@Nullable
|
||||
M68kDataWidth getDataWidth();
|
||||
|
||||
@Nullable
|
||||
M68kIndexScale getIndexScale();
|
||||
|
||||
@NotNull
|
||||
M68kRegister getRegister();
|
||||
|
||||
boolean isLongWidth();
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -3,4 +3,6 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
public interface M68kOperandSize extends M68kPsiElement {
|
||||
|
||||
int getSize();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
// 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,17 +2,13 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface M68kPreprocessorDirective extends M68kPsiElement {
|
||||
|
||||
@Nullable
|
||||
M68kGlobalLabel getGlobalLabel();
|
||||
|
||||
@Nullable
|
||||
M68kLocalLabel getLocalLabel();
|
||||
@NotNull
|
||||
M68kPreprocessorKeyword getPreprocessorKeyword();
|
||||
|
||||
@NotNull
|
||||
List<M68kExpr> getExprList();
|
||||
|
@ -0,0 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
public interface M68kPreprocessorKeyword extends M68kPsiElement {
|
||||
|
||||
}
|
@ -3,9 +3,9 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kProgramCounterIndirectWithDisplacementNewAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kProgramCounterIndirectWithDisplacementNewAddressingMode extends M68kAddressingMode, M68kWithDisplacement {
|
||||
|
||||
@NotNull
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kProgramCounterIndirectWithDisplacementOldAddressingMode extends M68kAddressingMode {
|
||||
public interface M68kProgramCounterIndirectWithDisplacementOldAddressingMode extends M68kAddressingMode, M68kWithDisplacement {
|
||||
|
||||
@Nullable
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithOptionalIndexRegister {
|
||||
|
||||
@Nullable
|
||||
M68kIndexRegister getIndexRegister();
|
||||
|
||||
@Nullable
|
||||
M68kBaseDisplacement getBaseDisplacement();
|
||||
|
||||
}
|
@ -4,15 +4,12 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kProgramCounterIndirectWithIndexNewAddressingMode extends M68kAddressingMode {
|
||||
|
||||
@Nullable
|
||||
M68kDataWidth getDataWidth();
|
||||
public interface M68kProgramCounterIndirectWithIndexNewAddressingMode extends M68kAddressingMode, M68kWithDisplacement, M68kWithIndexRegister {
|
||||
|
||||
@NotNull
|
||||
M68kRegister getRegister();
|
||||
M68kIndexRegister getIndexRegister();
|
||||
|
||||
@Nullable
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -4,15 +4,12 @@ package de.platon42.intellij.plugins.m68k.psi;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kProgramCounterIndirectWithIndexOldAddressingMode extends M68kAddressingMode {
|
||||
|
||||
@Nullable
|
||||
M68kDataWidth getDataWidth();
|
||||
public interface M68kProgramCounterIndirectWithIndexOldAddressingMode extends M68kAddressingMode, M68kWithDisplacement, M68kWithIndexRegister {
|
||||
|
||||
@NotNull
|
||||
M68kRegister getRegister();
|
||||
M68kIndexRegister getIndexRegister();
|
||||
|
||||
@Nullable
|
||||
M68kExpr getExpr();
|
||||
M68kExpr getDisplacement();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kProgramCounterMemoryIndirectAddressingMode extends M68kAddressingMode, M68kWithBaseDisplacement, M68kWithOuterDisplacement {
|
||||
|
||||
@Nullable
|
||||
M68kBaseDisplacement getBaseDisplacement();
|
||||
|
||||
@Nullable
|
||||
M68kOuterDisplacement getOuterDisplacement();
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// 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();
|
||||
|
||||
}
|
@ -1,13 +1,21 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import de.platon42.intellij.plugins.m68k.asm.Register;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface M68kRegisterListAddressingMode extends M68kAddressingMode {
|
||||
|
||||
@NotNull
|
||||
List<M68kRegister> getRegisterList();
|
||||
|
||||
@NotNull
|
||||
List<M68kRegisterRange> getRegisterRangeList();
|
||||
|
||||
@NotNull
|
||||
Set<Register> getRegisters();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
// 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface M68kRegisterRange extends M68kPsiElement {
|
||||
|
||||
@NotNull
|
||||
List<M68kRegister> getRegisterList();
|
||||
|
||||
@NotNull
|
||||
M68kRegister getStartRegister();
|
||||
|
||||
@Nullable
|
||||
M68kRegister getEndRegister();
|
||||
|
||||
}
|
@ -18,12 +18,14 @@ public interface M68kTypes {
|
||||
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_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_OLD_ADDRESSING_MODE = new M68kElementType("ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE");
|
||||
IElementType ADDRESS_SIZE = new M68kElementType("ADDRESS_SIZE");
|
||||
IElementType ASM_INSTRUCTION = new M68kElementType("ASM_INSTRUCTION");
|
||||
IElementType ASM_OP = new M68kElementType("ASM_OP");
|
||||
IElementType ASSIGNMENT = new M68kElementType("ASSIGNMENT");
|
||||
IElementType BASE_DISPLACEMENT = new M68kElementType("BASE_DISPLACEMENT");
|
||||
IElementType BINARY_ADD_EXPR = new M68kElementType("BINARY_ADD_EXPR");
|
||||
IElementType BINARY_BITWISE_AND_EXPR = new M68kElementType("BINARY_BITWISE_AND_EXPR");
|
||||
IElementType BINARY_BITWISE_OR_EXPR = new M68kElementType("BINARY_BITWISE_OR_EXPR");
|
||||
@ -48,23 +50,35 @@ public interface M68kTypes {
|
||||
IElementType EXPR = new M68kElementType("EXPR");
|
||||
IElementType GLOBAL_LABEL = M68kStubElementTypeFactory.stubFactory("GLOBAL_LABEL");
|
||||
IElementType IMMEDIATE_DATA = new M68kElementType("IMMEDIATE_DATA");
|
||||
IElementType INDEX_REGISTER = new M68kElementType("INDEX_REGISTER");
|
||||
IElementType INDEX_SCALE = new M68kElementType("INDEX_SCALE");
|
||||
IElementType LITERAL_EXPR = new M68kElementType("LITERAL_EXPR");
|
||||
IElementType LOCAL_LABEL = new M68kElementType("LOCAL_LABEL");
|
||||
IElementType MACRO_CALL = new M68kElementType("MACRO_CALL");
|
||||
IElementType MACRO_DEFINITION = M68kStubElementTypeFactory.stubFactory("MACRO_DEFINITION");
|
||||
IElementType MACRO_NAME_DEFINITION = new M68kElementType("MACRO_NAME_DEFINITION");
|
||||
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 OUTER_DISPLACEMENT = new M68kElementType("OUTER_DISPLACEMENT");
|
||||
IElementType PAREN_EXPR = new M68kElementType("PAREN_EXPR");
|
||||
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_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_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 REF_EXPR = new M68kElementType("REF_EXPR");
|
||||
IElementType REGISTER = new M68kElementType("REGISTER");
|
||||
IElementType REGISTER_LIST_ADDRESSING_MODE = new M68kElementType("REGISTER_LIST_ADDRESSING_MODE");
|
||||
IElementType REGISTER_RANGE = new M68kElementType("REGISTER_RANGE");
|
||||
IElementType SPECIAL_REGISTER = new M68kElementType("SPECIAL_REGISTER");
|
||||
IElementType SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE = new M68kElementType("SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE");
|
||||
IElementType STATEMENT = new M68kElementType("STATEMENT");
|
||||
@ -123,6 +137,8 @@ public interface M68kTypes {
|
||||
IElementType OTHER_DIRECTIVE = new M68kTokenType("OTHER_DIRECTIVE");
|
||||
IElementType PC = new M68kTokenType("PC");
|
||||
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_SR = new M68kTokenType("REG_SR");
|
||||
IElementType REG_USP = new M68kTokenType("REG_USP");
|
||||
@ -130,6 +146,8 @@ public interface M68kTypes {
|
||||
IElementType ROUND_L = new M68kTokenType("ROUND_L");
|
||||
IElementType ROUND_R = new M68kTokenType("ROUND_R");
|
||||
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 SYMBOL = new M68kTokenType("SYMBOL");
|
||||
IElementType SYMBOLDEF = new M68kTokenType("SYMBOLDEF");
|
||||
@ -153,6 +171,8 @@ public interface M68kTypes {
|
||||
return new M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl(node);
|
||||
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) {
|
||||
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) {
|
||||
return new M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl(node);
|
||||
} else if (type == ADDRESS_REGISTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
||||
@ -165,6 +185,8 @@ public interface M68kTypes {
|
||||
return new M68kAsmOpImpl(node);
|
||||
} else if (type == ASSIGNMENT) {
|
||||
return new M68kAssignmentImpl(node);
|
||||
} else if (type == BASE_DISPLACEMENT) {
|
||||
return new M68kBaseDisplacementImpl(node);
|
||||
} else if (type == BINARY_ADD_EXPR) {
|
||||
return new M68kBinaryAddExprImpl(node);
|
||||
} else if (type == BINARY_BITWISE_AND_EXPR) {
|
||||
@ -211,6 +233,10 @@ public interface M68kTypes {
|
||||
return new M68kGlobalLabelImpl(node);
|
||||
} else if (type == IMMEDIATE_DATA) {
|
||||
return new M68kImmediateDataImpl(node);
|
||||
} else if (type == INDEX_REGISTER) {
|
||||
return new M68kIndexRegisterImpl(node);
|
||||
} else if (type == INDEX_SCALE) {
|
||||
return new M68kIndexScaleImpl(node);
|
||||
} else if (type == LITERAL_EXPR) {
|
||||
return new M68kLiteralExprImpl(node);
|
||||
} else if (type == LOCAL_LABEL) {
|
||||
@ -223,26 +249,46 @@ public interface M68kTypes {
|
||||
return new M68kMacroNameDefinitionImpl(node);
|
||||
} else if (type == MACRO_PLAIN_LINE) {
|
||||
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) {
|
||||
return new M68kOperandSizeImpl(node);
|
||||
} else if (type == OUTER_DISPLACEMENT) {
|
||||
return new M68kOuterDisplacementImpl(node);
|
||||
} else if (type == PAREN_EXPR) {
|
||||
return new M68kParenExprImpl(node);
|
||||
} else if (type == PREPROCESSOR_DIRECTIVE) {
|
||||
return new M68kPreprocessorDirectiveImpl(node);
|
||||
} else if (type == PREPROCESSOR_KEYWORD) {
|
||||
return new M68kPreprocessorKeywordImpl(node);
|
||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE) {
|
||||
return new M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl(node);
|
||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE) {
|
||||
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) {
|
||||
return new M68kProgramCounterIndirectWithIndexNewAddressingModeImpl(node);
|
||||
} else if (type == PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE) {
|
||||
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) {
|
||||
return new M68kProgramCounterReferenceImpl(node);
|
||||
} else if (type == REF_EXPR) {
|
||||
return new M68kRefExprImpl(node);
|
||||
} else if (type == REGISTER_LIST_ADDRESSING_MODE) {
|
||||
return new M68kRegisterListAddressingModeImpl(node);
|
||||
} else if (type == REGISTER_RANGE) {
|
||||
return new M68kRegisterRangeImpl(node);
|
||||
} else if (type == SPECIAL_REGISTER) {
|
||||
return new M68kSpecialRegisterImpl(node);
|
||||
} else if (type == SPECIAL_REGISTER_DIRECT_ADDRESSING_MODE) {
|
||||
|
@ -20,30 +20,50 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
|
||||
public void visitAddressRegisterIndirectAddressingMode(@NotNull M68kAddressRegisterIndirectAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectPostIncAddressingMode(@NotNull M68kAddressRegisterIndirectPostIncAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectPreDecAddressingMode(@NotNull M68kAddressRegisterIndirectPreDecAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectWithDisplacementNewAddressingMode(@NotNull M68kAddressRegisterIndirectWithDisplacementNewAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
// visitWithDisplacement(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectWithDisplacementOldAddressingMode(@NotNull M68kAddressRegisterIndirectWithDisplacementOldAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
// visitWithDisplacement(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexBaseDisplacementAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithOptionalAddressRegisterIndirect(o);
|
||||
// visitWithBaseDisplacement(o);
|
||||
// visitWithOptionalIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectWithIndexNewAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexNewAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
// visitWithDisplacement(o);
|
||||
// visitWithIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitAddressRegisterIndirectWithIndexOldAddressingMode(@NotNull M68kAddressRegisterIndirectWithIndexOldAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithAddressRegisterIndirect(o);
|
||||
// visitWithDisplacement(o);
|
||||
// visitWithIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitAddressSize(@NotNull M68kAddressSize o) {
|
||||
@ -66,6 +86,10 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitBaseDisplacement(@NotNull M68kBaseDisplacement o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitDataRegister(@NotNull M68kDataRegister o) {
|
||||
visitRegister(o);
|
||||
}
|
||||
@ -86,6 +110,14 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitIndexRegister(@NotNull M68kIndexRegister o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitIndexScale(@NotNull M68kIndexScale o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitLocalLabel(@NotNull M68kLocalLabel o) {
|
||||
visitNamedElement(o);
|
||||
}
|
||||
@ -106,28 +138,91 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
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) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitOuterDisplacement(@NotNull M68kOuterDisplacement o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitPreprocessorDirective(@NotNull M68kPreprocessorDirective o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitPreprocessorKeyword(@NotNull M68kPreprocessorKeyword o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterIndirectWithDisplacementNewAddressingMode(@NotNull M68kProgramCounterIndirectWithDisplacementNewAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithDisplacement(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterIndirectWithDisplacementOldAddressingMode(@NotNull M68kProgramCounterIndirectWithDisplacementOldAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithDisplacement(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterIndirectWithIndexBaseDisplacementAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexBaseDisplacementAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithBaseDisplacement(o);
|
||||
// visitWithOptionalIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterIndirectWithIndexNewAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexNewAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithDisplacement(o);
|
||||
// visitWithIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterIndirectWithIndexOldAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexOldAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithDisplacement(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) {
|
||||
@ -142,6 +237,10 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitRegisterRange(@NotNull M68kRegisterRange o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitSpecialRegister(@NotNull M68kSpecialRegister o) {
|
||||
visitRegister(o);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl ex
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl ex
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -31,21 +31,15 @@ public class M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl extends M
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
|
@ -31,21 +31,15 @@ public class M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl extends M
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAsmOp;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kOperandSize;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kPsiImplUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -33,4 +34,15 @@ public class M68kAsmOpImpl extends ASTWrapperPsiElement implements M68kAsmOp {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kOperandSize.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getMnemonic() {
|
||||
return M68kPsiImplUtil.getMnemonic(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpSize() {
|
||||
return M68kPsiImplUtil.getOpSize(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
public M68kGlobalLabelImpl(@NotNull M68kGlobalLabelStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
public M68kGlobalLabelImpl(@NotNull M68kGlobalLabelStub stub, @NotNull IStubElementType<?, ?> type) {
|
||||
super(stub, type);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
|
@ -0,0 +1,51 @@
|
||||
// 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.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class M68kIndexRegisterImpl extends ASTWrapperPsiElement implements M68kIndexRegister {
|
||||
|
||||
public M68kIndexRegisterImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitIndexRegister(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
|
||||
@Nullable
|
||||
public M68kIndexScale getIndexScale() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kIndexScale.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongWidth() {
|
||||
return M68kPsiImplUtil.isLongWidth(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
public M68kMacroDefinitionImpl(@NotNull M68kMacroDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
public M68kMacroDefinitionImpl(@NotNull M68kMacroDefinitionStub stub, @NotNull IStubElementType<?, ?> type) {
|
||||
super(stub, type);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
|
@ -0,0 +1,46 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kOperandSize;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kPsiImplUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -24,4 +25,9 @@ public class M68kOperandSizeImpl extends ASTWrapperPsiElement implements M68kOpe
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return M68kPsiImplUtil.getSize(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
// 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,17 +1,15 @@
|
||||
// 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.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class M68kPreprocessorDirectiveImpl extends ASTWrapperPsiElement implements M68kPreprocessorDirective {
|
||||
public class M68kPreprocessorDirectiveImpl extends M68kPreprocessorDirectiveMixin implements M68kPreprocessorDirective {
|
||||
|
||||
public M68kPreprocessorDirectiveImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
@ -28,15 +26,9 @@ public class M68kPreprocessorDirectiveImpl extends ASTWrapperPsiElement implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kGlobalLabel getGlobalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kGlobalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLocalLabel getLocalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kLocalLabel.class);
|
||||
@NotNull
|
||||
public M68kPreprocessorKeyword getPreprocessorKeyword() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kPreprocessorKeyword.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,27 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
|
||||
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.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);
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@ public class M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl ext
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl ext
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,10 @@ 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 de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kIndexRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithIndexNewAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -25,21 +28,15 @@ public class M68kProgramCounterIndirectWithIndexNewAddressingModeImpl extends M6
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,10 @@ 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 de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kIndexRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithIndexOldAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -25,21 +28,15 @@ public class M68kProgramCounterIndirectWithIndexOldAddressingModeImpl extends M6
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kDataWidth.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
@ -4,12 +4,12 @@ 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.M68kRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kRegisterListAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.asm.Register;
|
||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class M68kRegisterListAddressingModeImpl extends M68kAddressingModeImpl implements M68kRegisterListAddressingMode {
|
||||
|
||||
@ -34,4 +34,16 @@ public class M68kRegisterListAddressingModeImpl extends M68kAddressingModeImpl i
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<M68kRegisterRange> getRegisterRangeList() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kRegisterRange.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<Register> getRegisters() {
|
||||
return M68kPsiImplUtil.getRegisters(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
// 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.M68kRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kRegisterRange;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class M68kRegisterRangeImpl extends ASTWrapperPsiElement implements M68kRegisterRange {
|
||||
|
||||
public M68kRegisterRangeImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitRegisterRange(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<M68kRegister> getRegisterList() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getStartRegister() {
|
||||
List<M68kRegister> p1 = getRegisterList();
|
||||
return p1.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kRegister getEndRegister() {
|
||||
List<M68kRegister> p1 = getRegisterList();
|
||||
return p1.size() < 2 ? null : p1.get(1);
|
||||
}
|
||||
|
||||
}
|
@ -19,8 +19,8 @@ public class M68kSymbolDefinitionImpl extends M68kSymbolDefinitionMixin implemen
|
||||
super(node);
|
||||
}
|
||||
|
||||
public M68kSymbolDefinitionImpl(@NotNull M68kSymbolDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
public M68kSymbolDefinitionImpl(@NotNull M68kSymbolDefinitionStub stub, @NotNull IStubElementType<?, ?> type) {
|
||||
super(stub, type);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
|
@ -10,7 +10,7 @@ class M68kFileElementType private constructor() : ILightStubFileElementType<PsiF
|
||||
@JvmField
|
||||
val INSTANCE = M68kFileElementType()
|
||||
|
||||
const val STUB_VERSION = 4
|
||||
const val STUB_VERSION = 8
|
||||
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
||||
const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE"
|
||||
}
|
||||
|
@ -19,10 +19,20 @@ object AssemblerDirectives {
|
||||
"align", "even", "odd", "cnop", "long", "dphrase", "phrase", "qphrase",
|
||||
|
||||
"cargs", "comm", "comment",
|
||||
"rsset", "clrfo", "clrso", "setfo", "setso"
|
||||
"rsset", "clrfo", "clrso", "setfo", "setso",
|
||||
|
||||
"rsreset", "rs.b", "rs.w", "rs.l"
|
||||
)
|
||||
|
||||
val otherDirective: Set<String> = setOf(
|
||||
val plainDirectives: Set<String> = setOf(
|
||||
"incdir", "include", "incbin", "output", "idnt",
|
||||
|
||||
"printt", "echo", "fail",
|
||||
|
||||
"opt"
|
||||
)
|
||||
|
||||
val otherDirectives: Set<String> = setOf(
|
||||
"if",
|
||||
"ifeq", "ifne", "ifgt", "ifge", "iflt", "ifle", "ifb", "ifnb", "ifc", "ifnc",
|
||||
"ifd", "ifnd", "ifmacrod", "ifmacrond",
|
||||
@ -36,15 +46,21 @@ object AssemblerDirectives {
|
||||
"extern", "nref", "xdef", "xref", "globl", "public", "weak",
|
||||
|
||||
"reg", "equr", "equrl",
|
||||
|
||||
"incdir", "include", "incbin", "output",
|
||||
"freg", "fequr", "fequrl",
|
||||
|
||||
"list", "nlist", "nolist", "llen", "nopage", "page", "spc",
|
||||
"org",
|
||||
|
||||
"assert", "fail", "print", "printt", "printv", "echo",
|
||||
"assert", "printv",
|
||||
|
||||
"inline", "einline",
|
||||
"rem", "erem"
|
||||
"rem", "erem",
|
||||
|
||||
"machine", "mc68000", "mc68010", "mc68020", "mc68030", "mc68040", "mc68060",
|
||||
"fpu",
|
||||
|
||||
"basereg", "endb", "far", "near", "initnear",
|
||||
|
||||
"end"
|
||||
)
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
package de.platon42.intellij.plugins.m68k.asm
|
||||
|
||||
const val CC_X_CLEAR = 0x10000
|
||||
const val CC_X_SET = 0x20000
|
||||
const val CC_X_UNDEF = 0x30000
|
||||
const val CC_X_RES = 0x40000
|
||||
const val CC_X_AND = 0x50000
|
||||
const val CC_X_OR = 0x60000
|
||||
const val CC_X_CARRY = 0x70000
|
||||
const val CC_X_TST = 0xf0000
|
||||
|
||||
const val CC_N_CLEAR = 0x01000
|
||||
const val CC_N_SET = 0x02000
|
||||
const val CC_N_UNDEF = 0x03000
|
||||
const val CC_N_RES = 0x04000
|
||||
const val CC_N_AND = 0x05000
|
||||
const val CC_N_OR = 0x06000
|
||||
const val CC_N_TST = 0x0f000
|
||||
|
||||
const val CC_Z_CLEAR = 0x00100
|
||||
const val CC_Z_SET = 0x00200
|
||||
const val CC_Z_UNDEF = 0x00300
|
||||
const val CC_Z_RES = 0x00400
|
||||
const val CC_Z_AND = 0x00500
|
||||
const val CC_Z_OR = 0x00600
|
||||
const val CC_Z_TST = 0x00f00
|
||||
|
||||
const val CC_V_CLEAR = 0x00010
|
||||
const val CC_V_SET = 0x00020
|
||||
const val CC_V_UNDEF = 0x00030
|
||||
const val CC_V_RES = 0x00040
|
||||
const val CC_V_AND = 0x00050
|
||||
const val CC_V_OR = 0x00060
|
||||
const val CC_V_TST = 0x000f0
|
||||
|
||||
const val CC_C_CLEAR = 0x00001
|
||||
const val CC_C_SET = 0x00002
|
||||
const val CC_C_UNDEF = 0x00003
|
||||
const val CC_C_RES = 0x00004
|
||||
const val CC_C_AND = 0x00005
|
||||
const val CC_C_OR = 0x00006
|
||||
const val CC_C_TST = 0x0000f
|
||||
|
||||
private const val CC_NOT_AFFECTED_STR = "Not affected"
|
||||
private const val CC_ALWAYS_CLEAR_STR = "Always cleared"
|
||||
private const val CC_ALWAYS_SET_STR = "Always set"
|
||||
private const val CC_UNDEFINED_STR = "Undefined"
|
||||
private const val CC_RES_STR = "From result"
|
||||
private const val CC_AND_STR = "And'ed: Only cleared for zero bit"
|
||||
private const val CC_OR_STR = "Or'ed: Only set for one bit"
|
||||
|
||||
fun getCcInfo(cc: Int): Map<String, Pair<String, String>> {
|
||||
val xnzvcMap = LinkedHashMap<String, Pair<String, String>>(5)
|
||||
xnzvcMap["X"] = when (cc and CC_X_TST) {
|
||||
0 -> "-" to CC_NOT_AFFECTED_STR
|
||||
CC_X_SET -> "1" to CC_ALWAYS_SET_STR
|
||||
CC_X_CLEAR -> "0" to CC_ALWAYS_CLEAR_STR
|
||||
CC_X_UNDEF -> "U" to CC_UNDEFINED_STR
|
||||
CC_X_AND -> "*" to CC_AND_STR
|
||||
CC_X_OR -> "*" to CC_OR_STR
|
||||
CC_X_CARRY -> "*" to "Set the same as the carry bit"
|
||||
else -> "*" to "$CC_RES_STR (usually the bit shifted out)"
|
||||
}
|
||||
xnzvcMap["N"] = when (cc and CC_N_TST) {
|
||||
0 -> "-" to CC_NOT_AFFECTED_STR
|
||||
CC_N_SET -> "1" to CC_ALWAYS_SET_STR
|
||||
CC_N_CLEAR -> "0" to CC_ALWAYS_CLEAR_STR
|
||||
CC_N_UNDEF -> "U" to CC_UNDEFINED_STR
|
||||
CC_N_AND -> "*" to CC_AND_STR
|
||||
CC_N_OR -> "*" to CC_OR_STR
|
||||
else -> "*" to "$CC_RES_STR (usually if negative)"
|
||||
}
|
||||
xnzvcMap["Z"] = when (cc and CC_Z_TST) {
|
||||
0 -> "-" to CC_NOT_AFFECTED_STR
|
||||
CC_Z_SET -> "1" to CC_ALWAYS_SET_STR
|
||||
CC_Z_CLEAR -> "0" to CC_ALWAYS_CLEAR_STR
|
||||
CC_Z_UNDEF -> "U" to CC_UNDEFINED_STR
|
||||
CC_Z_AND -> "*" to CC_AND_STR
|
||||
CC_Z_OR -> "*" to CC_OR_STR
|
||||
else -> "*" to "$CC_RES_STR (usually if zero)"
|
||||
}
|
||||
xnzvcMap["V"] = when (cc and CC_V_TST) {
|
||||
0 -> "-" to CC_NOT_AFFECTED_STR
|
||||
CC_V_SET -> "1" to CC_ALWAYS_SET_STR
|
||||
CC_V_CLEAR -> "0" to CC_ALWAYS_CLEAR_STR
|
||||
CC_V_UNDEF -> "U" to CC_UNDEFINED_STR
|
||||
CC_V_AND -> "*" to CC_AND_STR
|
||||
CC_V_OR -> "*" to CC_OR_STR
|
||||
else -> "*" to "$CC_RES_STR (usually for overflows)"
|
||||
}
|
||||
xnzvcMap["C"] = when (cc and CC_V_TST) {
|
||||
0 -> "-" to CC_NOT_AFFECTED_STR
|
||||
CC_V_SET -> "1" to CC_ALWAYS_SET_STR
|
||||
CC_V_CLEAR -> "0" to CC_ALWAYS_CLEAR_STR
|
||||
CC_V_UNDEF -> "U" to CC_UNDEFINED_STR
|
||||
CC_V_AND -> "*" to CC_AND_STR
|
||||
CC_V_OR -> "*" to CC_OR_STR
|
||||
else -> "*" to "$CC_RES_STR (usually carry/borrow)"
|
||||
}
|
||||
|
||||
return xnzvcMap
|
||||
}
|
||||
|
||||
fun cc(xnzvc: String): Int {
|
||||
var result = 0
|
||||
result += when (xnzvc[0]) {
|
||||
'-' -> 0
|
||||
'0' -> CC_X_CLEAR
|
||||
'1' -> CC_X_SET
|
||||
'U' -> CC_X_UNDEF
|
||||
'*' -> CC_X_RES
|
||||
'A' -> CC_X_AND
|
||||
'O' -> CC_X_OR
|
||||
'C' -> CC_X_CARRY
|
||||
'?' -> CC_X_TST
|
||||
else -> throw IllegalArgumentException("Syntax Error")
|
||||
}
|
||||
result += when (xnzvc[1]) {
|
||||
'-' -> 0
|
||||
'0' -> CC_N_CLEAR
|
||||
'1' -> CC_N_SET
|
||||
'U' -> CC_N_UNDEF
|
||||
'*' -> CC_N_RES
|
||||
'A' -> CC_N_AND
|
||||
'O' -> CC_N_OR
|
||||
'?' -> CC_N_TST
|
||||
else -> throw IllegalArgumentException("Syntax Error")
|
||||
}
|
||||
result += when (xnzvc[2]) {
|
||||
'-' -> 0
|
||||
'0' -> CC_Z_CLEAR
|
||||
'1' -> CC_Z_SET
|
||||
'U' -> CC_Z_UNDEF
|
||||
'*' -> CC_Z_RES
|
||||
'A' -> CC_Z_AND
|
||||
'O' -> CC_Z_OR
|
||||
'?' -> CC_Z_TST
|
||||
else -> throw IllegalArgumentException("Syntax Error")
|
||||
}
|
||||
result += when (xnzvc[3]) {
|
||||
'-' -> 0
|
||||
'0' -> CC_V_CLEAR
|
||||
'1' -> CC_V_SET
|
||||
'U' -> CC_V_UNDEF
|
||||
'*' -> CC_V_RES
|
||||
'A' -> CC_V_AND
|
||||
'O' -> CC_V_OR
|
||||
'?' -> CC_V_TST
|
||||
else -> throw IllegalArgumentException("Syntax Error")
|
||||
}
|
||||
result += when (xnzvc[4]) {
|
||||
'-' -> 0
|
||||
'0' -> CC_C_CLEAR
|
||||
'1' -> CC_C_SET
|
||||
'U' -> CC_C_UNDEF
|
||||
'*' -> CC_C_RES
|
||||
'A' -> CC_C_AND
|
||||
'O' -> CC_C_OR
|
||||
'?' -> CC_C_TST
|
||||
else -> throw IllegalArgumentException("Syntax Error")
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
enum class ConditionCode(val cc: String, val testedCc: Int) {
|
||||
TRUE("t", cc("-----")),
|
||||
FALSE("f", cc("-----")),
|
||||
HI("hi", cc("--?-?")),
|
||||
LS("ls", cc("--?-?")),
|
||||
CC("cc", cc("----?")),
|
||||
HS("hs", cc("----?")), // same as CC
|
||||
CS("cs", cc("----?")),
|
||||
LO("lo", cc("----?")), // same as CS
|
||||
NE("ne", cc("--?--")),
|
||||
EQ("eq", cc("--?--")),
|
||||
VC("vc", cc("---?-")),
|
||||
VS("vs", cc("---?-")),
|
||||
PL("pl", cc("-?---")),
|
||||
MI("mi", cc("-?---")),
|
||||
GE("ge", cc("-?-?-")),
|
||||
LT("lt", cc("-?-?-")),
|
||||
GT("gt", cc("-???-")),
|
||||
LE("le", cc("-???-"));
|
||||
|
||||
companion object {
|
||||
private val NAME_TO_CC_MAP = values().associateBy { it.cc }
|
||||
|
||||
fun getCcFromName(cc: String) = NAME_TO_CC_MAP[cc.lowercase()]!!
|
||||
|
||||
fun getCcFromMnemonic(originalMnemonic: String, mnemonic: String) =
|
||||
// handle special case for dbra
|
||||
if (mnemonic.equals("dbra", ignoreCase = true)) {
|
||||
FALSE
|
||||
} else {
|
||||
NAME_TO_CC_MAP[mnemonic.removePrefix(originalMnemonic.removeSuffix("CC")).lowercase()]!!
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,39 @@
|
||||
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)
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package de.platon42.intellij.plugins.m68k.documentation
|
||||
|
||||
import com.intellij.lang.documentation.AbstractDocumentationProvider
|
||||
import com.intellij.lang.documentation.DocumentationMarkup
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.text.HtmlBuilder
|
||||
import com.intellij.openapi.util.text.HtmlChunk
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import de.platon42.intellij.plugins.m68k.asm.AddressMode
|
||||
import de.platon42.intellij.plugins.m68k.asm.IsaData
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa
|
||||
import de.platon42.intellij.plugins.m68k.asm.getCcInfo
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAsmInstruction
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAsmOp
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kOperandSize
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.findExactIsaDataForInstruction
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.findOpSizeDescriptions
|
||||
|
||||
class M68kInstructionDocumentationProvider : AbstractDocumentationProvider() {
|
||||
|
||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||
if (element is M68kAsmInstruction) {
|
||||
val builder = HtmlBuilder()
|
||||
val isaData = findExactIsaDataForInstruction(element)
|
||||
if (isaData == null) {
|
||||
M68kIsa.findMatchingInstructions(element.asmOp.mnemonic).forEach { buildDocForIsaData(it, builder) }
|
||||
} else {
|
||||
buildDocForIsaData(isaData, builder)
|
||||
}
|
||||
return builder.toString()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun buildDocForIsaData(isaData: IsaData, builder: HtmlBuilder) {
|
||||
val defBuilder = createDefinition(isaData)
|
||||
builder.append(defBuilder.wrapWith(DocumentationMarkup.DEFINITION_ELEMENT))
|
||||
|
||||
val hasSameCcsForEverything = isaData.modes.map { it.affectedCc }.distinct().count() == 1
|
||||
var alreadyShownCcsOnce = false
|
||||
val mnemonicInfoRows = HtmlBuilder()
|
||||
mnemonicInfoRows.appendWithSeparators(HtmlChunk.tag("tr").child(HtmlChunk.hr().wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL).attr("colspan", "3")),
|
||||
isaData.modes.map { allowedAdrMode ->
|
||||
val addressModeInfoRows = HtmlBuilder()
|
||||
val headerCells = if (allowedAdrMode.op2 != null) {
|
||||
listOf(
|
||||
HtmlChunk.text("Mnemonic / CCs").wrapWith(DocumentationMarkup.SECTION_HEADER_CELL),
|
||||
HtmlChunk.text("Operand 1").wrapWith(DocumentationMarkup.SECTION_HEADER_CELL),
|
||||
HtmlChunk.text("Operand 2").wrapWith(DocumentationMarkup.SECTION_HEADER_CELL)
|
||||
)
|
||||
} else if (allowedAdrMode.op1 != null) {
|
||||
listOf(
|
||||
HtmlChunk.text("Mnemonic / CCs").wrapWith(DocumentationMarkup.SECTION_HEADER_CELL),
|
||||
HtmlChunk.text("Operand").wrapWith(DocumentationMarkup.SECTION_HEADER_CELL)
|
||||
)
|
||||
} else {
|
||||
listOf(HtmlChunk.text("Mnemonic / CCs").wrapWith(DocumentationMarkup.SECTION_HEADER_CELL))
|
||||
}
|
||||
addressModeInfoRows.append(HtmlChunk.tag("tr").children(headerCells))
|
||||
|
||||
val contentBuilder = HtmlBuilder()
|
||||
val mnemonics = findOpSizeDescriptions(allowedAdrMode.size)
|
||||
.map { HtmlChunk.text(isaData.mnemonic + it) }
|
||||
contentBuilder.appendWithSeparators(HtmlChunk.br(), mnemonics)
|
||||
contentBuilder.append(HtmlChunk.hr())
|
||||
if (alreadyShownCcsOnce && hasSameCcsForEverything) {
|
||||
contentBuilder.append(HtmlChunk.text("Condition Codes: Same as above"))
|
||||
} else {
|
||||
alreadyShownCcsOnce = true
|
||||
contentBuilder.append(HtmlChunk.text("Condition Codes: "))
|
||||
contentBuilder.append(HtmlChunk.br())
|
||||
if (allowedAdrMode.affectedCc == 0) {
|
||||
contentBuilder.append(HtmlChunk.text("Not affected."))
|
||||
} else {
|
||||
val ccMap = getCcInfo(allowedAdrMode.affectedCc)
|
||||
val ccShortTableRows = HtmlBuilder()
|
||||
ccShortTableRows.append(
|
||||
HtmlChunk.tag("tr").children(ccMap.keys.map { HtmlChunk.text(it).wrapWith(DocumentationMarkup.SECTION_HEADER_CELL) })
|
||||
)
|
||||
ccShortTableRows.append(
|
||||
HtmlChunk.tag("tr").children(ccMap.values.map {
|
||||
HtmlChunk.text(it.first).wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL)
|
||||
})
|
||||
)
|
||||
contentBuilder.append(ccShortTableRows.wrapWith(DocumentationMarkup.SECTIONS_TABLE))
|
||||
contentBuilder.appendWithSeparators(HtmlChunk.br(), ccMap.map {
|
||||
HtmlChunk.text(it.key + " - " + it.value.second)
|
||||
})
|
||||
}
|
||||
}
|
||||
val cellsPerRow = ArrayList<HtmlChunk>(3)
|
||||
cellsPerRow.add(contentBuilder.toFragment())
|
||||
|
||||
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op1, allowedAdrMode.specialReg))
|
||||
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op2, allowedAdrMode.specialReg))
|
||||
|
||||
addressModeInfoRows.append(HtmlChunk.tag("tr").children(cellsPerRow.map { it.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL) }))
|
||||
addressModeInfoRows.toFragment()
|
||||
})
|
||||
|
||||
val contentBuilder = HtmlBuilder()
|
||||
contentBuilder.append(mnemonicInfoRows.wrapWith(DocumentationMarkup.SECTIONS_TABLE))
|
||||
|
||||
builder.append(contentBuilder.wrapWith(DocumentationMarkup.CONTENT_ELEMENT))
|
||||
}
|
||||
|
||||
override fun generateHoverDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||
if (element is M68kAsmInstruction) {
|
||||
val isaData = findExactIsaDataForInstruction(element) ?: return null
|
||||
val defBuilder = createDefinition(isaData)
|
||||
|
||||
val builder = HtmlBuilder()
|
||||
builder.append(defBuilder.wrapWith(DocumentationMarkup.DEFINITION_ELEMENT))
|
||||
return builder.toString()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun createDefinition(isaData: IsaData): HtmlBuilder {
|
||||
val defBuilder = HtmlBuilder()
|
||||
defBuilder.append(HtmlChunk.text(isaData.description).bold().wrapWith("pre"))
|
||||
if (isaData.isPrivileged) {
|
||||
defBuilder.append(HtmlChunk.font("red").addText("(privileged)").wrapWith(HtmlChunk.p()))
|
||||
}
|
||||
return defBuilder
|
||||
}
|
||||
|
||||
private fun collectAddressModes(addressModes: Set<AddressMode>?, specialReg: String?): HtmlChunk {
|
||||
if (addressModes == null) return HtmlChunk.text("")
|
||||
val modes = HtmlBuilder()
|
||||
addressModes.sortedBy(AddressMode::ordinal)
|
||||
.map { if (it == AddressMode.SPECIAL_REGISTER_DIRECT) specialReg!! else it.syntax }
|
||||
.forEach { modes.append(HtmlChunk.text(it).wrapWith(HtmlChunk.div())) }
|
||||
return modes.toFragment()
|
||||
}
|
||||
|
||||
override fun getCustomDocumentationElement(editor: Editor, file: PsiFile, contextElement: PsiElement?, targetOffset: Int): PsiElement? {
|
||||
if (contextElement == null) return null
|
||||
if (contextElement is M68kAsmInstruction) return contextElement
|
||||
val parent = contextElement.parent ?: return null
|
||||
if (parent is M68kAsmInstruction) return parent
|
||||
if (parent is M68kAsmOp) return parent.parent
|
||||
if (parent is M68kOperandSize) return parent.parent.parent
|
||||
return null
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
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()
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
package de.platon42.intellij.plugins.m68k.documentation
|
||||
|
||||
import com.intellij.lang.documentation.DocumentationMarkup
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.text.HtmlBuilder
|
||||
import com.intellij.openapi.util.text.HtmlChunk
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.ui.ColorUtil
|
||||
import com.intellij.ui.JBColor
|
||||
import de.platon42.intellij.plugins.m68k.asm.*
|
||||
import de.platon42.intellij.plugins.m68k.asm.Register.Companion.getRegFromName
|
||||
import de.platon42.intellij.plugins.m68k.psi.*
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.checkIfInstructionUsesRegister
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.evaluateRegisterUse
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.findExactIsaDataAndAllowedAdrModeForInstruction
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.getOpSizeOrDefault
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.modifyRwmWithOpsize
|
||||
|
||||
class M68kRegisterFlowDocumentationProvider : AbstractM68kDocumentationProvider() {
|
||||
|
||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
||||
return createDoc(element as M68kRegister, getSettings(element).maxLongDocumentationLines)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun generateHoverDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
||||
return createDoc(element as M68kRegister, getSettings(element).maxShortDocumentationLines)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun createDoc(element: M68kRegister, linesLimit: Int): String? {
|
||||
val register = getRegFromName(element.text)
|
||||
val addressingMode = PsiTreeUtil.getParentOfType(element, M68kAddressingMode::class.java) ?: return null
|
||||
val asmInstruction = PsiTreeUtil.getParentOfType(addressingMode, M68kAsmInstruction::class.java) ?: return null
|
||||
|
||||
val (isaData, adrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(asmInstruction) ?: return "unknown instruction"
|
||||
|
||||
val cursorInstRwmRegs = evaluateRegisterUse(asmInstruction, adrMode, register)
|
||||
val opSize = getOpSizeOrDefault(asmInstruction.asmOp.opSize, adrMode)
|
||||
|
||||
val rn = register.regname
|
||||
val thisInfo = cursorInstRwmRegs
|
||||
.joinToString(separator = ", ", prefix = "${isaData.mnemonic} instruction ") { rwmToDisplayText(it, rn) }
|
||||
val totalRwm = cursorInstRwmRegs.reduce(Int::or)
|
||||
|
||||
val firstOp = asmInstruction.addressingModeList[0] == addressingMode
|
||||
val cursorRwm = modifyRwmWithOpsize((adrMode.modInfo ushr if (firstOp) RWM_OP1_SHIFT else RWM_OP2_SHIFT) and RWM_OP_MASK, opSize)
|
||||
val backtrace = ArrayList<HtmlChunk>()
|
||||
val missingBits = if (cursorRwm and RWM_SET_L != 0) {
|
||||
if (totalRwm and RWM_SET_L == RWM_SET_L) {
|
||||
backtrace.add(
|
||||
HtmlChunk.tag("tr")
|
||||
.children(
|
||||
DocumentationMarkup.SECTION_CONTENT_CELL.attr("colspan", "3")
|
||||
.child(HtmlChunk.text("Register result is fully defined by this instruction."))
|
||||
)
|
||||
)
|
||||
0
|
||||
} else {
|
||||
RWM_SIZE_MASK and totalRwm.inv()
|
||||
}
|
||||
} else {
|
||||
RWM_SIZE_MASK and (((cursorRwm and RWM_MODIFY_L) ushr RWM_MODIFY_SHIFT) or ((cursorRwm and RWM_READ_L) ushr RWM_READ_SHIFT))
|
||||
}
|
||||
val initialStatement: M68kStatement = asmInstruction.parent as M68kStatement
|
||||
val localLabelName = PsiTreeUtil.findChildOfType(initialStatement, M68kLocalLabel::class.java)?.name ?: "-->"
|
||||
backtrace.add(
|
||||
HtmlChunk.tag("tr")
|
||||
.children(DocumentationMarkup.SECTION_CONTENT_CELL.child(HtmlChunk.text(localLabelName)))
|
||||
.children(highlightRegister(asmInstruction, register).bold().wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL))
|
||||
.children(DocumentationMarkup.SECTION_CONTENT_CELL.child(HtmlChunk.text(" ; <--")))
|
||||
)
|
||||
|
||||
backtrace.addAll(analyseFlow(register, missingBits, true, initialStatement, linesLimit) {
|
||||
PsiTreeUtil.getPrevSiblingOfType(it, M68kStatement::class.java)
|
||||
})
|
||||
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
|
||||
backtrace.addAll(analyseFlow(register, traceBits, false, initialStatement, remLines) {
|
||||
PsiTreeUtil.getNextSiblingOfType(it, M68kStatement::class.java)
|
||||
})
|
||||
|
||||
val statementRows = HtmlBuilder()
|
||||
backtrace.forEach(statementRows::append)
|
||||
val builder = HtmlBuilder()
|
||||
builder.append(getDefinition(thisInfo))
|
||||
builder.append(statementRows.wrapWith(DocumentationMarkup.SECTIONS_TABLE.style("padding-left: 8pt; padding-right: 8pt")))
|
||||
return builder.toString()
|
||||
}
|
||||
|
||||
private fun analyseFlow(
|
||||
register: Register,
|
||||
rwmBits: Int,
|
||||
globalLabelBreaksOnInitialStatement: Boolean,
|
||||
startingStatement: M68kStatement,
|
||||
linesLimit: Int,
|
||||
direction: (statement: M68kStatement) -> M68kStatement?
|
||||
): List<HtmlChunk> {
|
||||
var missingBits = rwmBits
|
||||
var currStatement = startingStatement
|
||||
val statementLines = ArrayList<HtmlChunk>()
|
||||
val rn = register.regname
|
||||
var addAbbrevDots = false
|
||||
var lines = 0
|
||||
while (missingBits > 0) {
|
||||
val globalLabel = PsiTreeUtil.findChildOfType(currStatement, M68kGlobalLabel::class.java)
|
||||
if ((globalLabel != null) && (globalLabelBreaksOnInitialStatement || (currStatement !== startingStatement))) {
|
||||
statementLines.add(
|
||||
HtmlChunk.tag("tr")
|
||||
.children(DocumentationMarkup.SECTION_CONTENT_CELL.attr("colspan", "3").child(HtmlChunk.text(globalLabel.name!!).bold()))
|
||||
)
|
||||
break
|
||||
}
|
||||
currStatement = direction.invoke(currStatement) ?: break
|
||||
val currAsmInstruction = PsiTreeUtil.getChildOfType(currStatement, M68kAsmInstruction::class.java) ?: continue
|
||||
if (checkIfInstructionUsesRegister(currAsmInstruction, register)) {
|
||||
if (addAbbrevDots) {
|
||||
++lines
|
||||
statementLines.add(createAbbreviationDots())
|
||||
}
|
||||
if (++lines > linesLimit) {
|
||||
if (!addAbbrevDots) {
|
||||
statementLines.add(createAbbreviationDots())
|
||||
}
|
||||
break
|
||||
}
|
||||
addAbbrevDots = false
|
||||
val (_, currAdrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(currAsmInstruction) ?: continue
|
||||
|
||||
val localLabelName = PsiTreeUtil.findChildOfType(currStatement, M68kLocalLabel::class.java)?.name ?: " "
|
||||
val currRwms = evaluateRegisterUse(currAsmInstruction, currAdrMode, register)
|
||||
val currTotalRwm = currRwms.reduce(Int::or)
|
||||
val lineInfo = currRwms
|
||||
.map {
|
||||
val text = HtmlChunk.text(rwmToDisplayText(it, rn))
|
||||
if ((missingBits and it) > 0) text.wrapWith(HtmlChunk.font("#" + ColorUtil.toHex(JBColor.GREEN))) else text
|
||||
}
|
||||
if ((currTotalRwm and RWM_SET_L) > 0) {
|
||||
missingBits = missingBits and currTotalRwm.inv()
|
||||
}
|
||||
val lineBuilder = HtmlBuilder()
|
||||
lineBuilder.append(" ; ")
|
||||
lineBuilder.appendWithSeparators(HtmlChunk.text(", "), lineInfo)
|
||||
.wrapWith(HtmlChunk.div())
|
||||
|
||||
statementLines.add(
|
||||
HtmlChunk.tag("tr")
|
||||
.children(DocumentationMarkup.SECTION_CONTENT_CELL.child(HtmlChunk.text(localLabelName)))
|
||||
.children(highlightRegister(currAsmInstruction, register).wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL))
|
||||
.children(lineBuilder.wrapWith(DocumentationMarkup.SECTION_CONTENT_CELL))
|
||||
)
|
||||
} else {
|
||||
addAbbrevDots = true
|
||||
}
|
||||
}
|
||||
return statementLines
|
||||
}
|
||||
|
||||
private fun highlightRegister(currAsmInstruction: M68kAsmInstruction, register: Register): HtmlChunk {
|
||||
val builder = HtmlBuilder()
|
||||
val plainText = currAsmInstruction.text
|
||||
var startPos = 0
|
||||
val rn = if (register == Register.A7) listOf(register.regname, "sp") else listOf(register.regname)
|
||||
do {
|
||||
val indexPos = plainText.indexOfAny(rn, startPos, ignoreCase = true)
|
||||
if (indexPos >= 0) {
|
||||
builder.append(HtmlChunk.text(plainText.substring(startPos until indexPos)))
|
||||
startPos = indexPos + register.regname.length
|
||||
builder.append(HtmlChunk.text(plainText.substring(indexPos until startPos)).wrapWith(HtmlChunk.font("#" + ColorUtil.toHex(JBColor.ORANGE))))
|
||||
} else {
|
||||
builder.append(HtmlChunk.text(plainText.substring(startPos)))
|
||||
}
|
||||
} while (indexPos >= 0)
|
||||
return builder.toFragment().code()
|
||||
}
|
||||
|
||||
private fun rwmToDisplayText(rwm: Int, rn: String) =
|
||||
when (rwm) {
|
||||
RWM_READ_B -> "uses $rn.b"
|
||||
RWM_READ_W -> "uses $rn.w"
|
||||
RWM_READ_L -> "uses $rn.l"
|
||||
RWM_MODIFY_B -> "changes $rn.b"
|
||||
RWM_MODIFY_W -> "changes $rn.w"
|
||||
RWM_MODIFY_L -> "changes $rn.l"
|
||||
RWM_SET_B -> "sets $rn.b"
|
||||
RWM_SET_W -> "sets $rn.w"
|
||||
RWM_SET_L -> "sets $rn.l"
|
||||
else -> "uhm?"
|
||||
}
|
||||
|
||||
private fun createAbbreviationDots() = HtmlChunk.tag("tr")
|
||||
.children(DocumentationMarkup.SECTION_CONTENT_CELL.child(HtmlChunk.nbsp()))
|
||||
.children(
|
||||
DocumentationMarkup.SECTION_CONTENT_CELL.child(
|
||||
HtmlChunk.text("[...]").wrapWith(HtmlChunk.div().attr("class", "grayed"))
|
||||
)
|
||||
)
|
||||
.children(DocumentationMarkup.SECTION_CONTENT_CELL.child(HtmlChunk.nbsp()))
|
||||
|
||||
override fun getCustomDocumentationElement(editor: Editor, file: PsiFile, contextElement: PsiElement?, targetOffset: Int): PsiElement? {
|
||||
if (contextElement == null) return null
|
||||
if (contextElement is M68kDataRegister || contextElement is M68kAddressRegister) return contextElement
|
||||
val parent = contextElement.parent ?: return null
|
||||
if (parent is M68kDataRegister || parent is M68kAddressRegister) return parent
|
||||
return null
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package de.platon42.intellij.plugins.m68k.documentation
|
||||
|
||||
import com.intellij.openapi.util.text.HtmlBuilder
|
||||
import com.intellij.psi.PsiElement
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAssignment
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||
|
||||
class M68kSymbolDefinitionDocumentationProvider : 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 M68kSymbolDefinition) {
|
||||
// TODO find out how we can generate inner links for more symbol references inside the expression (DocumentationManagerUtil)
|
||||
val assignment = element.parent as M68kAssignment
|
||||
HtmlBuilder()
|
||||
.append(getComments(assignment.parent))
|
||||
.append(getDefinition(element))
|
||||
.append(getContent(assignment.expr))
|
||||
.toString()
|
||||
} else null
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package de.platon42.intellij.plugins.m68k.formatter
|
||||
|
||||
import com.intellij.formatting.Alignment
|
||||
import com.intellij.formatting.Block
|
||||
import com.intellij.formatting.Spacing
|
||||
import com.intellij.formatting.Wrap
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.formatter.common.AbstractBlock
|
||||
|
||||
class M68kAsmAssignmentBlock(
|
||||
node: ASTNode, wrap: Wrap?, alignment: Alignment?,
|
||||
private val codeStyleSettings: CodeStyleSettings
|
||||
) : AbstractBlock(node, wrap, alignment) {
|
||||
|
||||
override fun getSpacing(child1: Block?, child2: Block): Spacing? {
|
||||
return Spacing.getReadOnlySpacing()
|
||||
}
|
||||
|
||||
override fun isLeaf() = true
|
||||
|
||||
override fun buildChildren() = emptyList<Block>()
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
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) {
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
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)
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package de.platon42.intellij.plugins.m68k.formatter
|
||||
|
||||
import com.intellij.formatting.Block
|
||||
import com.intellij.formatting.Spacing
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.formatter.common.AbstractBlock
|
||||
|
||||
class M68kAsmCommentBlock(
|
||||
node: ASTNode,
|
||||
private val codeStyleSettings: CodeStyleSettings
|
||||
) : AbstractBlock(node, null, null) {
|
||||
|
||||
override fun getSpacing(child1: Block?, child2: Block): Spacing? {
|
||||
return Spacing.getReadOnlySpacing()
|
||||
}
|
||||
|
||||
override fun isLeaf() = true
|
||||
|
||||
override fun buildChildren() = emptyList<Block>()
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
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>()
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package de.platon42.intellij.plugins.m68k.formatter
|
||||
|
||||
import com.intellij.formatting.Alignment
|
||||
import com.intellij.formatting.Block
|
||||
import com.intellij.formatting.Spacing
|
||||
import com.intellij.formatting.Wrap
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.formatter.common.AbstractBlock
|
||||
|
||||
class 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>()
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package de.platon42.intellij.plugins.m68k.formatter
|
||||
|
||||
import com.intellij.formatting.Block
|
||||
import com.intellij.formatting.Spacing
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.formatter.common.AbstractBlock
|
||||
|
||||
class M68kAsmMacroDefBlock(
|
||||
node: ASTNode,
|
||||
private val codeStyleSettings: CodeStyleSettings
|
||||
) : AbstractBlock(node, null, null) {
|
||||
|
||||
override fun getSpacing(child1: Block?, child2: Block): Spacing? {
|
||||
return Spacing.getReadOnlySpacing()
|
||||
}
|
||||
|
||||
override fun isLeaf() = true
|
||||
|
||||
override fun buildChildren() = emptyList<Block>()
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
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
|
||||
"""
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package de.platon42.intellij.plugins.m68k.inspections
|
||||
|
||||
import com.intellij.codeInspection.InspectionManager
|
||||
import com.intellij.codeInspection.LocalInspectionTool
|
||||
import com.intellij.codeInspection.ProblemDescriptor
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import de.platon42.intellij.plugins.m68k.psi.*
|
||||
|
||||
abstract class AbstractBaseM68kLocalInspectionTool : LocalInspectionTool() {
|
||||
|
||||
protected open fun checkStatement(statement: M68kStatement, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? = null
|
||||
|
||||
protected open fun checkAsmInstruction(asmInstruction: M68kAsmInstruction, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? =
|
||||
null
|
||||
|
||||
protected open fun checkMacroCall(macroCall: M68kMacroCall, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? = null
|
||||
|
||||
protected open fun checkDirective(directive: M68kPreprocessorDirective, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? = null
|
||||
|
||||
protected open fun checkRegister(register: M68kRegister, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? = null
|
||||
|
||||
override fun getGroupDisplayName() = "M68k"
|
||||
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||
return object : M68kVisitor() {
|
||||
override fun visitStatement(statement: M68kStatement) = addDescriptors(checkStatement(statement, holder.manager, isOnTheFly))
|
||||
|
||||
override fun visitAsmInstruction(asmInstruction: M68kAsmInstruction) =
|
||||
addDescriptors(checkAsmInstruction(asmInstruction, holder.manager, isOnTheFly))
|
||||
|
||||
override fun visitMacroCall(macroCall: M68kMacroCall) = addDescriptors(checkMacroCall(macroCall, holder.manager, isOnTheFly))
|
||||
|
||||
override fun visitPreprocessorDirective(directive: M68kPreprocessorDirective) =
|
||||
addDescriptors(checkDirective(directive, holder.manager, isOnTheFly))
|
||||
|
||||
override fun visitRegister(register: M68kRegister) = addDescriptors(checkRegister(register, holder.manager, isOnTheFly))
|
||||
|
||||
private fun addDescriptors(descriptors: Array<ProblemDescriptor>?) {
|
||||
descriptors?.forEach(holder::registerProblem)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package de.platon42.intellij.plugins.m68k.inspections
|
||||
|
||||
import com.intellij.codeInspection.InspectionManager
|
||||
import com.intellij.codeInspection.ProblemDescriptor
|
||||
import com.intellij.codeInspection.ProblemHighlightType
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.util.SmartList
|
||||
import de.platon42.intellij.plugins.m68k.asm.*
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.findMatchingInstructions
|
||||
import de.platon42.intellij.plugins.m68k.psi.*
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.checkIfInstructionUsesRegister
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.evaluateRegisterUse
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.findExactIsaDataAndAllowedAdrModeForInstruction
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.getConcreteTestedCcFromMnemonic
|
||||
|
||||
class M68kDeadWriteInspection : AbstractBaseM68kLocalInspectionTool() {
|
||||
|
||||
companion object {
|
||||
private const val DISPLAY_NAME = "Dead writes to registers"
|
||||
|
||||
private const val DEAD_WRITE_MSG_TEMPLATE = "Register %s is overwritten later without being used"
|
||||
private const val POSSIBLY_DEAD_WRITE_MSG_TEMPLATE = "Register %s is overwritten later (only CC evaluated?)"
|
||||
}
|
||||
|
||||
override fun getDisplayName() = DISPLAY_NAME
|
||||
|
||||
override fun checkAsmInstruction(asmInstruction: M68kAsmInstruction, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? {
|
||||
val asmOp = asmInstruction.asmOp
|
||||
if (asmInstruction.addressingModeList.isEmpty()) return emptyArray()
|
||||
|
||||
val isaDataCandidates = findMatchingInstructions(asmOp.mnemonic)
|
||||
if (isaDataCandidates.isEmpty()) return emptyArray()
|
||||
val (_, adrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(asmInstruction) ?: return emptyArray()
|
||||
|
||||
val opSize = M68kIsaUtil.getOpSizeOrDefault(asmInstruction.asmOp.opSize, adrMode)
|
||||
val rwm1 = M68kIsaUtil.modifyRwmWithOpsize((adrMode.modInfo ushr RWM_OP1_SHIFT) and RWM_OP_MASK, opSize)
|
||||
val rwm2 = if (asmInstruction.addressingModeList.size > 1) M68kIsaUtil.modifyRwmWithOpsize(
|
||||
(adrMode.modInfo ushr RWM_OP2_SHIFT) and RWM_OP_MASK, opSize
|
||||
) else 0
|
||||
val regsWritten = M68kAddressModeUtil.getReadWriteModifyRegisters(asmInstruction.addressingModeList[0], rwm1).asSequence()
|
||||
.plus(M68kAddressModeUtil.getReadWriteModifyRegisters(asmInstruction.addressingModeList.getOrNull(1), rwm2))
|
||||
.plus(M68kAddressModeUtil.getOtherReadWriteModifyRegisters(adrMode.modInfo))
|
||||
.filter { (it.second and RWM_SET_L) > 0 }
|
||||
.distinct()
|
||||
.toList()
|
||||
|
||||
val hints = SmartList<ProblemDescriptor>()
|
||||
for (regPair in regsWritten) {
|
||||
val register = regPair.first
|
||||
var rwm = regPair.second
|
||||
var currStatement = asmInstruction.parent as M68kStatement
|
||||
|
||||
var ccModification = adrMode.affectedCc
|
||||
var ccOverwritten = false
|
||||
var ccTested = false
|
||||
var hasModification = false
|
||||
|
||||
while (true) {
|
||||
currStatement = PsiTreeUtil.getNextSiblingOfType(currStatement, M68kStatement::class.java) ?: break
|
||||
val globalLabel = PsiTreeUtil.findChildOfType(currStatement, M68kGlobalLabel::class.java)
|
||||
if (globalLabel != null) break
|
||||
if (PsiTreeUtil.getChildOfType(currStatement, M68kPreprocessorDirective::class.java) != null) break
|
||||
|
||||
// as we cannot evaluate macros right now, abort at macros containing the register name (only lower case for simplicity)
|
||||
val macroCall = PsiTreeUtil.getChildOfType(currStatement, M68kMacroCall::class.java)
|
||||
if (macroCall?.exprList?.any { it.textMatches(register.regname) } == true) break
|
||||
|
||||
val currAsmInstruction = PsiTreeUtil.getChildOfType(currStatement, M68kAsmInstruction::class.java) ?: continue
|
||||
val (isaData, currAdrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(currAsmInstruction) ?: continue
|
||||
if (isaData.changesControlFlow) break
|
||||
val testedCc = getConcreteTestedCcFromMnemonic(currAsmInstruction.asmOp.mnemonic, isaData, currAdrMode)
|
||||
if (((testedCc and ccModification) > 0) && !ccOverwritten) ccTested = true
|
||||
if (currAdrMode.affectedCc != 0) ccOverwritten = true
|
||||
if (checkIfInstructionUsesRegister(currAsmInstruction, register)) {
|
||||
val totalRwms = evaluateRegisterUse(currAsmInstruction, currAdrMode, register).reduce(Int::or)
|
||||
if (totalRwms and RWM_READ_L > 0) break
|
||||
if (totalRwms and RWM_MODIFY_L > 0) {
|
||||
hasModification = true
|
||||
ccOverwritten = false
|
||||
ccModification = ccModification or currAdrMode.affectedCc
|
||||
rwm = (totalRwms ushr RWM_MODIFY_SHIFT) and RWM_SET_L
|
||||
}
|
||||
if (totalRwms and RWM_SET_L >= rwm) {
|
||||
if (ccTested && hasModification) {
|
||||
break
|
||||
}
|
||||
hints.add(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction,
|
||||
asmInstruction,
|
||||
(if (ccTested) POSSIBLY_DEAD_WRITE_MSG_TEMPLATE else DEAD_WRITE_MSG_TEMPLATE).format(register.regname),
|
||||
if (ccTested) ProblemHighlightType.WEAK_WARNING else ProblemHighlightType.WARNING,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return hints.toTypedArray()
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package de.platon42.intellij.plugins.m68k.inspections
|
||||
|
||||
import com.intellij.codeInspection.InspectionManager
|
||||
import com.intellij.codeInspection.LocalQuickFix
|
||||
import com.intellij.codeInspection.ProblemDescriptor
|
||||
import com.intellij.codeInspection.ProblemHighlightType
|
||||
import de.platon42.intellij.plugins.m68k.asm.*
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.findMatchingInstructions
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.findMatchingOpMode
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.findMatchingOpModeIgnoringSize
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.findSupportedOpSizes
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressModeUtil.getAddressModeForType
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAsmInstruction
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSpecialRegisterDirectAddressingMode
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil
|
||||
|
||||
class M68kSyntaxInspection : AbstractBaseM68kLocalInspectionTool() {
|
||||
|
||||
companion object {
|
||||
private const val DISPLAY_NAME = "Assembly instruction validity"
|
||||
|
||||
private const val INSTRUCTION_NOT_FOUND_MSG = "Instruction '#ref' not supported on selected cpu"
|
||||
private const val OPERANDS_UNEXPECTED_MSG_TEMPLATE = "No operands expected for '%s'"
|
||||
private const val SECOND_OP_UNEXPECTED_MSG_TEMPLATE = "Second operand '#ref' unexpected for '%s'"
|
||||
private const val UNSUPPORTED_ADDRESSING_MODE_MSG_TEMPLATE = "Unsupported addressing mode for '%s'"
|
||||
private const val UNSUPPORTED_ADDRESSING_MODE_OP1_MSG_TEMPLATE = "Unsupported addressing mode '#ref' for first operand of '%s'"
|
||||
private const val UNSUPPORTED_ADDRESSING_MODE_OP2_MSG_TEMPLATE = "Unsupported addressing mode '#ref' for second operand of '%s'"
|
||||
private const val UNSUPPORTED_ADDRESSING_MODE_FLIP_MSG_TEMPLATE = "Unsupported addressing modes for operands in this order for '%s'"
|
||||
private const val UNSUPPORTED_SIZE_UNSIZED_MSG_TEMPLATE = "Instruction '%s' is unsized"
|
||||
private const val UNSUPPORTED_SIZE_MSG_TEMPLATE = "Operation size '#ref' unsupported for '%s"
|
||||
private const val UNSUPPORTED_SIZE_HINT_MSG_TEMPLATE = "Operation size '#ref' unsupported (should be %s)"
|
||||
}
|
||||
|
||||
override fun getDisplayName() = DISPLAY_NAME
|
||||
|
||||
override fun checkAsmInstruction(asmInstruction: M68kAsmInstruction, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? {
|
||||
val asmOp = asmInstruction.asmOp
|
||||
val mnemonicWithSize = asmOp.text
|
||||
val isaData = findMatchingInstructions(asmOp.mnemonic)
|
||||
if (isaData.isEmpty()) {
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmOp,
|
||||
INSTRUCTION_NOT_FOUND_MSG,
|
||||
null as LocalQuickFix?,
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
if (asmInstruction.addressingModeList.isNotEmpty() && isaData.none { it.hasOps }) {
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction.addressingModeList.first(),
|
||||
asmInstruction.addressingModeList.last(),
|
||||
OPERANDS_UNEXPECTED_MSG_TEMPLATE.format(mnemonicWithSize),
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
val amOp1 = asmInstruction.addressingModeList.getOrNull(0)
|
||||
val amOp2 = asmInstruction.addressingModeList.getOrNull(1)
|
||||
val op1 = getAddressModeForType(amOp1)
|
||||
val op2 = getAddressModeForType(amOp2)
|
||||
val specialReg1 = (amOp1 as? M68kSpecialRegisterDirectAddressingMode)?.specialRegister?.text
|
||||
val specialReg2 = (amOp2 as? M68kSpecialRegisterDirectAddressingMode)?.specialRegister?.text
|
||||
val specialReg = specialReg1 ?: specialReg2
|
||||
val opSize = asmOp.opSize
|
||||
val matchingModeIsaData = findMatchingOpMode(isaData, op1, op2, opSize, specialReg)
|
||||
if (matchingModeIsaData.isEmpty()) {
|
||||
val matchingModeIsaDataIgnoringSize = findMatchingOpModeIgnoringSize(isaData, op1, op2, specialReg)
|
||||
if (matchingModeIsaDataIgnoringSize.isEmpty()) {
|
||||
val matchingModeIsaDataSwapped = findMatchingOpModeIgnoringSize(isaData, op2, op1, specialReg)
|
||||
val supportedModesOp1 = isaData.flatMap { it.modes.flatMap { am -> am.op1 ?: emptySet() } }.toSet()
|
||||
val supportedModesOp2 = isaData.flatMap { it.modes.flatMap { am -> am.op2 ?: emptySet() } }.toSet()
|
||||
|
||||
if (matchingModeIsaDataSwapped.isNotEmpty()) {
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction,
|
||||
UNSUPPORTED_ADDRESSING_MODE_FLIP_MSG_TEMPLATE.format(mnemonicWithSize),
|
||||
null as LocalQuickFix?, // TODO add flipping quickfix
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if ((op2 != null)) {
|
||||
if (supportedModesOp2.isEmpty()) {
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction.addressingModeList[1],
|
||||
SECOND_OP_UNEXPECTED_MSG_TEMPLATE.format(mnemonicWithSize),
|
||||
null as LocalQuickFix?,
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
if (supportedModesOp1.contains(op1) && !supportedModesOp2.contains(op2)) {
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction.addressingModeList[1],
|
||||
UNSUPPORTED_ADDRESSING_MODE_OP2_MSG_TEMPLATE.format(mnemonicWithSize),
|
||||
null as LocalQuickFix?,
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
if (supportedModesOp2.contains(op2) && !supportedModesOp1.contains(op1)) {
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction.addressingModeList[0],
|
||||
UNSUPPORTED_ADDRESSING_MODE_OP1_MSG_TEMPLATE.format(mnemonicWithSize),
|
||||
null as LocalQuickFix?,
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction.addressingModeList.firstOrNull() ?: asmInstruction,
|
||||
asmInstruction.addressingModeList.lastOrNull() ?: asmInstruction,
|
||||
UNSUPPORTED_ADDRESSING_MODE_MSG_TEMPLATE.format(mnemonicWithSize),
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val supportedOpSizes = findSupportedOpSizes(matchingModeIsaDataIgnoringSize, op1, op2, specialReg)
|
||||
return arrayOf(
|
||||
when (supportedOpSizes) {
|
||||
OP_UNSIZED ->
|
||||
manager.createProblemDescriptor(
|
||||
asmOp.operandSize ?: asmOp,
|
||||
UNSUPPORTED_SIZE_UNSIZED_MSG_TEMPLATE.format(asmOp.mnemonic),
|
||||
null as LocalQuickFix?, // TODO remove size quickfix?
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
OP_SIZE_B, OP_SIZE_W, OP_SIZE_L, OP_SIZE_WL, OP_SIZE_SBW ->
|
||||
manager.createProblemDescriptor(
|
||||
asmOp.operandSize ?: asmOp,
|
||||
UNSUPPORTED_SIZE_HINT_MSG_TEMPLATE.format(M68kIsaUtil.findOpSizeDescription(supportedOpSizes)),
|
||||
null as LocalQuickFix?, // TODO change size to .b?
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
else ->
|
||||
manager.createProblemDescriptor(
|
||||
asmOp.operandSize ?: asmOp,
|
||||
UNSUPPORTED_SIZE_MSG_TEMPLATE.format(asmOp.mnemonic),
|
||||
null as LocalQuickFix?, // TODO remove size quickfix?
|
||||
ProblemHighlightType.ERROR,
|
||||
isOnTheFly
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
return emptyArray()
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package de.platon42.intellij.plugins.m68k.inspections
|
||||
|
||||
import com.intellij.codeInspection.InspectionManager
|
||||
import com.intellij.codeInspection.ProblemDescriptor
|
||||
import com.intellij.codeInspection.ProblemHighlightType
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.findMatchingInstructions
|
||||
import de.platon42.intellij.plugins.m68k.psi.*
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil
|
||||
import de.platon42.intellij.plugins.m68k.utils.M68kIsaUtil.findExactIsaDataAndAllowedAdrModeForInstruction
|
||||
|
||||
class M68kUnexpectedConditionalInstructionInspection : AbstractBaseM68kLocalInspectionTool() {
|
||||
|
||||
companion object {
|
||||
private const val DISPLAY_NAME = "Unaffected condition codes before conditional instruction"
|
||||
|
||||
private const val UNAFFECTED_CONDITION_CODES_MSG_TEMPLATE = "Condition codes unaffected by instruction (%s - %s)"
|
||||
}
|
||||
|
||||
override fun getDisplayName() = DISPLAY_NAME
|
||||
|
||||
override fun checkAsmInstruction(asmInstruction: M68kAsmInstruction, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor>? {
|
||||
val asmOp = asmInstruction.asmOp
|
||||
if (asmInstruction.addressingModeList.isEmpty()) return emptyArray()
|
||||
|
||||
val isaDataCandidates = findMatchingInstructions(asmOp.mnemonic)
|
||||
if (isaDataCandidates.isEmpty()) return emptyArray()
|
||||
val (isaData, adrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(asmInstruction) ?: return emptyArray()
|
||||
if ((adrMode.affectedCc > 0) || (adrMode.testedCc > 0) || isaData.changesControlFlow) return emptyArray()
|
||||
|
||||
var currStatement = asmInstruction.parent as M68kStatement
|
||||
while (true) {
|
||||
currStatement = PsiTreeUtil.getNextSiblingOfType(currStatement, M68kStatement::class.java) ?: break
|
||||
val globalLabel = PsiTreeUtil.findChildOfType(currStatement, M68kGlobalLabel::class.java)
|
||||
if (globalLabel != null) break
|
||||
if (PsiTreeUtil.findChildOfAnyType(currStatement, M68kMacroCall::class.java, M68kPreprocessorDirective::class.java) != null) break
|
||||
val currAsmInstruction = PsiTreeUtil.getChildOfType(currStatement, M68kAsmInstruction::class.java) ?: continue
|
||||
val (currIsaData, currAdrMode) = findExactIsaDataAndAllowedAdrModeForInstruction(currAsmInstruction) ?: break
|
||||
val testedCc = M68kIsaUtil.getConcreteTestedCcFromMnemonic(currAsmInstruction.asmOp.mnemonic, currIsaData, currAdrMode)
|
||||
if (testedCc == 0) break
|
||||
|
||||
return arrayOf(
|
||||
manager.createProblemDescriptor(
|
||||
asmInstruction,
|
||||
asmInstruction,
|
||||
UNAFFECTED_CONDITION_CODES_MSG_TEMPLATE.format(isaData.mnemonic, isaData.description),
|
||||
ProblemHighlightType.WARNING,
|
||||
isOnTheFly
|
||||
)
|
||||
)
|
||||
}
|
||||
return emptyArray()
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user