Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
8ea70f0dfa | ||
|
|
fa1ef0b3d5 | ||
|
|
3de9e9eba2 | ||
|
|
25450a9bf8 | ||
|
|
6e683eb6a0 | ||
|
|
f006199201 | ||
|
|
9553da6a1c | ||
|
|
5ffffb5680 | ||
|
|
fc5e1f6bf7 | ||
|
|
ad3b207362 | ||
|
|
72db8ad8b2 | ||
|
|
82feb8c43c | ||
|
|
3165d99fc2 | ||
|
|
89ecaeb613 | ||
|
|
83d2ca3304 | ||
|
|
a800b13a3e | ||
|
|
d872feeec4 | ||
|
|
884624e833 | ||
|
|
27d9d3c543 |
+13
@@ -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.
|
||||
@@ -1,8 +1,8 @@
|
||||
# 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 [](https://travis-ci.com/chrisly42/mc68000-asm-plugin) [](https://coveralls.io/github/chrisly42/mc68000-asm-plugin?branch=main)
|
||||
|
||||
_MC68000 Assembly Language Plugin_ is plugin for Jetbrains IDEs (CLion, IntelliJ, etc.).
|
||||
|
||||

|
||||

|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -19,52 +19,189 @@ awesome features and is pretty advanced. Check it out. You can install both plug
|
||||
|
||||
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 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.
|
||||
|
||||
## Features
|
||||
|
||||
- Parser / Lexer for MC68000 (yes, only 68000 right now!) assembly language files in VAsm / DevPac style
|
||||
- Inspection for validating the syntax of the 68000 ISA.
|
||||
- Syntax highlighting and Color Settings Page (you should really modify the color settings to your likings!)
|
||||
- Mnemonics code completion
|
||||
- Symbols / Labels code completion
|
||||
- References / Refactoring support for local and global labels, and symbol assignments.
|
||||
- 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
|
||||
|
||||
#### M68kSymbolDefinitionDocumentationProvider
|
||||
|
||||
Provides the assigned value of a `=`, `set` or `equ` symbol definition when hovering over a symbol.
|
||||
|
||||
#### M68kRegisterFlowDocumentationProvider
|
||||
|
||||
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).
|
||||
|
||||
#### M68kInstructionDocumentationProvider
|
||||
|
||||
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
|
||||
|
||||
- Performance is not optimal yet (no stub index).
|
||||
- No referencing of macro invocations and macro definitions.
|
||||
- `Find Usages` always shows _"Unclassified"_ though it shouldn't.
|
||||
- Macro definitions may cause syntax errors when using backslash arguments.
|
||||
- `Find Usages` always shows _"Unclassified"_ though it shouldn't (?)
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
- Unit Test coverage is not as good as it could be (ahem).
|
||||
- `opt` keyword needs special treatment and will currently show a parsing error.
|
||||
- Missing but planned features:
|
||||
- Macro definition and evaluation on invocation
|
||||
- Macro evaluation on invocation
|
||||
- Folding
|
||||
- Semantic inspections
|
||||
- More semantic inspections
|
||||
- Quick fixes
|
||||
- Formatter + Code Style Settings
|
||||
- Maybe formatter + Code Style Settings
|
||||
- Register use analysis (but this only makes sense after macro evaluation)
|
||||
- Cycle counting
|
||||
|
||||
## Recommendations
|
||||
|
||||
Currently, I would suggest using the fabulous [Browse Word at Caret Plugin](https://plugins.jetbrains.com/plugin/201-browsewordatcaret)
|
||||
to highlight the same address and data registers while editing (see new `View -> Highlight Word at Caret` menu item).
|
||||
|
||||
## Development notice
|
||||
|
||||
This plugin has been written in Kotlin 1.5.
|
||||
This plugin has been written in Kotlin 1.5 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
|
||||
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).
|
||||
|
||||
## Private TODO list
|
||||
|
||||
- code completion suggestion for unresolved global labels and symbols
|
||||
|
||||
## Changelog
|
||||
|
||||
### V0.1 (20-Jun-21)
|
||||
### 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.
|
||||
- New: Macro definition refactoring and find usages support.
|
||||
- Enhancement: Structural View also shows macro definitions.
|
||||
- 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.
|
||||
- Performance: Optimized lexer.
|
||||
|
||||
### V0.2 (27-Jul-21)
|
||||
|
||||
- Cosmetics: Added (same) icon for plugin as for file type.
|
||||
- Performance: Use Word-Index for global labels and symbols instead of iterating over the file.
|
||||
- Performance: Use Stub-Index for global labels and symbols.
|
||||
- Bugfix: No longer reports a syntax error when file lacks terminating End-Of-Line.
|
||||
- Enhancement: Registers are now offered for code completion, making editing less annoying.
|
||||
|
||||
### V0.1 (20-Jul-21)
|
||||
|
||||
- Initial public release.
|
||||
+48
-6
@@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'de.platon42'
|
||||
version = '0.1'
|
||||
version = '0.6'
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
|
||||
@@ -21,7 +21,7 @@ repositories {
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
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'
|
||||
@@ -31,7 +31,10 @@ dependencies {
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs += "-Xjvm-default=all"
|
||||
}
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
@@ -39,16 +42,55 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
intellij {
|
||||
setVersion("2021.1.3") // LATEST-EAP-SNAPSHOT
|
||||
setVersion("2021.2") // LATEST-EAP-SNAPSHOT
|
||||
setUpdateSinceUntilBuild(false)
|
||||
// setPlugins(["com.intellij.java"])
|
||||
}
|
||||
|
||||
runPluginVerifier {
|
||||
ideVersions = ["IC-203.6682.168", "IC-212.4746.92", // 2020.3 - 2021.2
|
||||
"CL-203.5981.166", "CL-203.8084.11", // 2020.3
|
||||
"CL-211.6693.114", "CL-211.7628.27", // 2021.1
|
||||
"CL-212.4746.93"] // 2021.2
|
||||
downloadDir = System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea"
|
||||
}
|
||||
|
||||
patchPluginXml {
|
||||
setChangeNotes("""
|
||||
<h4>V0.1 (20-Jun-21)</h4>
|
||||
<h4>V0.6 (09-Aug-21)</h4>
|
||||
<ul>
|
||||
<li>Initial public release.
|
||||
<li>Enhancement: 'opt' and several other directives ('printt', 'fail' etc.) no longer causes a syntax error when unquoted.
|
||||
<li>Enhancement: 'include', 'incdir' and 'incbin' and 'output' with '<pathname>' quotes no longer cause syntax error.
|
||||
<li>New: Files in 'include' directives can be referenced and renamed/refactored.
|
||||
<li>New: Code completion for local label definitions, suggesting undefined labels already referenced.
|
||||
<li>New: Added inspection suppression possibility and quickfix.
|
||||
<li>New: Added inspection for unresolved symbols, macros and labels.
|
||||
<li>Enhancement: 'END' directive stops parsing.
|
||||
</ul>
|
||||
<h4>V0.5 (06-Aug-21)</h4>
|
||||
<ul>
|
||||
<li>Bugfix: movem ISA was wrong regarding movem.w <ea>,<registerlist> (sign extends registers).
|
||||
<li>Cosmetics: Changed Register Flow Documentation wording from 'reads' to 'uses' and from 'modifies' to 'changes'.
|
||||
<li>Bugfix: Minor fix for `andi/eori/ori to ccr` which were not byte sized in ISA.
|
||||
<li>Bugfix: Added alternate condition code tests HS (=CC) and LO (=CS).
|
||||
<li>Performance: Optimized mnemonic lookup.
|
||||
<li>Enhancement: Reworked Instruction Documentation provider, now shows condition codes.
|
||||
<li>Bugfix: In ISA exg is no longer treated as setting a definitive value.
|
||||
<li>New: Added inspection to find dead writes to registers!
|
||||
<li>New: Added inspection to warn about unexpected condition code unaffecting instructions before conditional instructions.
|
||||
</ul>
|
||||
<h4>V0.4 (03-Aug-21)</h4>
|
||||
<ul>
|
||||
<li>Notice: Due to major new API use, this plugin no longer works on IDEs >=2019.3.1, but rather requires >=2020.3.
|
||||
<li>Enhancement: Added Structure View filters.
|
||||
<li>New: Added inspection to validate the correctness of a MC68000 instruction regarding operation size and address modes.
|
||||
<li>Bugfix: Added several missing assembler directives (opt, machine, etc.).
|
||||
<li>Bugfix: Uppercase hexadecimal literals were not parsed (JFlex bug?).
|
||||
<li>Bugfix: Interpretation of register lists was wrong in BNF.
|
||||
<li>New: Added Documentation Provider for symbol definitions (shows assigned declaration).
|
||||
<li>New: Added Documentation Provider for mnemonics (simple version, generated out of ISA information).
|
||||
<li>Bugfix: Macro definitions with colons and without space supported (as found in P61a source).
|
||||
<li>New: When asking for documentation on registers, a code flow analysis is done. Cool stuff!
|
||||
</ul>
|
||||
<p>Full changelog available at <a href="https://github.com/chrisly42/mc68000-asm-plugin#changelog">Github project site</a>.</p>
|
||||
""")
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 91 KiB |
File diff suppressed because it is too large
Load Diff
@@ -37,7 +37,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[]{
|
||||
create_token_set_(GLOBAL_LABEL, LABEL, LOCAL_LABEL),
|
||||
create_token_set_(ADDRESS_REGISTER, DATA_REGISTER, REGISTER, SPECIAL_REGISTER),
|
||||
create_token_set_(ABSOLUTE_ADDRESS_ADDRESSING_MODE, ADDRESSING_MODE, ADDRESS_REGISTER_DIRECT_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_ADDRESSING_MODE,
|
||||
ADDRESS_REGISTER_INDIRECT_POST_INC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_PRE_DEC_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_NEW_ADDRESSING_MODE, ADDRESS_REGISTER_INDIRECT_WITH_DISPLACEMENT_OLD_ADDRESSING_MODE,
|
||||
@@ -212,7 +211,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// ROUND_L (expr SEPARATOR)? AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R
|
||||
// ROUND_L (expr SEPARATOR)? AddressRegister SEPARATOR IndexRegister ROUND_R
|
||||
public static boolean AddressRegisterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode")) return false;
|
||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
||||
@@ -222,8 +221,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
r = r && AddressRegisterIndirectWithIndexNewAddressingMode_1(b, l + 1);
|
||||
r = r && AddressRegister(b, l + 1);
|
||||
r = r && consumeToken(b, SEPARATOR);
|
||||
r = r && DataOrAddressRegister(b, l + 1);
|
||||
r = r && AddressRegisterIndirectWithIndexNewAddressingMode_5(b, l + 1);
|
||||
r = r && IndexRegister(b, l + 1);
|
||||
r = r && consumeToken(b, ROUND_R);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
@@ -247,15 +245,8 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataWidth?
|
||||
private static boolean AddressRegisterIndirectWithIndexNewAddressingMode_5(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexNewAddressingMode_5")) return false;
|
||||
DataWidth(b, l + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// expr? ROUND_L AddressRegister SEPARATOR DataOrAddressRegister DataWidth? ROUND_R
|
||||
// expr? ROUND_L AddressRegister SEPARATOR IndexRegister ROUND_R
|
||||
public static boolean AddressRegisterIndirectWithIndexOldAddressingMode(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexOldAddressingMode")) return false;
|
||||
boolean r;
|
||||
@@ -264,8 +255,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
r = r && consumeToken(b, ROUND_L);
|
||||
r = r && AddressRegister(b, l + 1);
|
||||
r = r && consumeToken(b, SEPARATOR);
|
||||
r = r && DataOrAddressRegister(b, l + 1);
|
||||
r = r && AddressRegisterIndirectWithIndexOldAddressingMode_5(b, l + 1);
|
||||
r = r && IndexRegister(b, l + 1);
|
||||
r = r && consumeToken(b, ROUND_R);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
@@ -278,13 +268,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
// DataWidth?
|
||||
private static boolean AddressRegisterIndirectWithIndexOldAddressingMode_5(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "AddressRegisterIndirectWithIndexOldAddressingMode_5")) return false;
|
||||
DataWidth(b, l + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// OPSIZE_W|OPSIZE_L
|
||||
public static boolean AddressSize(PsiBuilder b, int l) {
|
||||
@@ -365,12 +348,12 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
// MNEMONIC OperandSize?
|
||||
public static boolean AsmOp(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "AsmOp")) return false;
|
||||
if (!nextTokenIs(b, MNEMONIC)) return false;
|
||||
if (!nextTokenIs(b, "<mnemonic>", MNEMONIC)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
Marker m = enter_section_(b, l, _NONE_, ASM_OP, "<mnemonic>");
|
||||
r = consumeToken(b, MNEMONIC);
|
||||
r = r && AsmOp_1(b, l + 1);
|
||||
exit_section_(b, m, ASM_OP, r);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -548,11 +531,30 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// DataOrAddressRegister DataWidth?
|
||||
public static boolean IndexRegister(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "IndexRegister")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, INDEX_REGISTER, "<index register>");
|
||||
r = DataOrAddressRegister(b, l + 1);
|
||||
r = r && IndexRegister_1(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataWidth?
|
||||
private static boolean IndexRegister_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "IndexRegister_1")) return false;
|
||||
DataWidth(b, l + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// AsmInstruction | MacroCall
|
||||
static boolean Instruction(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "Instruction")) return false;
|
||||
if (!nextTokenIs(b, "", MACRO_INVOKATION, MNEMONIC)) return false;
|
||||
if (!nextTokenIs(b, "", MACRO_INVOCATION, MNEMONIC)) return false;
|
||||
boolean r;
|
||||
r = AsmInstruction(b, l + 1);
|
||||
if (!r) r = MacroCall(b, l + 1);
|
||||
@@ -567,14 +569,12 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
|
||||
/* ********************************************************** */
|
||||
// LocalLabel | GlobalLabel
|
||||
public static boolean Label(PsiBuilder b, int l) {
|
||||
static boolean Label(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "Label")) return false;
|
||||
if (!nextTokenIs(b, "<label>", GLOBAL_LABEL_DEF, LOCAL_LABEL_DEF)) return false;
|
||||
if (!nextTokenIs(b, "", GLOBAL_LABEL_DEF, LOCAL_LABEL_DEF)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _COLLAPSE_, LABEL, "<label>");
|
||||
r = LocalLabel(b, l + 1);
|
||||
if (!r) r = GlobalLabel(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -641,13 +641,13 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// MACRO_INVOKATION PlainOperands?
|
||||
// MACRO_INVOCATION PlainOperands?
|
||||
public static boolean MacroCall(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroCall")) return false;
|
||||
if (!nextTokenIs(b, MACRO_INVOKATION)) return false;
|
||||
if (!nextTokenIs(b, MACRO_INVOCATION)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, MACRO_INVOKATION);
|
||||
r = consumeToken(b, MACRO_INVOCATION);
|
||||
r = r && MacroCall_1(b, l + 1);
|
||||
exit_section_(b, m, MACRO_CALL, r);
|
||||
return r;
|
||||
@@ -660,6 +660,97 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// ((MacroNameDefinition COLON? MACRO_TAG)|(MACRO_TAG MacroNameDefinition)) MacroPlainLine* MACRO_END_TAG
|
||||
public static boolean MacroDefinition(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroDefinition")) return false;
|
||||
if (!nextTokenIs(b, "<macro definition>", MACRO_NAME, MACRO_TAG)) return false;
|
||||
boolean r, p;
|
||||
Marker m = enter_section_(b, l, _NONE_, MACRO_DEFINITION, "<macro definition>");
|
||||
r = MacroDefinition_0(b, l + 1);
|
||||
p = r; // pin = 1
|
||||
r = r && report_error_(b, MacroDefinition_1(b, l + 1));
|
||||
r = p && consumeToken(b, MACRO_END_TAG) && r;
|
||||
exit_section_(b, l, m, r, p, null);
|
||||
return r || p;
|
||||
}
|
||||
|
||||
// (MacroNameDefinition COLON? MACRO_TAG)|(MACRO_TAG MacroNameDefinition)
|
||||
private static boolean MacroDefinition_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroDefinition_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = MacroDefinition_0_0(b, l + 1);
|
||||
if (!r) r = MacroDefinition_0_1(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// MacroNameDefinition COLON? MACRO_TAG
|
||||
private static boolean MacroDefinition_0_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroDefinition_0_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = MacroNameDefinition(b, l + 1);
|
||||
r = r && MacroDefinition_0_0_1(b, l + 1);
|
||||
r = r && consumeToken(b, MACRO_TAG);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// COLON?
|
||||
private static boolean MacroDefinition_0_0_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroDefinition_0_0_1")) return false;
|
||||
consumeToken(b, COLON);
|
||||
return true;
|
||||
}
|
||||
|
||||
// MACRO_TAG MacroNameDefinition
|
||||
private static boolean MacroDefinition_0_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroDefinition_0_1")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, MACRO_TAG);
|
||||
r = r && MacroNameDefinition(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// MacroPlainLine*
|
||||
private static boolean MacroDefinition_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroDefinition_1")) return false;
|
||||
while (true) {
|
||||
int c = current_position_(b);
|
||||
if (!MacroPlainLine(b, l + 1)) break;
|
||||
if (!empty_element_parsed_guard_(b, "MacroDefinition_1", c)) break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// MACRO_NAME
|
||||
public static boolean MacroNameDefinition(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroNameDefinition")) return false;
|
||||
if (!nextTokenIs(b, MACRO_NAME)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, MACRO_NAME);
|
||||
exit_section_(b, m, MACRO_NAME_DEFINITION, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// MACRO_LINE
|
||||
public static boolean MacroPlainLine(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "MacroPlainLine")) return false;
|
||||
if (!nextTokenIs(b, MACRO_LINE)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, MACRO_LINE);
|
||||
exit_section_(b, m, MACRO_PLAIN_LINE, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// OPSIZE_BS|OPSIZE_W|OPSIZE_L
|
||||
public static boolean OperandSize(PsiBuilder b, int l) {
|
||||
@@ -674,19 +765,27 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// STRINGLIT (SEPARATOR STRINGLIT)*
|
||||
// (expr|AddressingMode) (SEPARATOR (expr|AddressingMode))*
|
||||
static boolean PlainOperands(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PlainOperands")) return false;
|
||||
if (!nextTokenIs(b, STRINGLIT)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeToken(b, STRINGLIT);
|
||||
r = PlainOperands_0(b, l + 1);
|
||||
r = r && PlainOperands_1(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// (SEPARATOR STRINGLIT)*
|
||||
// expr|AddressingMode
|
||||
private static boolean PlainOperands_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PlainOperands_0")) return false;
|
||||
boolean r;
|
||||
r = expr(b, l + 1, -1);
|
||||
if (!r) r = AddressingMode(b, l + 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
// (SEPARATOR (expr|AddressingMode))*
|
||||
private static boolean PlainOperands_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PlainOperands_1")) return false;
|
||||
while (true) {
|
||||
@@ -697,25 +796,34 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
// SEPARATOR STRINGLIT
|
||||
// SEPARATOR (expr|AddressingMode)
|
||||
private static boolean PlainOperands_1_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PlainOperands_1_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeTokens(b, 0, SEPARATOR, STRINGLIT);
|
||||
r = consumeToken(b, SEPARATOR);
|
||||
r = r && PlainOperands_1_0_1(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// expr|AddressingMode
|
||||
private static boolean PlainOperands_1_0_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PlainOperands_1_0_1")) return false;
|
||||
boolean r;
|
||||
r = expr(b, l + 1, -1);
|
||||
if (!r) r = AddressingMode(b, l + 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE)
|
||||
// PreprocessorOperands?
|
||||
// Label? PreprocessorKeyword PreprocessorOperands?
|
||||
public static boolean PreprocessorDirective(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PreprocessorDirective")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, PREPROCESSOR_DIRECTIVE, "<preprocessor directive>");
|
||||
r = PreprocessorDirective_0(b, l + 1);
|
||||
r = r && PreprocessorDirective_1(b, l + 1);
|
||||
r = r && PreprocessorKeyword(b, l + 1);
|
||||
r = r && PreprocessorDirective_2(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
@@ -728,15 +836,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
// DATA_DIRECTIVE | OTHER_DIRECTIVE
|
||||
private static boolean PreprocessorDirective_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PreprocessorDirective_1")) return false;
|
||||
boolean r;
|
||||
r = consumeToken(b, DATA_DIRECTIVE);
|
||||
if (!r) r = consumeToken(b, OTHER_DIRECTIVE);
|
||||
return r;
|
||||
}
|
||||
|
||||
// PreprocessorOperands?
|
||||
private static boolean PreprocessorDirective_2(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PreprocessorDirective_2")) return false;
|
||||
@@ -744,6 +843,19 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// DATA_DIRECTIVE | OTHER_DIRECTIVE
|
||||
public static boolean PreprocessorKeyword(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "PreprocessorKeyword")) return false;
|
||||
if (!nextTokenIs(b, "<preprocessor keyword>", DATA_DIRECTIVE, OTHER_DIRECTIVE)) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, PREPROCESSOR_KEYWORD, "<preprocessor keyword>");
|
||||
r = consumeToken(b, DATA_DIRECTIVE);
|
||||
if (!r) r = consumeToken(b, OTHER_DIRECTIVE);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// expr
|
||||
static boolean PreprocessorOperand(PsiBuilder b, int l) {
|
||||
@@ -832,7 +944,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// ROUND_L (expr SEPARATOR)? PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R
|
||||
// ROUND_L (expr SEPARATOR)? PC SEPARATOR IndexRegister ROUND_R
|
||||
public static boolean ProgramCounterIndirectWithIndexNewAddressingMode(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode")) return false;
|
||||
if (!nextTokenIsFast(b, ROUND_L)) return false;
|
||||
@@ -841,8 +953,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
r = consumeTokenFast(b, ROUND_L);
|
||||
r = r && ProgramCounterIndirectWithIndexNewAddressingMode_1(b, l + 1);
|
||||
r = r && consumeTokens(b, 0, PC, SEPARATOR);
|
||||
r = r && DataOrAddressRegister(b, l + 1);
|
||||
r = r && ProgramCounterIndirectWithIndexNewAddressingMode_5(b, l + 1);
|
||||
r = r && IndexRegister(b, l + 1);
|
||||
r = r && consumeToken(b, ROUND_R);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
@@ -866,23 +977,15 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataWidth?
|
||||
private static boolean ProgramCounterIndirectWithIndexNewAddressingMode_5(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexNewAddressingMode_5")) return false;
|
||||
DataWidth(b, l + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// expr? ROUND_L PC SEPARATOR DataOrAddressRegister DataWidth? ROUND_R
|
||||
// expr? ROUND_L PC SEPARATOR IndexRegister ROUND_R
|
||||
public static boolean ProgramCounterIndirectWithIndexOldAddressingMode(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexOldAddressingMode")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, PROGRAM_COUNTER_INDIRECT_WITH_INDEX_OLD_ADDRESSING_MODE, "<AddressingMode>");
|
||||
r = ProgramCounterIndirectWithIndexOldAddressingMode_0(b, l + 1);
|
||||
r = r && consumeTokens(b, 0, ROUND_L, PC, SEPARATOR);
|
||||
r = r && DataOrAddressRegister(b, l + 1);
|
||||
r = r && ProgramCounterIndirectWithIndexOldAddressingMode_5(b, l + 1);
|
||||
r = r && IndexRegister(b, l + 1);
|
||||
r = r && consumeToken(b, ROUND_R);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
@@ -895,13 +998,6 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
// DataWidth?
|
||||
private static boolean ProgramCounterIndirectWithIndexOldAddressingMode_5(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "ProgramCounterIndirectWithIndexOldAddressingMode_5")) return false;
|
||||
DataWidth(b, l + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// CURRENT_PC_SYMBOL
|
||||
public static boolean ProgramCounterReference(PsiBuilder b, int l) {
|
||||
@@ -928,27 +1024,27 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// (DataOrAddressRegister|RegisterRange) ((OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange))*
|
||||
// (RegisterRange|DataOrAddressRegister) (OP_AR_DIV (RegisterRange|DataOrAddressRegister))*
|
||||
public static boolean RegisterListAddressingMode(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterListAddressingMode")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, REGISTER_LIST_ADDRESSING_MODE, "<AddressingMode>");
|
||||
Marker m = enter_section_(b, l, _NONE_, REGISTER_LIST_ADDRESSING_MODE, "<register list>");
|
||||
r = RegisterListAddressingMode_0(b, l + 1);
|
||||
r = r && RegisterListAddressingMode_1(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataOrAddressRegister|RegisterRange
|
||||
// RegisterRange|DataOrAddressRegister
|
||||
private static boolean RegisterListAddressingMode_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterListAddressingMode_0")) return false;
|
||||
boolean r;
|
||||
r = DataOrAddressRegister(b, l + 1);
|
||||
if (!r) r = RegisterRange(b, l + 1);
|
||||
r = RegisterRange(b, l + 1);
|
||||
if (!r) r = DataOrAddressRegister(b, l + 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
// ((OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange))*
|
||||
// (OP_AR_DIV (RegisterRange|DataOrAddressRegister))*
|
||||
private static boolean RegisterListAddressingMode_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterListAddressingMode_1")) return false;
|
||||
while (true) {
|
||||
@@ -959,44 +1055,71 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
// (OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange)
|
||||
// OP_AR_DIV (RegisterRange|DataOrAddressRegister)
|
||||
private static boolean RegisterListAddressingMode_1_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterListAddressingMode_1_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = RegisterListAddressingMode_1_0_0(b, l + 1);
|
||||
r = consumeTokenFast(b, OP_AR_DIV);
|
||||
r = r && RegisterListAddressingMode_1_0_1(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// OP_AR_DIV|OP_MINUS
|
||||
private static boolean RegisterListAddressingMode_1_0_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterListAddressingMode_1_0_0")) return false;
|
||||
boolean r;
|
||||
r = consumeTokenFast(b, OP_AR_DIV);
|
||||
if (!r) r = consumeTokenFast(b, OP_MINUS);
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataOrAddressRegister|RegisterRange
|
||||
// RegisterRange|DataOrAddressRegister
|
||||
private static boolean RegisterListAddressingMode_1_0_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterListAddressingMode_1_0_1")) return false;
|
||||
boolean r;
|
||||
r = DataOrAddressRegister(b, l + 1);
|
||||
if (!r) r = RegisterRange(b, l + 1);
|
||||
r = RegisterRange(b, l + 1);
|
||||
if (!r) r = DataOrAddressRegister(b, l + 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// DataOrAddressRegister OP_MINUS DataOrAddressRegister
|
||||
static boolean RegisterRange(PsiBuilder b, int l) {
|
||||
// (DataRegister OP_MINUS DataRegister) | (AddressRegister OP_MINUS AddressRegister) | (DataRegister OP_MINUS AddressRegister)
|
||||
public static boolean RegisterRange(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterRange")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NONE_, REGISTER_RANGE, "<register range>");
|
||||
r = RegisterRange_0(b, l + 1);
|
||||
if (!r) r = RegisterRange_1(b, l + 1);
|
||||
if (!r) r = RegisterRange_2(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataRegister OP_MINUS DataRegister
|
||||
private static boolean RegisterRange_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterRange_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = DataOrAddressRegister(b, l + 1);
|
||||
r = DataRegister(b, l + 1);
|
||||
r = r && consumeToken(b, OP_MINUS);
|
||||
r = r && DataOrAddressRegister(b, l + 1);
|
||||
r = r && DataRegister(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// AddressRegister OP_MINUS AddressRegister
|
||||
private static boolean RegisterRange_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterRange_1")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = AddressRegister(b, l + 1);
|
||||
r = r && consumeToken(b, OP_MINUS);
|
||||
r = r && AddressRegister(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// DataRegister OP_MINUS AddressRegister
|
||||
private static boolean RegisterRange_2(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "RegisterRange_2")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = DataRegister(b, l + 1);
|
||||
r = r && consumeToken(b, OP_MINUS);
|
||||
r = r && AddressRegister(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
@@ -1051,14 +1174,14 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// !<<eof>> statement EOL
|
||||
// !<<eof>> (MacroDefinition | statement) (<<eof>>|EOL)
|
||||
static boolean line(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "line")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = line_0(b, l + 1);
|
||||
r = r && statement(b, l + 1);
|
||||
r = r && consumeToken(b, EOL);
|
||||
r = r && line_1(b, l + 1);
|
||||
r = r && line_2(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
@@ -1073,6 +1196,28 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
// MacroDefinition | statement
|
||||
private static boolean line_1(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "line_1")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = MacroDefinition(b, l + 1);
|
||||
if (!r) r = statement(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// <<eof>>|EOL
|
||||
private static boolean line_2(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "line_2")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = eof(b, l + 1);
|
||||
if (!r) r = consumeToken(b, EOL);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// Assignment
|
||||
// | PreprocessorDirective
|
||||
@@ -1094,11 +1239,21 @@ public class M68kParser implements PsiParser, LightPsiParser {
|
||||
if (!recursion_guard_(b, l, "statement_recover")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b, l, _NOT_);
|
||||
r = !consumeToken(b, EOL);
|
||||
r = !statement_recover_0(b, l + 1);
|
||||
exit_section_(b, l, m, r, false, null);
|
||||
return r;
|
||||
}
|
||||
|
||||
// (EOL)
|
||||
private static boolean statement_recover_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "statement_recover_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = consumeTokenFast(b, EOL);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// Expression root: expr
|
||||
// Operator priority table:
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
+3
-6
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
+3
-6
@@ -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,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kAddressSize extends PsiElement {
|
||||
public interface M68kAddressSize extends M68kPsiElement {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kAddressingMode extends PsiElement {
|
||||
public interface M68kAddressingMode extends M68kPsiElement {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface M68kAsmInstruction extends PsiElement {
|
||||
public interface M68kAsmInstruction extends M68kPsiElement {
|
||||
|
||||
@NotNull
|
||||
List<M68kAddressingMode> getAddressingModeList();
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kAsmOp extends PsiElement {
|
||||
public interface M68kAsmOp extends M68kPsiElement {
|
||||
|
||||
@Nullable
|
||||
M68kOperandSize getOperandSize();
|
||||
|
||||
@NotNull
|
||||
String getMnemonic();
|
||||
|
||||
int getOpSize();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kAssignment extends PsiElement {
|
||||
public interface M68kAssignment extends M68kPsiElement {
|
||||
|
||||
@NotNull
|
||||
M68kSymbolDefinition getSymbolDefinition();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kDataWidth extends PsiElement {
|
||||
public interface M68kDataWidth extends M68kPsiElement {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kExpr extends PsiElement {
|
||||
public interface M68kExpr extends M68kPsiElement {
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.StubBasedPsiElement;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kGlobalLabel extends M68kLabel, M68kNamedElement {
|
||||
public interface M68kGlobalLabel extends M68kNamedElement, StubBasedPsiElement<M68kGlobalLabelStub> {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@@ -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.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kIndexRegister extends M68kPsiElement {
|
||||
|
||||
@Nullable
|
||||
M68kDataWidth getDataWidth();
|
||||
|
||||
@NotNull
|
||||
M68kRegister getRegister();
|
||||
|
||||
boolean isLongWidth();
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kLocalLabel extends M68kLabel, M68kNamedElement {
|
||||
public interface M68kLocalLabel extends M68kNamedElement {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kMacroCall extends PsiElement {
|
||||
import java.util.List;
|
||||
|
||||
public interface M68kMacroCall extends M68kPsiElement {
|
||||
|
||||
@NotNull
|
||||
List<M68kAddressingMode> getAddressingModeList();
|
||||
|
||||
@NotNull
|
||||
List<M68kExpr> getExprList();
|
||||
|
||||
@NotNull
|
||||
String getMacroName();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.StubBasedPsiElement;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kMacroDefinitionStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface M68kMacroDefinition extends M68kNamedElement, StubBasedPsiElement<M68kMacroDefinitionStub> {
|
||||
|
||||
@NotNull
|
||||
M68kMacroNameDefinition getMacroNameDefinition();
|
||||
|
||||
@NotNull
|
||||
List<M68kMacroPlainLine> getMacroPlainLineList();
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@NotNull
|
||||
PsiElement setName(@NotNull String name);
|
||||
|
||||
@NotNull
|
||||
PsiElement getNameIdentifier();
|
||||
|
||||
}
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kLabel extends PsiElement {
|
||||
public interface M68kMacroNameDefinition extends M68kPsiElement {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
public interface M68kMacroPlainLine extends M68kPsiElement {
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
public interface M68kOperandSize extends M68kPsiElement {
|
||||
|
||||
public interface M68kOperandSize extends PsiElement {
|
||||
int getSize();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface M68kPreprocessorDirective extends PsiElement {
|
||||
public interface M68kPreprocessorDirective extends M68kPsiElement {
|
||||
|
||||
@Nullable
|
||||
M68kLabel getLabel();
|
||||
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 {
|
||||
|
||||
}
|
||||
+2
-2
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
+3
-6
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
+3
-6
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kProgramCounterReference extends PsiElement {
|
||||
public interface M68kProgramCounterReference extends M68kPsiElement {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface M68kRegister extends PsiElement {
|
||||
public interface M68kRegister extends M68kPsiElement {
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kStatement extends PsiElement {
|
||||
public interface M68kStatement extends M68kPsiElement {
|
||||
|
||||
@Nullable
|
||||
M68kAsmInstruction getAsmInstruction();
|
||||
@@ -13,7 +12,10 @@ public interface M68kStatement extends PsiElement {
|
||||
M68kAssignment getAssignment();
|
||||
|
||||
@Nullable
|
||||
M68kLabel getLabel();
|
||||
M68kGlobalLabel getGlobalLabel();
|
||||
|
||||
@Nullable
|
||||
M68kLocalLabel getLocalLabel();
|
||||
|
||||
@Nullable
|
||||
M68kMacroCall getMacroCall();
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.StubBasedPsiElement;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface M68kSymbolDefinition extends M68kNamedElement {
|
||||
public interface M68kSymbolDefinition extends M68kNamedElement, StubBasedPsiElement<M68kSymbolDefinitionStub> {
|
||||
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface M68kSymbolReference extends PsiElement {
|
||||
public interface M68kSymbolReference extends M68kPsiElement {
|
||||
|
||||
@NotNull
|
||||
String getSymbolName();
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import de.platon42.intellij.plugins.m68k.psi.impl.*;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kStubElementTypeFactory;
|
||||
|
||||
public interface M68kTypes {
|
||||
|
||||
@@ -45,15 +46,19 @@ public interface M68kTypes {
|
||||
IElementType DATA_REGISTER_DIRECT_ADDRESSING_MODE = new M68kElementType("DATA_REGISTER_DIRECT_ADDRESSING_MODE");
|
||||
IElementType DATA_WIDTH = new M68kElementType("DATA_WIDTH");
|
||||
IElementType EXPR = new M68kElementType("EXPR");
|
||||
IElementType GLOBAL_LABEL = new M68kElementType("GLOBAL_LABEL");
|
||||
IElementType GLOBAL_LABEL = M68kStubElementTypeFactory.stubFactory("GLOBAL_LABEL");
|
||||
IElementType IMMEDIATE_DATA = new M68kElementType("IMMEDIATE_DATA");
|
||||
IElementType LABEL = new M68kElementType("LABEL");
|
||||
IElementType INDEX_REGISTER = new M68kElementType("INDEX_REGISTER");
|
||||
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 OPERAND_SIZE = new M68kElementType("OPERAND_SIZE");
|
||||
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_NEW_ADDRESSING_MODE = new M68kElementType("PROGRAM_COUNTER_INDIRECT_WITH_INDEX_NEW_ADDRESSING_MODE");
|
||||
@@ -62,10 +67,11 @@ public interface M68kTypes {
|
||||
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");
|
||||
IElementType SYMBOL_DEFINITION = new M68kElementType("SYMBOL_DEFINITION");
|
||||
IElementType SYMBOL_DEFINITION = M68kStubElementTypeFactory.stubFactory("SYMBOL_DEFINITION");
|
||||
IElementType SYMBOL_REFERENCE = new M68kElementType("SYMBOL_REFERENCE");
|
||||
IElementType UNARY_COMPL_EXPR = new M68kElementType("UNARY_COMPL_EXPR");
|
||||
IElementType UNARY_MINUS_EXPR = new M68kElementType("UNARY_MINUS_EXPR");
|
||||
@@ -86,7 +92,11 @@ public interface M68kTypes {
|
||||
IElementType HASH = new M68kTokenType("HASH");
|
||||
IElementType HEXADECIMAL = new M68kTokenType("HEXADECIMAL");
|
||||
IElementType LOCAL_LABEL_DEF = new M68kTokenType("LOCAL_LABEL_DEF");
|
||||
IElementType MACRO_INVOKATION = new M68kTokenType("MACRO_INVOKATION");
|
||||
IElementType MACRO_END_TAG = new M68kTokenType("MACRO_END_TAG");
|
||||
IElementType MACRO_INVOCATION = new M68kTokenType("MACRO_INVOCATION");
|
||||
IElementType MACRO_LINE = new M68kTokenType("MACRO_LINE");
|
||||
IElementType MACRO_NAME = new M68kTokenType("MACRO_NAME");
|
||||
IElementType MACRO_TAG = new M68kTokenType("MACRO_TAG");
|
||||
IElementType MNEMONIC = new M68kTokenType("MNEMONIC");
|
||||
IElementType OCTAL = new M68kTokenType("OCTAL");
|
||||
IElementType OPSIZE_BS = new M68kTokenType("OPSIZE_BS");
|
||||
@@ -204,18 +214,28 @@ 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 == LITERAL_EXPR) {
|
||||
return new M68kLiteralExprImpl(node);
|
||||
} else if (type == LOCAL_LABEL) {
|
||||
return new M68kLocalLabelImpl(node);
|
||||
} else if (type == MACRO_CALL) {
|
||||
return new M68kMacroCallImpl(node);
|
||||
} else if (type == MACRO_DEFINITION) {
|
||||
return new M68kMacroDefinitionImpl(node);
|
||||
} else if (type == MACRO_NAME_DEFINITION) {
|
||||
return new M68kMacroNameDefinitionImpl(node);
|
||||
} else if (type == MACRO_PLAIN_LINE) {
|
||||
return new M68kMacroPlainLineImpl(node);
|
||||
} else if (type == OPERAND_SIZE) {
|
||||
return new M68kOperandSizeImpl(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) {
|
||||
@@ -230,6 +250,8 @@ public interface M68kTypes {
|
||||
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) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// This is a generated file. Not intended for manual editing.
|
||||
package de.platon42.intellij.plugins.m68k.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -21,30 +20,43 @@ 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 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) {
|
||||
@@ -80,27 +92,37 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
}
|
||||
|
||||
public void visitGlobalLabel(@NotNull M68kGlobalLabel o) {
|
||||
visitLabel(o);
|
||||
// visitNamedElement(o);
|
||||
visitNamedElement(o);
|
||||
}
|
||||
|
||||
public void visitImmediateData(@NotNull M68kImmediateData o) {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitLabel(@NotNull M68kLabel o) {
|
||||
public void visitIndexRegister(@NotNull M68kIndexRegister o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitLocalLabel(@NotNull M68kLocalLabel o) {
|
||||
visitLabel(o);
|
||||
// visitNamedElement(o);
|
||||
visitNamedElement(o);
|
||||
}
|
||||
|
||||
public void visitMacroCall(@NotNull M68kMacroCall o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitMacroDefinition(@NotNull M68kMacroDefinition o) {
|
||||
visitNamedElement(o);
|
||||
}
|
||||
|
||||
public void visitMacroNameDefinition(@NotNull M68kMacroNameDefinition o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitMacroPlainLine(@NotNull M68kMacroPlainLine o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitOperandSize(@NotNull M68kOperandSize o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
@@ -109,20 +131,30 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
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 visitProgramCounterIndirectWithIndexNewAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexNewAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithDisplacement(o);
|
||||
// visitWithIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterIndirectWithIndexOldAddressingMode(@NotNull M68kProgramCounterIndirectWithIndexOldAddressingMode o) {
|
||||
visitAddressingMode(o);
|
||||
// visitWithDisplacement(o);
|
||||
// visitWithIndexRegister(o);
|
||||
}
|
||||
|
||||
public void visitProgramCounterReference(@NotNull M68kProgramCounterReference o) {
|
||||
@@ -137,6 +169,10 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitAddressingMode(o);
|
||||
}
|
||||
|
||||
public void visitRegisterRange(@NotNull M68kRegisterRange o) {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitSpecialRegister(@NotNull M68kSpecialRegister o) {
|
||||
visitRegister(o);
|
||||
}
|
||||
@@ -266,7 +302,7 @@ public class M68kVisitor extends PsiElementVisitor {
|
||||
visitPsiElement(o);
|
||||
}
|
||||
|
||||
public void visitPsiElement(@NotNull PsiElement o) {
|
||||
public void visitPsiElement(@NotNull M68kPsiElement o) {
|
||||
visitElement(o);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ 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.M68kAbsoluteAddressAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressSize;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
@@ -30,13 +31,13 @@ public class M68kAbsoluteAddressAddressingModeImpl extends M68kAddressingModeImp
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kAddressSize getAddressSize() {
|
||||
return findChildByClass(M68kAddressSize.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kAddressSize.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
return findNotNullChildByClass(M68kExpr.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ 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.M68kAddressRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterDirectAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kAddressRegisterDirectAddressingModeImpl extends M68kAddressingM
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ 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.M68kAddressRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kAddressRegisterIndirectAddressingModeImpl extends M68kAddressin
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ 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.M68kAddressRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectPostIncAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kAddressRegisterIndirectPostIncAddressingModeImpl extends M68kAd
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ 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.M68kAddressRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectPreDecAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kAddressRegisterIndirectPreDecAddressingModeImpl extends M68kAdd
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-3
@@ -3,6 +3,7 @@ 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.M68kAddressRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectWithDisplacementNewAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
@@ -29,13 +30,13 @@ public class M68kAddressRegisterIndirectWithDisplacementNewAddressingModeImpl ex
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
return findNotNullChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-3
@@ -3,6 +3,7 @@ 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.M68kAddressRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAddressRegisterIndirectWithDisplacementOldAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
@@ -29,13 +30,13 @@ public class M68kAddressRegisterIndirectWithDisplacementOldAddressingModeImpl ex
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
return findNotNullChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-11
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -27,25 +28,19 @@ public class M68kAddressRegisterIndirectWithIndexNewAddressingModeImpl extends M
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return findChildByClass(M68kDataWidth.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return findNotNullChildByClass(M68kRegister.class);
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-11
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -27,25 +28,19 @@ public class M68kAddressRegisterIndirectWithIndexOldAddressingModeImpl extends M
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAddressRegister getAddressRegister() {
|
||||
return findNotNullChildByClass(M68kAddressRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return findChildByClass(M68kDataWidth.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAddressRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return findNotNullChildByClass(M68kRegister.class);
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class M68kAsmInstructionImpl extends ASTWrapperPsiElement implements M68k
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kAsmOp getAsmOp() {
|
||||
return findNotNullChildByClass(M68kAsmOp.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kAsmOp.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ 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.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;
|
||||
@@ -29,7 +31,18 @@ public class M68kAsmOpImpl extends ASTWrapperPsiElement implements M68kAsmOp {
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kOperandSize getOperandSize() {
|
||||
return findChildByClass(M68kOperandSize.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kOperandSize.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getMnemonic() {
|
||||
return M68kPsiImplUtil.getMnemonic(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpSize() {
|
||||
return M68kPsiImplUtil.getOpSize(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.M68kAssignment;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition;
|
||||
@@ -29,13 +30,13 @@ public class M68kAssignmentImpl extends ASTWrapperPsiElement implements M68kAssi
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kSymbolDefinition getSymbolDefinition() {
|
||||
return findNotNullChildByClass(M68kSymbolDefinition.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kSymbolDefinition.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
return findNotNullChildByClass(M68kExpr.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ 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.M68kDataRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kDataRegisterDirectAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kDataRegisterDirectAddressingModeImpl extends M68kAddressingMode
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kDataRegister getDataRegister() {
|
||||
return findNotNullChildByClass(M68kDataRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kDataRegister.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabel;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabelMixin;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kPsiImplUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kGlobalLabelStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,6 +19,10 @@ public class M68kGlobalLabelImpl extends M68kGlobalLabelMixin implements M68kGlo
|
||||
super(node);
|
||||
}
|
||||
|
||||
public M68kGlobalLabelImpl(@NotNull M68kGlobalLabelStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitGlobalLabel(this);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kImmediateData;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kImmediateDataImpl extends M68kAddressingModeImpl implements M68
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
return findNotNullChildByClass(M68kExpr.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongWidth() {
|
||||
return M68kPsiImplUtil.isLongWidth(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +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 de.platon42.intellij.plugins.m68k.psi.M68kMacroCall;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class M68kMacroCallImpl extends ASTWrapperPsiElement implements M68kMacroCall {
|
||||
import java.util.List;
|
||||
|
||||
public class M68kMacroCallImpl extends M68kMacroCallMixin implements M68kMacroCall {
|
||||
|
||||
public M68kMacroCallImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
@@ -24,4 +25,22 @@ public class M68kMacroCallImpl extends ASTWrapperPsiElement implements M68kMacro
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<M68kAddressingMode> getAddressingModeList() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kAddressingMode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<M68kExpr> getExprList() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getMacroName() {
|
||||
return M68kPsiImplUtil.getMacroName(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kMacroDefinitionStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class M68kMacroDefinitionImpl extends M68kMacroDefinitionMixin implements M68kMacroDefinition {
|
||||
|
||||
public M68kMacroDefinitionImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public M68kMacroDefinitionImpl(@NotNull M68kMacroDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitMacroDefinition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kMacroNameDefinition getMacroNameDefinition() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kMacroNameDefinition.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<M68kMacroPlainLine> getMacroPlainLineList() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kMacroPlainLine.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getName() {
|
||||
return M68kPsiImplUtil.getName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement setName(@NotNull String name) {
|
||||
return M68kPsiImplUtil.setName(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement getNameIdentifier() {
|
||||
return M68kPsiImplUtil.getNameIdentifier(this);
|
||||
}
|
||||
|
||||
}
|
||||
+27
@@ -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.M68kMacroNameDefinition;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class M68kMacroNameDefinitionImpl extends ASTWrapperPsiElement implements M68kMacroNameDefinition {
|
||||
|
||||
public M68kMacroNameDefinitionImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitMacroNameDefinition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof M68kVisitor) accept((M68kVisitor) visitor);
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -4,18 +4,18 @@ 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.M68kLabel;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kMacroPlainLine;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class M68kLabelImpl extends ASTWrapperPsiElement implements M68kLabel {
|
||||
public class M68kMacroPlainLineImpl extends ASTWrapperPsiElement implements M68kMacroPlainLine {
|
||||
|
||||
public M68kLabelImpl(@NotNull ASTNode node) {
|
||||
public M68kMacroPlainLineImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitLabel(this);
|
||||
visitor.visitMacroPlainLine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kParenExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -29,7 +30,7 @@ public class M68kParenExprImpl extends M68kExprImpl implements M68kParenExpr {
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
-8
@@ -1,20 +1,16 @@
|
||||
// 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.M68kLabel;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kPreprocessorDirective;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
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);
|
||||
@@ -32,8 +28,20 @@ public class M68kPreprocessorDirectiveImpl extends ASTWrapperPsiElement implemen
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLabel getLabel() {
|
||||
return findChildByClass(M68kLabel.class);
|
||||
public M68kGlobalLabel getGlobalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kGlobalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLocalLabel getLocalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kLocalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kPreprocessorKeyword getPreprocessorKeyword() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kPreprocessorKeyword.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+27
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithDisplacementNewAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -27,8 +28,8 @@ public class M68kProgramCounterIndirectWithDisplacementNewAddressingModeImpl ext
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kExpr getExpr() {
|
||||
return findNotNullChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kExpr.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kProgramCounterIndirectWithDisplacementOldAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,8 +29,8 @@ public class M68kProgramCounterIndirectWithDisplacementOldAddressingModeImpl ext
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-11
@@ -3,7 +3,11 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
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;
|
||||
|
||||
@@ -24,22 +28,16 @@ public class M68kProgramCounterIndirectWithIndexNewAddressingModeImpl extends M6
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return findChildByClass(M68kDataWidth.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return findNotNullChildByClass(M68kRegister.class);
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-11
@@ -3,7 +3,11 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
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;
|
||||
|
||||
@@ -24,22 +28,16 @@ public class M68kProgramCounterIndirectWithIndexOldAddressingModeImpl extends M6
|
||||
else super.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kDataWidth getDataWidth() {
|
||||
return findChildByClass(M68kDataWidth.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kRegister getRegister() {
|
||||
return findNotNullChildByClass(M68kRegister.class);
|
||||
public M68kIndexRegister getIndexRegister() {
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kIndexRegister.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
public M68kExpr getDisplacement() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kProgramCounterReference;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kRefExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference;
|
||||
@@ -30,13 +31,13 @@ public class M68kRefExprImpl extends M68kExprImpl implements M68kRefExpr {
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kProgramCounterReference getProgramCounterReference() {
|
||||
return findChildByClass(M68kProgramCounterReference.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kProgramCounterReference.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kSymbolReference getSymbolReference() {
|
||||
return findChildByClass(M68kSymbolReference.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kSymbolReference.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-3
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -3,6 +3,7 @@ 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.M68kSpecialRegister;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSpecialRegisterDirectAddressingMode;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -28,7 +29,7 @@ public class M68kSpecialRegisterDirectAddressingModeImpl extends M68kAddressingM
|
||||
@Override
|
||||
@NotNull
|
||||
public M68kSpecialRegister getSpecialRegister() {
|
||||
return findNotNullChildByClass(M68kSpecialRegister.class);
|
||||
return notNullChild(PsiTreeUtil.getChildOfType(this, M68kSpecialRegister.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -27,31 +28,37 @@ public class M68kStatementImpl extends ASTWrapperPsiElement implements M68kState
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kAsmInstruction getAsmInstruction() {
|
||||
return findChildByClass(M68kAsmInstruction.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kAsmInstruction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kAssignment getAssignment() {
|
||||
return findChildByClass(M68kAssignment.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kAssignment.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLabel getLabel() {
|
||||
return findChildByClass(M68kLabel.class);
|
||||
public M68kGlobalLabel getGlobalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kGlobalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kLocalLabel getLocalLabel() {
|
||||
return PsiTreeUtil.getChildOfType(this, M68kLocalLabel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kMacroCall getMacroCall() {
|
||||
return findChildByClass(M68kMacroCall.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kMacroCall.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kPreprocessorDirective getPreprocessorDirective() {
|
||||
return findChildByClass(M68kPreprocessorDirective.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kPreprocessorDirective.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kPsiImplUtil;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinitionMixin;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kSymbolDefinitionStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,6 +19,10 @@ public class M68kSymbolDefinitionImpl extends M68kSymbolDefinitionMixin implemen
|
||||
super(node);
|
||||
}
|
||||
|
||||
public M68kSymbolDefinitionImpl(@NotNull M68kSymbolDefinitionStub stub, @NotNull IStubElementType<?, ?> nodeType) {
|
||||
super(stub, nodeType);
|
||||
}
|
||||
|
||||
public void accept(@NotNull M68kVisitor visitor) {
|
||||
visitor.visitSymbolDefinition(this);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryComplExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -29,7 +30,7 @@ public class M68kUnaryComplExprImpl extends M68kExprImpl implements M68kUnaryCom
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryMinusExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -29,7 +30,7 @@ public class M68kUnaryMinusExprImpl extends M68kExprImpl implements M68kUnaryMin
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryNotExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -29,7 +30,7 @@ public class M68kUnaryNotExprImpl extends M68kExprImpl implements M68kUnaryNotEx
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.M68kExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kUnaryPlusExpr;
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
|
||||
@@ -29,7 +30,7 @@ public class M68kUnaryPlusExprImpl extends M68kExprImpl implements M68kUnaryPlus
|
||||
@Override
|
||||
@Nullable
|
||||
public M68kExpr getExpr() {
|
||||
return findChildByClass(M68kExpr.class);
|
||||
return PsiTreeUtil.getChildOfType(this, M68kExpr.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +1,21 @@
|
||||
package de.platon42.intellij.plugins.m68k
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.stubs.DefaultStubBuilder
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.psi.tree.IStubFileElementType
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import com.intellij.psi.tree.ILightStubFileElementType
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kFile
|
||||
import de.platon42.intellij.plugins.m68k.stubs.M68kFileStub
|
||||
|
||||
class M68kFileElementType private constructor() : IStubFileElementType<M68kFileStub>("MC68000_FILE", MC68000Language.INSTANCE) {
|
||||
class M68kFileElementType private constructor() : ILightStubFileElementType<PsiFileStub<M68kFile>>("MC68000_FILE", MC68000Language.INSTANCE) {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = M68kFileElementType()
|
||||
|
||||
const val STUB_VERSION = 1
|
||||
const val STUB_VERSION = 6
|
||||
const val STUB_EXTERNAL_ID_PREFIX = "MC68000."
|
||||
const val EXTERNAL_ID = STUB_EXTERNAL_ID_PREFIX + "FILE"
|
||||
}
|
||||
|
||||
override fun getStubVersion() = STUB_VERSION
|
||||
|
||||
override fun getBuilder() =
|
||||
object : DefaultStubBuilder() {
|
||||
override fun createStubForFile(file: PsiFile): StubElement<*> {
|
||||
return if (file is M68kFile) M68kFileStub(file) else super.createStubForFile(file)
|
||||
}
|
||||
}
|
||||
override fun getExternalId() = EXTERNAL_ID
|
||||
}
|
||||
@@ -7,5 +7,8 @@ object M68kIcons {
|
||||
val FILE = IconLoader.getIcon("/icons/FileType_m68k.svg", javaClass)
|
||||
val LOCAL_LABEL = AllIcons.Nodes.AbstractMethod
|
||||
val GLOBAL_LABEL = AllIcons.Nodes.Method
|
||||
val SYMBOL_DEF = AllIcons.Nodes.Constant
|
||||
val SYMBOL_DEF = AllIcons.Nodes.ClassInitializer
|
||||
val MACRO_DEF = AllIcons.Nodes.MultipleTypeDefinitions
|
||||
val REGISTER = AllIcons.Nodes.DataTables // AllIcons.Nodes.Record only available starting from 2020.1
|
||||
val MNEMONIC = AllIcons.Nodes.C_protected
|
||||
}
|
||||
@@ -22,27 +22,43 @@ object AssemblerDirectives {
|
||||
"rsset", "clrfo", "clrso", "setfo", "setso"
|
||||
)
|
||||
|
||||
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",
|
||||
//"iif" // not supported
|
||||
"else", "endif", "endc",
|
||||
|
||||
"rept", "endr",
|
||||
|
||||
"macro", "exitm", "mexit", "endm",
|
||||
|
||||
"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()]!!
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+9
-2
@@ -4,13 +4,20 @@ 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 M68kMnemonicCompletionContributor : CompletionContributor() {
|
||||
|
||||
companion object {
|
||||
val MNEMONICS = M68kIsa.mnemonics
|
||||
.map { PrioritizedLookupElement.withPriority(LookupElementBuilder.create(it).withIcon(M68kIcons.MNEMONIC), 10.0) }
|
||||
}
|
||||
|
||||
init {
|
||||
extend(CompletionType.BASIC, PlatformPatterns.psiElement(M68kTypes.MACRO_INVOKATION), object : CompletionProvider<CompletionParameters>() {
|
||||
extend(CompletionType.BASIC, PlatformPatterns.psiElement(M68kTypes.MACRO_INVOCATION), object : CompletionProvider<CompletionParameters>() {
|
||||
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, resultSet: CompletionResultSet) {
|
||||
resultSet.addAllElements(M68kIsa.mnemonics.map(LookupElementBuilder::create))
|
||||
resultSet.addAllElements(MNEMONICS)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
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))
|
||||
if (allowedAdrMode.op1 != null) cellsPerRow.add(collectAddressModes(allowedAdrMode.op2))
|
||||
|
||||
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>?): HtmlChunk {
|
||||
if (addressModes == null) return HtmlChunk.text("")
|
||||
val modes = HtmlBuilder()
|
||||
addressModes.sortedBy(AddressMode::ordinal)
|
||||
.forEach { modes.append(HtmlChunk.text(it.syntax).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
|
||||
}
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
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 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 : AbstractDocumentationProvider() {
|
||||
|
||||
override fun generateDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
||||
return createDoc(element as M68kRegister, 100) // TODO make this configurable
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun generateHoverDoc(element: PsiElement, originalElement: PsiElement?): String? {
|
||||
if (element is M68kDataRegister || element is M68kAddressRegister) {
|
||||
return createDoc(element as M68kRegister, 4) // TODO make this configurable
|
||||
}
|
||||
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 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, linesLimit) {
|
||||
PsiTreeUtil.getNextSiblingOfType(it, M68kStatement::class.java)
|
||||
})
|
||||
|
||||
val statementRows = HtmlBuilder()
|
||||
backtrace.forEach(statementRows::append)
|
||||
val builder = HtmlBuilder()
|
||||
builder.append(HtmlChunk.text(thisInfo).wrapWith(DocumentationMarkup.DEFINITION_ELEMENT))
|
||||
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
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
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.StringUtil
|
||||
import com.intellij.psi.PsiElement
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kAssignment
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolDefinition
|
||||
|
||||
class M68kSymbolDefinitionDocumentationProvider : AbstractDocumentationProvider() {
|
||||
|
||||
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 value = (element.getParent() as M68kAssignment).expr.text
|
||||
DocumentationMarkup.DEFINITION_START + StringUtil.escapeXmlEntities(element.name!!) + DocumentationMarkup.DEFINITION_END +
|
||||
DocumentationMarkup.CONTENT_START + StringUtil.escapeXmlEntities(value) + DocumentationMarkup.CONTENT_END
|
||||
} else null
|
||||
}
|
||||
}
|
||||
+44
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+104
@@ -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()
|
||||
}
|
||||
}
|
||||
+83
@@ -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()
|
||||
}
|
||||
}
|
||||
+54
@@ -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()
|
||||
}
|
||||
}
|
||||
+48
@@ -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 ?: return
|
||||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,12 @@ import com.intellij.psi.TokenType
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import de.platon42.intellij.plugins.m68k.asm.AssemblerDirectives
|
||||
import de.platon42.intellij.plugins.m68k.asm.M68kIsa.mnemonics
|
||||
import de.platon42.intellij.plugins.m68k.psi.M68kTypes
|
||||
|
||||
object LexerUtil {
|
||||
|
||||
private val ASSIGNMENT_SEPARATORS = charArrayOf(' ', '\t', '=', ':')
|
||||
private val TOKEN_SEPARATORS = charArrayOf(' ', '\t', ':')
|
||||
|
||||
@JvmStatic
|
||||
fun isAsmMnemonic(text: CharSequence) = mnemonics.contains(text.toString().lowercase())
|
||||
@@ -17,17 +19,28 @@ object LexerUtil {
|
||||
&& text.dropLast(1).endsWith('.')
|
||||
&& mnemonics.contains(text.dropLast(2).toString().lowercase())
|
||||
|
||||
@JvmStatic
|
||||
fun isEndDirective(text: CharSequence) = text.contentEquals("end", ignoreCase = true)
|
||||
|
||||
@JvmStatic
|
||||
fun isDataDirective(text: CharSequence) = AssemblerDirectives.dataDirectives.contains(text.toString().lowercase())
|
||||
|
||||
@JvmStatic
|
||||
fun isOtherDirective(text: CharSequence) = AssemblerDirectives.otherDirective.contains(text.toString().lowercase())
|
||||
fun isPlainDirective(text: CharSequence) = AssemblerDirectives.plainDirectives.contains(text.toString().lowercase())
|
||||
|
||||
@JvmStatic
|
||||
fun isOtherDirective(text: CharSequence) = AssemblerDirectives.otherDirectives.contains(text.toString().lowercase())
|
||||
|
||||
@JvmStatic
|
||||
fun pushbackAssignment(text: CharSequence): Int {
|
||||
return text.length - text.indexOfAny(ASSIGNMENT_SEPARATORS)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun pushbackAfterFirstToken(text: CharSequence): Int {
|
||||
return text.length - text.indexOfAny(TOKEN_SEPARATORS)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun pushbackLabelColons(text: CharSequence): Int {
|
||||
return text.count { it == ':' }
|
||||
@@ -38,7 +51,37 @@ object LexerUtil {
|
||||
if (!lexer.eatOneWhitespace && lexer.lexerPrefs.spaceIntroducesComment) {
|
||||
lexer.yybegin(_M68kLexer.WAITEOL)
|
||||
}
|
||||
lexer.eatOneWhitespace = false;
|
||||
lexer.eatOneWhitespace = false
|
||||
return TokenType.WHITE_SPACE
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun handleMacroMode(lexer: _M68kLexer): IElementType {
|
||||
if (lexer.lexerPrefs.macroParametersUnparsed) {
|
||||
lexer.yybegin(_M68kLexer.PLAINPARAMS)
|
||||
} else {
|
||||
lexer.yybegin(_M68kLexer.ASMOPS)
|
||||
}
|
||||
lexer.eatOneWhitespace = true
|
||||
return M68kTypes.MACRO_INVOCATION
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun handleMacroLineEol(lexer: _M68kLexer): IElementType {
|
||||
if (++lexer.macroLines > lexer.lexerPrefs.maxLinesPerMacro) {
|
||||
lexer.yybegin(_M68kLexer.YYINITIAL)
|
||||
return TokenType.BAD_CHARACTER
|
||||
}
|
||||
lexer.yybegin(_M68kLexer.MACROLINE)
|
||||
return TokenType.WHITE_SPACE
|
||||
}
|
||||
|
||||
fun unquoteString(string: String) = string.run {
|
||||
when {
|
||||
startsWith('"') -> removeSurrounding("\"")
|
||||
startsWith('\'') -> removeSurrounding("'")
|
||||
startsWith('<') -> removeSurrounding("<", ">")
|
||||
else -> this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package de.platon42.intellij.plugins.m68k.lexer
|
||||
|
||||
data class M68kLexerPrefs(
|
||||
var spaceIntroducesComment: Boolean = false,
|
||||
var maxLinesPerMacro: Int = 50,
|
||||
var maxLinesPerMacro: Int = 250,
|
||||
var macroSectionUnparsed: Boolean = false,
|
||||
var macroParametersUnparsed: Boolean = true
|
||||
)
|
||||
@@ -13,6 +13,9 @@ import static de.platon42.intellij.plugins.m68k.lexer.LexerUtil.*;
|
||||
%{
|
||||
private M68kLexerPrefs lexerPrefs;
|
||||
boolean eatOneWhitespace = false;
|
||||
int macroLines = 0;
|
||||
int exprState = 0;
|
||||
int exprOpState = 0;
|
||||
|
||||
public M68kLexerPrefs getLexerPrefs()
|
||||
{
|
||||
@@ -23,6 +26,12 @@ import static de.platon42.intellij.plugins.m68k.lexer.LexerUtil.*;
|
||||
this((java.io.Reader)null);
|
||||
this.lexerPrefs = lexerPrefs;
|
||||
}
|
||||
|
||||
private void startExpr(int newExprState, int newExprOpState) {
|
||||
exprState = newExprState;
|
||||
exprOpState = newExprOpState;
|
||||
yybegin(exprState);
|
||||
}
|
||||
%}
|
||||
|
||||
%public
|
||||
@@ -38,10 +47,12 @@ WHITE_SPACE=\p{Blank}+
|
||||
AREG=(a[0-6])
|
||||
DREG=(d[0-7])
|
||||
ASSIGNMENT=(([:letter:]|_)(([:letter:]|[:digit:])|_)*:?((\p{Blank}+equ\p{Blank}+)|(\p{Blank}+set\p{Blank}+)|\p{Blank}*=\p{Blank}*))
|
||||
LOCAL_LABEL=(\.([:letter:]|_)(([:letter:]|[:digit:])|_)*:?)|(([:letter:]|_)(([:letter:]|[:digit:])|_)*\$:?)
|
||||
LOCAL_LABEL_WC=(\.([:letter:]|_)(([:letter:]|[:digit:])|_)*:)|(([:letter:]|_)(([:letter:]|[:digit:])|_)*\$:)
|
||||
GLOBAL_LABEL=(([:letter:]|_)(([:letter:]|[:digit:])|_)*:?:?)
|
||||
GLOBAL_LABEL_WC=(([:letter:]|_)(([:letter:]|[:digit:])|_)*::?)
|
||||
LOCAL_LABEL=(\.([:letter:]|_)([:letter:]|[:digit:]|_)*:?)|(([:letter:]|_)([:letter:]|[:digit:]|_)*\$:?)
|
||||
LOCAL_LABEL_WC=(\.([:letter:]|_)([:letter:]|[:digit:]|_)*:)|(([:letter:]|_)([:letter:]|[:digit:]|_)*\$:)
|
||||
GLOBAL_LABEL=(([:letter:]|_)([:letter:]|[:digit:]|_)*:?:?)
|
||||
GLOBAL_LABEL_WC=(([:letter:]|_)([:letter:]|[:digit:]|_)*::?)
|
||||
MACRO_DEF_LEFT=(([:letter:]|_)(([:letter:]|[:digit:]|_))*)(\p{Blank}+|:\p{Blank}*)macro\p{Blank}*
|
||||
MACRO_END_TAG=\p{Blank}+endm\p{Blank}*[^;\r\n]*
|
||||
//MNEMONIC=(([:letter:])+)
|
||||
SYMBOL=(([:letter:]|_|\.)(([:letter:]|[:digit:]|[_\$]))*)
|
||||
BONUSSYMBOL=(([:letter:]|_|\.)(([:letter:]|[:digit:]|[_\$\.\\]))*)
|
||||
@@ -51,7 +62,7 @@ OPSIZE_BS=(\.[bs])
|
||||
OPSIZE_W=(\.w)
|
||||
OPSIZE_L=(\.l)
|
||||
BINARY=(%[01]+)
|
||||
HEXADECIMAL=(\$[0-9a-f]+)
|
||||
HEXADECIMAL=(\$[0-9a-fA-F]+)
|
||||
OCTAL=(@[0-7]+)
|
||||
DECIMAL=([0-9]+)
|
||||
STRINGLIT=(`([^`\\\r\n]|\\.)*`|'([^'\\\r\n]|\\.)*'|\"([^\"\\\r\n]|\\.)*\")
|
||||
@@ -59,227 +70,162 @@ PLAINPARAM=(`([^`\\\r\n]|\\.)*`|'([^'\\\r\n]|\\.)*'|\"([^\"\\\r\n]|\\.)*\")|<([^
|
||||
COMMENT=([;].*+)
|
||||
HASH_COMMENT=([#;*].*+)
|
||||
SKIP_TO_EOL=[^\r\n]+
|
||||
PLAIN_MACRO_LINE=[^;\r\n]+
|
||||
|
||||
%state NOSOL,INSTRPART,ASMINSTR,ASMOPS,ASMOPS_OP,ASSIGNMENT,EXPR,EXPR_OP,MACROCALL,WAITEOL
|
||||
%state NOSOL,INSTRPART,ASMINSTR,ASMOPS,ASMOPS_OP,ASSIGNMENT,EXPR,EXPR_OP,PLAINPARAMS,WAITEOL,MACRODEF,MACROLINE,MACROTERMINATION,MACROWAITEOL
|
||||
|
||||
%%
|
||||
<YYINITIAL> {
|
||||
{WHITE_SPACE} { yybegin(NOSOL); eatOneWhitespace = false; return WHITE_SPACE; }
|
||||
{EOL} { return WHITE_SPACE; }
|
||||
{ASSIGNMENT} { yybegin(ASSIGNMENT); eatOneWhitespace = true; yypushback(pushbackAssignment(yytext())); return SYMBOLDEF; }
|
||||
{LOCAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
|
||||
{GLOBAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
|
||||
|
||||
{HASH_COMMENT} { return COMMENT; }
|
||||
}
|
||||
|
||||
<NOSOL> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
<YYINITIAL, NOSOL>
|
||||
{
|
||||
{EOL} { yybegin(YYINITIAL); return WHITE_SPACE; }
|
||||
{LOCAL_LABEL_WC} { yybegin(INSTRPART); yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
|
||||
{GLOBAL_LABEL_WC} { yybegin(INSTRPART); yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
|
||||
{DIRECTIVE_KEYWORD} {
|
||||
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
||||
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
|
||||
if(isDataDirective(yytext())) { yybegin(EXPR); return DATA_DIRECTIVE; }
|
||||
if(isOtherDirective(yytext())) { yybegin(EXPR); return OTHER_DIRECTIVE; }
|
||||
yybegin(MACROCALL); eatOneWhitespace = true; return MACRO_INVOKATION;
|
||||
}
|
||||
// {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { yybegin(INSTRPART); return SYMBOL; } }
|
||||
{MACRONAME} { yybegin(MACROCALL); eatOneWhitespace = true; return MACRO_INVOKATION; }
|
||||
{HASH_COMMENT} { yybegin(YYINITIAL); return COMMENT; }
|
||||
}
|
||||
|
||||
<INSTRPART> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
<INSTRPART,ASMINSTR,PLAINPARAMS,ASSIGNMENT,EXPR,EXPR_OP,ASMOPS,ASMOPS_OP>
|
||||
{
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
|
||||
":" { return COLON; }
|
||||
|
||||
{DIRECTIVE_KEYWORD} {
|
||||
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
||||
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
|
||||
if(isDataDirective(yytext())) { yybegin(EXPR); return DATA_DIRECTIVE; }
|
||||
if(isOtherDirective(yytext())) { yybegin(EXPR); return OTHER_DIRECTIVE; }
|
||||
yybegin(MACROCALL); eatOneWhitespace = true; return MACRO_INVOKATION;
|
||||
}
|
||||
// {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { return SYMBOL; } }
|
||||
{MACRONAME} { yybegin(MACROCALL); eatOneWhitespace = true; return MACRO_INVOKATION; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<NOSOL, INSTRPART, ASSIGNMENT>
|
||||
{
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
}
|
||||
|
||||
<PLAINPARAMS, EXPR, EXPR_OP, ASMOPS, ASMOPS_OP> {
|
||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||
}
|
||||
|
||||
<YYINITIAL> {
|
||||
{WHITE_SPACE} { yybegin(NOSOL); eatOneWhitespace = false; return WHITE_SPACE; }
|
||||
{ASSIGNMENT} { yybegin(ASSIGNMENT); eatOneWhitespace = true; yypushback(pushbackAssignment(yytext())); return SYMBOLDEF; }
|
||||
{MACRO_DEF_LEFT} { yybegin(MACRODEF); yypushback(pushbackAfterFirstToken(yytext())); return MACRO_NAME; }
|
||||
{LOCAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
|
||||
{GLOBAL_LABEL} { yybegin(INSTRPART); eatOneWhitespace = false; yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
|
||||
"." { yybegin(INSTRPART); eatOneWhitespace = false; return LOCAL_LABEL_DEF; }
|
||||
}
|
||||
|
||||
<NOSOL> {
|
||||
"macro" { yybegin(MACRODEF); return MACRO_TAG; }
|
||||
{LOCAL_LABEL_WC} { yybegin(INSTRPART); yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
|
||||
{GLOBAL_LABEL_WC} { yybegin(INSTRPART); yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
|
||||
// {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { yybegin(INSTRPART); return SYMBOL; } }
|
||||
}
|
||||
|
||||
<NOSOL, INSTRPART>
|
||||
{
|
||||
{DIRECTIVE_KEYWORD} {
|
||||
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
||||
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
|
||||
if(isEndDirective(yytext())) { yybegin(YYINITIAL); zzAtEOF = true; return null; }
|
||||
if(isDataDirective(yytext())) { startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; }
|
||||
if(isPlainDirective(yytext())) { yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; }
|
||||
if(isOtherDirective(yytext())) { startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; }
|
||||
return handleMacroMode(this);
|
||||
}
|
||||
{MACRONAME} { return handleMacroMode(this); }
|
||||
}
|
||||
|
||||
<INSTRPART,MACRODEF> {
|
||||
":" { return COLON; }
|
||||
// {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { return SYMBOL; } }
|
||||
}
|
||||
|
||||
<ASMINSTR> {
|
||||
{WHITE_SPACE} { yybegin(ASMOPS); return WHITE_SPACE; }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
{WHITE_SPACE} { startExpr(ASMOPS, ASMOPS_OP); return WHITE_SPACE; }
|
||||
|
||||
{OPSIZE_BS} { return OPSIZE_BS; }
|
||||
{OPSIZE_W} { return OPSIZE_W; }
|
||||
{OPSIZE_L} { return OPSIZE_L; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<MACROCALL> {
|
||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
|
||||
<PLAINPARAMS> {
|
||||
"," { return SEPARATOR; }
|
||||
|
||||
{PLAINPARAM} { return STRINGLIT; }
|
||||
}
|
||||
|
||||
<ASSIGNMENT> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
|
||||
"equ"|"set" { yybegin(EXPR); return EQU; }
|
||||
"equ"|"set" { startExpr(EXPR, EXPR_OP); return EQU; }
|
||||
|
||||
":" { return COLON; }
|
||||
"=" { yybegin(EXPR); return OP_ASSIGN; }
|
||||
"=" { startExpr(EXPR, EXPR_OP); return OP_ASSIGN; }
|
||||
}
|
||||
|
||||
<EXPR, ASMOPS> {
|
||||
{BINARY} { yybegin(exprOpState); return BINARY; }
|
||||
{HEXADECIMAL} { yybegin(exprOpState); return HEXADECIMAL; }
|
||||
{OCTAL} { yybegin(exprOpState); return OCTAL; }
|
||||
{DECIMAL} { yybegin(exprOpState); return DECIMAL; }
|
||||
{STRINGLIT} { yybegin(exprOpState); return STRINGLIT; }
|
||||
|
||||
"^" { return OP_BITWISE_XOR; }
|
||||
"," { return SEPARATOR; }
|
||||
"(" { return ROUND_L; }
|
||||
")" { yybegin(exprOpState); return ROUND_R; }
|
||||
"!" { return OP_UNARY_NOT; }
|
||||
"~" { return OP_UNARY_COMPL; }
|
||||
"+" { return OP_PLUS; }
|
||||
"-" { return OP_MINUS; }
|
||||
"*" { yybegin(exprOpState); return CURRENT_PC_SYMBOL; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<EXPR> {
|
||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
|
||||
{BINARY} { yybegin(EXPR_OP); return BINARY; }
|
||||
{HEXADECIMAL} { yybegin(EXPR_OP); return HEXADECIMAL; }
|
||||
{OCTAL} { yybegin(EXPR_OP); return OCTAL; }
|
||||
{DECIMAL} { yybegin(EXPR_OP); return DECIMAL; }
|
||||
{STRINGLIT} { yybegin(EXPR_OP); return STRINGLIT; }
|
||||
|
||||
"^" { return OP_BITWISE_XOR; }
|
||||
"," { return SEPARATOR; }
|
||||
"(" { return ROUND_L; }
|
||||
")" { yybegin(EXPR_OP); return ROUND_R; }
|
||||
"!" { return OP_UNARY_NOT; }
|
||||
"~" { return OP_UNARY_COMPL; }
|
||||
"+" { return OP_PLUS; }
|
||||
"-" { return OP_MINUS; }
|
||||
"*" { yybegin(EXPR_OP); return CURRENT_PC_SYMBOL; }
|
||||
|
||||
{BONUSSYMBOL} { yybegin(EXPR_OP); return SYMBOL; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
{BONUSSYMBOL} { yybegin(exprOpState); return SYMBOL; }
|
||||
}
|
||||
|
||||
<EXPR_OP> {
|
||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
<EXPR_OP, ASMOPS_OP> {
|
||||
"<<" { yybegin(exprState); return OP_AR_SHIFT_L; }
|
||||
">>" { yybegin(exprState); return OP_AR_SHIFT_R; }
|
||||
"&&" { yybegin(exprState); return OP_LOGICAL_AND; }
|
||||
"||" { yybegin(exprState); return OP_LOGICAL_OR; }
|
||||
"=="|"=" { yybegin(exprState); return OP_CMP_EQ; }
|
||||
"<>"|"!=" { yybegin(exprState); return OP_CMP_NOT_EQ; }
|
||||
">=" { yybegin(exprState); return OP_CMP_GT_EQ; }
|
||||
"<=" { yybegin(exprState); return OP_CMP_LT_EQ; }
|
||||
"<" { yybegin(exprState); return OP_CMP_LT; }
|
||||
">" { yybegin(exprState); return OP_CMP_GT; }
|
||||
"&" { yybegin(exprState); return OP_BITWISE_AND; }
|
||||
"|"|"!" { yybegin(exprState); return OP_BITWISE_OR; }
|
||||
"^" { yybegin(exprState); return OP_BITWISE_XOR; }
|
||||
|
||||
"<<" { yybegin(EXPR); return OP_AR_SHIFT_L; }
|
||||
">>" { yybegin(EXPR); return OP_AR_SHIFT_R; }
|
||||
"&&" { yybegin(EXPR); return OP_LOGICAL_AND; }
|
||||
"||" { yybegin(EXPR); return OP_LOGICAL_OR; }
|
||||
"=="|"=" { yybegin(EXPR); return OP_CMP_EQ; }
|
||||
"<>"|"!=" { yybegin(EXPR); return OP_CMP_NOT_EQ; }
|
||||
">=" { yybegin(EXPR); return OP_CMP_GT_EQ; }
|
||||
"<=" { yybegin(EXPR); return OP_CMP_LT_EQ; }
|
||||
"<" { yybegin(EXPR); return OP_CMP_LT; }
|
||||
">" { yybegin(EXPR); return OP_CMP_GT; }
|
||||
"&" { yybegin(EXPR); return OP_BITWISE_AND; }
|
||||
"|"|"!" { yybegin(EXPR); return OP_BITWISE_OR; }
|
||||
"^" { yybegin(EXPR); return OP_BITWISE_XOR; }
|
||||
// ":" { return COLON; }
|
||||
// ";" { return SEMICOLON; }
|
||||
// "[" { return SQUARE_L; }
|
||||
// "]" { return SQUARE_R; }
|
||||
"," { yybegin(EXPR); return SEPARATOR; }
|
||||
"(" { yybegin(EXPR); return ROUND_L; }
|
||||
"," { yybegin(exprState); return SEPARATOR; }
|
||||
"(" { yybegin(exprState); return ROUND_L; }
|
||||
")" { return ROUND_R; }
|
||||
// "." { return DOT; }
|
||||
// "$" { return DOLLAR; }
|
||||
"~" { yybegin(EXPR); return OP_UNARY_COMPL; }
|
||||
"+" { yybegin(EXPR); return OP_PLUS; }
|
||||
"-" { yybegin(EXPR); return OP_MINUS; }
|
||||
"*" { yybegin(EXPR); return OP_AR_MUL; }
|
||||
"%"|"//" { yybegin(EXPR); return OP_AR_MOD; }
|
||||
"/" { yybegin(EXPR); return OP_AR_DIV; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
"~" { yybegin(exprState); return OP_UNARY_COMPL; }
|
||||
"+" { yybegin(exprState); return OP_PLUS; }
|
||||
"-" { yybegin(exprState); return OP_MINUS; }
|
||||
"*" { yybegin(exprState); return OP_AR_MUL; }
|
||||
"%"|"//" { yybegin(exprState); return OP_AR_MOD; }
|
||||
"/" { yybegin(exprState); return OP_AR_DIV; }
|
||||
}
|
||||
|
||||
<ASMOPS> {
|
||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
|
||||
{BINARY} { yybegin(ASMOPS_OP); return BINARY; }
|
||||
{HEXADECIMAL} { yybegin(ASMOPS_OP); return HEXADECIMAL; }
|
||||
{OCTAL} { yybegin(ASMOPS_OP); return OCTAL; }
|
||||
{DECIMAL} { yybegin(ASMOPS_OP); return DECIMAL; }
|
||||
{STRINGLIT} { yybegin(ASMOPS_OP); return STRINGLIT; }
|
||||
|
||||
{AREG} { yybegin(ASMOPS_OP); return AREG; }
|
||||
{DREG} { yybegin(ASMOPS_OP); return DREG; }
|
||||
"sp"|"a7" { yybegin(ASMOPS_OP); return REG_SP; }
|
||||
"pc" { yybegin(ASMOPS_OP); return PC; }
|
||||
"ccr" { yybegin(ASMOPS_OP); return REG_CCR; }
|
||||
"sr" { yybegin(ASMOPS_OP); return REG_SR; }
|
||||
"usp" { yybegin(ASMOPS_OP); return REG_USP; }
|
||||
"vbr" { yybegin(ASMOPS_OP); return REG_VBR; }
|
||||
|
||||
"^" { return OP_BITWISE_XOR; }
|
||||
"," { return SEPARATOR; }
|
||||
"(" { return ROUND_L; }
|
||||
")" { yybegin(ASMOPS_OP); return ROUND_R; }
|
||||
"!" { return OP_UNARY_NOT; }
|
||||
"~" { return OP_UNARY_COMPL; }
|
||||
"+" { return OP_PLUS; }
|
||||
"-" { return OP_MINUS; }
|
||||
"*" { yybegin(ASMOPS_OP); return CURRENT_PC_SYMBOL; }
|
||||
{AREG} { yybegin(exprOpState); return AREG; }
|
||||
{DREG} { yybegin(exprOpState); return DREG; }
|
||||
"sp"|"a7" { yybegin(exprOpState); return REG_SP; }
|
||||
"pc" { yybegin(exprOpState); return PC; }
|
||||
"ccr" { yybegin(exprOpState); return REG_CCR; }
|
||||
"sr" { yybegin(exprOpState); return REG_SR; }
|
||||
"usp" { yybegin(exprOpState); return REG_USP; }
|
||||
"vbr" { yybegin(exprOpState); return REG_VBR; }
|
||||
|
||||
"#" { return HASH; }
|
||||
|
||||
{SYMBOL} { yybegin(ASMOPS_OP); return SYMBOL; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
{SYMBOL} { yybegin(exprOpState); return SYMBOL; }
|
||||
}
|
||||
|
||||
<ASMOPS_OP> {
|
||||
{WHITE_SPACE} { return handleEolCommentWhitespace(this); }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
|
||||
{OPSIZE_BS} { return OPSIZE_BS; }
|
||||
{OPSIZE_W} { return OPSIZE_W; }
|
||||
{OPSIZE_L} { return OPSIZE_L; }
|
||||
|
||||
"<<" { yybegin(ASMOPS); return OP_AR_SHIFT_L; }
|
||||
">>" { yybegin(ASMOPS); return OP_AR_SHIFT_R; }
|
||||
"&&" { yybegin(ASMOPS); return OP_LOGICAL_AND; }
|
||||
"||" { yybegin(ASMOPS); return OP_LOGICAL_OR; }
|
||||
"=="|"=" { yybegin(ASMOPS); return OP_CMP_EQ; }
|
||||
"<>"|"!=" { yybegin(ASMOPS); return OP_CMP_NOT_EQ; }
|
||||
">=" { yybegin(ASMOPS); return OP_CMP_GT_EQ; }
|
||||
"<=" { yybegin(ASMOPS); return OP_CMP_LT_EQ; }
|
||||
"<" { yybegin(ASMOPS); return OP_CMP_LT; }
|
||||
">" { yybegin(ASMOPS); return OP_CMP_GT; }
|
||||
"&" { yybegin(ASMOPS); return OP_BITWISE_AND; }
|
||||
"|"|"!" { yybegin(ASMOPS); return OP_BITWISE_OR; }
|
||||
"^" { yybegin(ASMOPS); return OP_BITWISE_XOR; }
|
||||
// ":" { return COLON; }
|
||||
// ";" { return SEMICOLON; }
|
||||
// "[" { return SQUARE_L; }
|
||||
// "]" { return SQUARE_R; }
|
||||
"," { yybegin(ASMOPS); return SEPARATOR; }
|
||||
"(" { yybegin(ASMOPS); return ROUND_L; }
|
||||
")" { return ROUND_R; }
|
||||
// "." { return DOT; }
|
||||
// "$" { return DOLLAR; }
|
||||
"~" { yybegin(ASMOPS); return OP_UNARY_COMPL; }
|
||||
"+" { yybegin(ASMOPS); return OP_PLUS; }
|
||||
"-" { yybegin(ASMOPS); return OP_MINUS; }
|
||||
"*" { yybegin(ASMOPS); return OP_AR_MUL; }
|
||||
"%"|"//" { yybegin(ASMOPS); return OP_AR_MOD; }
|
||||
"/" { yybegin(ASMOPS); return OP_AR_DIV; }
|
||||
|
||||
{SYMBOL} { return SYMBOL; }
|
||||
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<WAITEOL>
|
||||
@@ -288,4 +234,35 @@ SKIP_TO_EOL=[^\r\n]+
|
||||
{SKIP_TO_EOL} { return COMMENT; }
|
||||
}
|
||||
|
||||
// The macro mess starts here
|
||||
|
||||
<MACRODEF> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
{EOL} { yybegin(MACROLINE); macroLines = 0; return WHITE_SPACE; }
|
||||
"macro" { return MACRO_TAG; }
|
||||
{MACRONAME} { return MACRO_NAME; }
|
||||
|
||||
{COMMENT} { yybegin(MACROWAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<MACROLINE> {
|
||||
{EOL} { return handleMacroLineEol(this); }
|
||||
{MACRO_END_TAG} { yybegin(MACROTERMINATION); return MACRO_END_TAG; }
|
||||
|
||||
{PLAIN_MACRO_LINE} { return MACRO_LINE; }
|
||||
{COMMENT} { yybegin(MACROWAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<MACROTERMINATION> {
|
||||
{WHITE_SPACE} { return WHITE_SPACE; }
|
||||
{EOL} { yybegin(YYINITIAL); return EOL; }
|
||||
{COMMENT} { yybegin(WAITEOL); return COMMENT; }
|
||||
}
|
||||
|
||||
<MACROWAITEOL>
|
||||
{
|
||||
{EOL} { return handleMacroLineEol(this); }
|
||||
{SKIP_TO_EOL} { return COMMENT; }
|
||||
}
|
||||
|
||||
[^] { return BAD_CHARACTER; }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user