diff --git a/README.md b/README.md index 03b7d42..173e955 100644 --- a/README.md +++ b/README.md @@ -126,9 +126,12 @@ If the current statement has no valid syntax, the instruction details of all mat - Macro invocations are not yet evaluated, thus no referencing to symbols defined via macros (e.g. `STRUCT`). - Scoping for global symbols, labels and macros is currently the whole project. - No support for register replacement (e.g. registers replaced by `EQUR` or `EQURL` will cause syntax errors) -- While the lexer supports the -spaces option (where a space does *NOT* introduce a comment), this cannot be configured yet (default is ON). -- No support for other processor instructions and FPU. +- No support for other processor instructions and FPU. Yet. - The pretty esoteric use of `ZPC`, `ZA0-ZA7` or `ZSP` for zero (omitted) address in 68020 addressing modes is unsupported. +- Devpac allowed shuffling of (base) displacement and other parameters inside the new syntax (68020+) brackets. Well, I don't. Only strict `(bd,An,Xn*s)` or + `([bd,An],Xn*s,od)` order allowed. +- Switching the spaces option usually needs the caches to be invalidated. Find Usages word scanner always uses default settings, as it is not configurable per + project :-/ - Unit Test coverage is not as good as it could be (ahem). - Missing but planned features: - Macro evaluation on invocation @@ -167,6 +170,7 @@ are appreciated. It really is keeping me motivated to continue development. - Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too. - Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does. - New: Macro definition / invocation documentation provider that even tries to expand macros. +- New: Added Language settings page with one option so far (-spaces option). ### V0.7 (26-Sep-21) diff --git a/build.gradle b/build.gradle index 81a893c..eefbb54 100644 --- a/build.gradle +++ b/build.gradle @@ -64,6 +64,7 @@ patchPluginXml {
  • Enhancement: Label documentation now also works for local labels and includes end-of-line comment for label, too.
  • Enhancement: Symbol definition documentation now also includes comments in the same way as the label documentation does.
  • New: Macro definition / invocation documentation provider that even tries to expand macros. +
  • New: Added Language settings page with one option so far (-spaces option).

    Full changelog available at Github project site.

    """) diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.java b/src/main/gen/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.java index 635da3c..fcf399b 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.java @@ -196,7 +196,7 @@ public class _M68kLexer implements FlexLexer { private static final String ZZ_ACTION_PACKED_0 = "\17\0\1\1\2\2\1\3\1\4\1\5\1\6\1\7" + "\1\10\1\11\1\1\1\10\2\12\1\10\1\11\1\13" + - "\1\14\1\15\1\1\1\16\1\17\1\20\5\17\1\1" + + "\1\14\1\15\1\1\1\16\1\17\1\20\4\17\1\1" + "\1\17\5\1\1\21\1\22\1\23\1\24\1\25\1\26" + "\1\27\1\30\1\31\1\32\2\17\1\33\1\34\1\35" + "\1\36\1\37\1\40\1\41\1\42\1\43\1\44\1\45" + @@ -204,17 +204,17 @@ public class _M68kLexer implements FlexLexer { "\1\54\1\17\1\55\1\12\4\55\1\56\1\12\2\57" + "\2\60\1\61\1\62\3\63\1\62\1\63\1\0\1\4" + "\1\64\2\65\1\66\3\0\1\10\1\67\1\70\1\71" + - "\1\72\1\73\1\74\1\17\1\75\1\67\1\70\1\71" + - "\1\76\1\17\1\77\1\100\2\0\1\101\4\0\1\102" + - "\1\17\1\34\1\103\1\104\1\105\1\106\1\107\1\110" + - "\1\111\3\0\1\55\1\0\1\55\1\0\1\55\1\0" + - "\1\55\1\60\1\62\3\0\1\4\1\65\1\66\1\10" + - "\1\112\1\10\1\113\1\114\1\115\1\116\1\0\1\55" + - "\3\0\1\60\1\62\3\0\1\10\1\60\1\62\2\0" + - "\1\117\1\120\1\121\1\0\1\122"; + "\1\72\1\73\1\74\1\17\1\75\1\76\1\17\1\77" + + "\1\100\2\0\1\101\4\0\1\102\1\17\1\34\1\103" + + "\1\104\1\105\1\106\1\107\1\110\1\111\3\0\1\55" + + "\1\0\1\55\1\0\1\55\1\0\1\55\1\60\1\62" + + "\3\0\1\4\1\65\1\66\1\10\1\112\1\10\1\113" + + "\1\114\1\115\1\116\1\0\1\55\3\0\1\60\1\62" + + "\3\0\1\10\1\60\1\62\2\0\1\117\1\120\1\121" + + "\1\0\1\122"; private static int[] zzUnpackAction() { - int[] result = new int[190]; + int[] result = new int[186]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -245,27 +245,27 @@ public class _M68kLexer implements FlexLexer { "\0\u0564\0\u05a0\0\u05dc\0\u0384\0\u0618\0\u0654\0\u0690\0\u0384" + "\0\u06cc\0\u0708\0\u0744\0\u0780\0\u07bc\0\u07f8\0\u0834\0\u0870" + "\0\u08ac\0\u08e8\0\u0924\0\u0960\0\u099c\0\u09d8\0\u0a14\0\u0a50" + - "\0\u0a8c\0\u0ac8\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384" + - "\0\u0384\0\u0384\0\u0384\0\u0384\0\u0b04\0\u0b40\0\u0384\0\u0b7c" + - "\0\u0384\0\u0bb8\0\u0bf4\0\u0384\0\u0384\0\u0384\0\u0384\0\u0c30" + - "\0\u0384\0\u0384\0\u0384\0\u0384\0\u0c6c\0\u0ca8\0\u0ce4\0\u0384" + - "\0\u0d20\0\u0d5c\0\u0384\0\u0d98\0\u0dd4\0\u0dd4\0\u0e10\0\u0e4c" + - "\0\u0e88\0\u0ec4\0\u0f00\0\u0f00\0\u0384\0\u0f3c\0\u0f78\0\u0fb4" + - "\0\u0ff0\0\u102c\0\u102c\0\u0384\0\u1068\0\u10a4\0\u0f00\0\u10e0" + + "\0\u0a8c\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384" + + "\0\u0384\0\u0384\0\u0384\0\u0ac8\0\u0b04\0\u0384\0\u0b40\0\u0384" + + "\0\u0b7c\0\u0bb8\0\u0384\0\u0384\0\u0384\0\u0384\0\u0bf4\0\u0384" + + "\0\u0384\0\u0384\0\u0384\0\u0c30\0\u0c6c\0\u0ca8\0\u0384\0\u0ce4" + + "\0\u0d20\0\u0384\0\u0d5c\0\u0d98\0\u0d98\0\u0dd4\0\u0e10\0\u0e4c" + + "\0\u0e88\0\u0ec4\0\u0ec4\0\u0384\0\u0f00\0\u0f3c\0\u0f78\0\u0fb4" + + "\0\u0ff0\0\u0ff0\0\u0384\0\u102c\0\u1068\0\u0ec4\0\u10a4\0\u10e0" + "\0\u111c\0\u1158\0\u1194\0\u11d0\0\u120c\0\u1248\0\u1284\0\u12c0" + - "\0\u12fc\0\u0384\0\u0384\0\u0384\0\u0870\0\u0870\0\u0870\0\u1338" + - "\0\u0870\0\u0870\0\u0870\0\u0870\0\u0960\0\u1374\0\u09d8\0\u0a14" + - "\0\u0a50\0\u13b0\0\u0384\0\u0a8c\0\u13ec\0\u0ac8\0\u1428\0\u0870" + - "\0\u1464\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384" + - "\0\u0384\0\u14a0\0\u14dc\0\u1518\0\u1554\0\u1590\0\u15cc\0\u1608" + - "\0\u1644\0\u1680\0\u16bc\0\u16f8\0\u1734\0\u1770\0\u17ac\0\u17e8" + - "\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u1824\0\u0870\0\u0870" + - "\0\u0870\0\u0384\0\u1860\0\u0384\0\u189c\0\u18d8\0\u1914\0\u1950" + - "\0\u198c\0\u19c8\0\u1a04\0\u1a40\0\u1a7c\0\u1ab8\0\u1af4\0\u1158" + - "\0\u1b30\0\u0528\0\u0f78\0\u1b6c\0\u1ba8\0\u1be4"; + "\0\u0384\0\u0384\0\u0384\0\u0870\0\u0870\0\u0870\0\u12fc\0\u0870" + + "\0\u0924\0\u1338\0\u099c\0\u09d8\0\u0a14\0\u1374\0\u0384\0\u0a50" + + "\0\u13b0\0\u0a8c\0\u13ec\0\u0870\0\u1428\0\u0384\0\u0384\0\u0384" + + "\0\u0384\0\u0384\0\u0384\0\u0384\0\u0384\0\u1464\0\u14a0\0\u14dc" + + "\0\u1518\0\u1554\0\u1590\0\u15cc\0\u1608\0\u1644\0\u1680\0\u16bc" + + "\0\u16f8\0\u1734\0\u1770\0\u17ac\0\u0384\0\u0384\0\u0384\0\u0384" + + "\0\u0384\0\u17e8\0\u0870\0\u0870\0\u0870\0\u0384\0\u1824\0\u0384" + + "\0\u1860\0\u189c\0\u18d8\0\u1914\0\u1950\0\u198c\0\u19c8\0\u1a04" + + "\0\u1a40\0\u1a7c\0\u1ab8\0\u111c\0\u1af4\0\u0528\0\u0f3c\0\u1b30" + + "\0\u1b6c\0\u1ba8"; private static int[] zzUnpackRowMap() { - int[] result = new int[190]; + int[] result = new int[186]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -300,139 +300,137 @@ public class _M68kLexer implements FlexLexer { "\2\20\1\36\24\20\3\36\3\20\2\34\1\35\1\42" + "\16\20\1\43\6\20\1\41\42\20\2\34\1\35\1\44" + "\1\45\1\46\1\47\1\46\2\50\2\20\2\50\1\51" + - "\1\52\1\50\1\20\1\53\1\54\1\50\1\55\3\50" + - "\1\41\1\20\1\50\1\52\2\50\1\56\1\46\1\50" + - "\1\46\1\57\1\60\1\61\1\62\2\20\1\63\1\64" + - "\1\65\1\66\1\67\1\70\1\71\1\72\1\73\1\74" + - "\3\20\1\75\1\76\1\50\1\77\2\20\2\34\1\35" + - "\1\44\15\20\1\100\1\43\6\20\1\41\5\20\1\101" + - "\7\20\1\102\1\103\1\104\1\20\1\105\1\106\1\107" + - "\1\110\1\111\1\112\1\113\1\114\1\115\1\116\1\117" + - "\3\20\1\77\1\120\1\20\2\34\1\35\1\27\7\20" + - "\1\40\1\121\2\20\1\122\1\20\1\123\7\20\1\41" + - "\2\20\1\122\37\20\2\34\1\35\1\44\1\124\1\46" + - "\1\124\1\46\2\124\2\20\5\124\1\20\1\124\1\54" + - "\5\124\1\41\1\20\4\124\1\56\1\46\1\124\1\46" + - "\1\57\1\60\1\61\1\62\2\20\1\63\1\20\1\65" + - "\1\66\1\67\1\70\1\71\1\72\1\73\1\74\3\20" + - "\3\124\3\20\2\34\1\35\1\44\15\20\1\100\7\20" + - "\1\41\5\20\1\101\7\20\1\102\1\103\1\104\1\20" + - "\1\105\1\106\1\107\1\110\1\111\1\112\1\113\1\114" + - "\1\115\1\116\1\117\5\20\1\125\1\126\1\34\1\35" + - "\1\44\25\125\1\41\12\125\1\127\1\130\1\131\1\132" + - "\1\125\1\63\21\125\1\133\1\134\1\34\1\35\70\133" + - "\1\20\2\135\1\136\1\27\1\137\1\20\1\137\1\20" + - "\2\137\1\20\1\40\5\137\3\20\1\140\4\137\1\141" + - "\1\20\4\137\2\20\1\137\24\20\3\137\2\20\1\142" + - "\1\143\1\144\1\145\1\146\25\142\1\141\41\142\1\20" + - "\2\34\1\35\1\27\25\20\1\41\41\20\1\133\1\147" + - "\1\144\1\145\70\133\76\0\1\21\75\0\1\23\73\0" + - "\1\150\7\24\1\151\5\24\1\152\1\0\1\153\5\24" + - "\2\0\4\24\1\0\3\24\23\0\3\24\7\0\1\154" + - "\1\0\1\154\1\0\2\154\2\0\5\154\3\0\5\154" + - "\2\0\4\154\2\0\1\154\24\0\3\154\2\0\1\26" + + "\1\52\1\50\1\20\1\50\1\53\1\50\1\54\3\50" + + "\1\41\1\20\1\50\1\52\2\50\1\55\1\46\1\50" + + "\1\46\1\56\1\57\1\60\1\61\2\20\1\62\1\63" + + "\1\64\1\65\1\66\1\67\1\70\1\71\1\72\1\73" + + "\3\20\1\74\1\75\1\50\1\76\2\20\2\34\1\35" + + "\1\44\15\20\1\77\1\43\6\20\1\41\5\20\1\100" + + "\7\20\1\101\1\102\1\103\1\20\1\104\1\105\1\106" + + "\1\107\1\110\1\111\1\112\1\113\1\114\1\115\1\116" + + "\3\20\1\76\1\117\1\20\2\34\1\35\1\27\7\20" + + "\1\40\1\120\2\20\1\121\1\20\1\122\7\20\1\41" + + "\2\20\1\121\37\20\2\34\1\35\1\44\1\123\1\46" + + "\1\123\1\46\2\123\2\20\5\123\1\20\1\123\1\53" + + "\5\123\1\41\1\20\4\123\1\55\1\46\1\123\1\46" + + "\1\56\1\57\1\60\1\61\2\20\1\62\1\20\1\64" + + "\1\65\1\66\1\67\1\70\1\71\1\72\1\73\3\20" + + "\3\123\3\20\2\34\1\35\1\44\15\20\1\77\7\20" + + "\1\41\5\20\1\100\7\20\1\101\1\102\1\103\1\20" + + "\1\104\1\105\1\106\1\107\1\110\1\111\1\112\1\113" + + "\1\114\1\115\1\116\5\20\1\124\1\125\1\34\1\35" + + "\1\44\25\124\1\41\12\124\1\126\1\127\1\130\1\131" + + "\1\124\1\62\21\124\1\132\1\133\1\34\1\35\70\132" + + "\1\20\2\134\1\135\1\27\1\136\1\20\1\136\1\20" + + "\2\136\1\20\1\40\5\136\3\20\1\137\4\136\1\140" + + "\1\20\4\136\2\20\1\136\24\20\3\136\2\20\1\141" + + "\1\142\1\143\1\144\1\145\25\141\1\140\41\141\1\20" + + "\2\34\1\35\1\27\25\20\1\41\41\20\1\132\1\146" + + "\1\143\1\144\70\132\76\0\1\21\75\0\1\23\73\0" + + "\1\147\7\24\1\150\5\24\1\151\1\0\1\152\5\24" + + "\2\0\4\24\1\0\3\24\23\0\3\24\7\0\1\153" + + "\1\0\1\153\1\0\2\153\2\0\5\153\3\0\5\153" + + "\2\0\4\153\2\0\1\153\24\0\3\153\2\0\1\26" + "\3\0\70\26\4\0\1\27\74\0\1\30\1\31\1\30" + - "\1\31\1\30\2\31\1\155\5\30\1\0\1\156\1\157" + + "\1\31\1\30\2\31\1\154\5\30\1\0\1\155\1\156" + "\5\30\2\0\4\30\1\0\1\31\1\30\1\31\23\0" + - "\3\30\7\0\7\31\1\155\5\31\2\0\1\157\5\31" + - "\2\0\4\31\1\0\3\31\23\0\3\31\7\0\1\160" + - "\1\0\1\160\1\0\2\160\2\0\5\160\3\0\5\160" + - "\2\0\4\160\2\0\1\160\24\0\3\160\7\0\1\161" + - "\1\31\1\30\1\31\1\30\2\31\1\155\5\30\1\0" + - "\1\156\1\157\5\30\2\0\4\30\1\0\1\31\1\30" + + "\3\30\7\0\7\31\1\154\5\31\2\0\1\156\5\31" + + "\2\0\4\31\1\0\3\31\23\0\3\31\7\0\1\157" + + "\1\0\1\157\1\0\2\157\2\0\5\157\3\0\5\157" + + "\2\0\4\157\2\0\1\157\24\0\3\157\7\0\1\160" + + "\1\31\1\30\1\31\1\30\2\31\1\154\5\30\1\0" + + "\1\155\1\156\5\30\2\0\4\30\1\0\1\31\1\30" + "\1\31\23\0\3\30\4\0\1\34\76\0\1\36\1\37" + - "\1\36\1\37\1\36\2\37\1\0\5\36\1\0\1\156" + + "\1\36\1\37\1\36\2\37\1\0\5\36\1\0\1\155" + "\1\0\5\36\2\0\4\36\1\0\1\37\1\36\1\37" + "\23\0\3\36\7\0\7\37\1\0\5\37\3\0\5\37" + "\2\0\4\37\1\0\3\37\23\0\3\37\2\0\1\41" + - "\3\0\70\41\4\0\1\42\123\0\2\162\1\163\1\164" + - "\40\0\1\44\74\0\1\50\1\165\1\50\1\166\3\50" + - "\1\0\5\50\2\0\6\50\2\0\4\50\1\0\1\165" + + "\3\0\70\41\4\0\1\42\123\0\2\161\1\162\1\163" + + "\40\0\1\44\74\0\1\50\1\164\1\50\1\165\3\50" + + "\1\0\5\50\2\0\6\50\2\0\4\50\1\0\1\164" + "\2\50\23\0\3\50\10\0\1\46\1\0\1\46\30\0" + - "\1\46\1\0\1\46\35\0\1\50\1\167\1\50\1\167" + + "\1\46\1\0\1\46\35\0\1\50\1\166\1\50\1\166" + "\3\50\1\0\5\50\2\0\6\50\2\0\4\50\1\0" + - "\1\167\2\50\23\0\3\50\7\0\7\50\1\0\5\50" + + "\1\166\2\50\23\0\3\50\7\0\7\50\1\0\5\50" + "\2\0\6\50\2\0\4\50\1\0\3\50\23\0\3\50" + - "\7\0\7\50\1\0\3\50\1\170\1\50\2\0\6\50" + - "\2\0\1\50\1\170\2\50\1\0\3\50\23\0\3\50" + - "\7\0\7\50\1\0\5\50\2\0\3\50\1\171\2\50" + - "\2\0\4\50\1\0\3\50\23\0\1\166\2\50\7\0" + - "\7\50\1\0\5\50\2\0\6\50\2\0\2\172\1\173" + - "\1\174\1\0\3\50\23\0\3\50\7\0\4\175\4\0" + - "\1\175\10\0\1\175\5\0\1\175\4\0\3\175\25\0" + - "\1\175\7\0\7\50\1\0\5\50\2\0\2\50\1\176" + - "\3\50\2\0\4\50\1\0\3\50\23\0\3\50\43\0" + - "\1\177\40\0\1\200\1\0\1\200\30\0\1\200\32\0" + - "\2\201\2\0\27\201\1\202\11\201\1\203\26\201\2\204" + - "\2\0\27\204\1\205\12\204\1\203\25\204\2\206\2\0" + - "\27\206\1\207\13\206\1\203\24\206\5\0\7\50\1\0" + - "\5\50\2\0\2\50\1\210\3\50\2\0\4\50\1\0" + - "\3\50\23\0\3\50\7\0\7\50\1\0\5\50\2\0" + - "\6\50\2\0\1\211\3\50\1\0\3\50\23\0\2\50" + - "\1\211\24\0\1\212\73\0\1\213\25\0\1\214\1\215" + - "\44\0\1\216\26\0\1\217\44\0\1\215\135\0\1\220" + - "\74\0\1\221\74\0\1\101\23\0\1\222\72\0\1\223" + - "\63\0\7\124\1\0\5\124\1\0\7\124\1\0\5\124" + - "\1\0\3\124\23\0\3\124\2\0\2\125\3\0\25\125" + - "\1\0\17\125\1\0\21\125\2\127\2\0\1\224\25\127" + - "\1\224\1\225\11\127\1\125\4\127\1\224\21\127\2\130" + - "\2\0\1\226\25\130\1\226\1\227\12\130\1\125\3\130" + - "\1\226\21\130\2\131\2\0\1\230\25\131\1\230\1\231" + - "\13\131\1\125\2\131\1\230\21\131\2\132\2\0\1\232" + - "\25\132\1\232\1\233\15\132\1\125\1\232\21\132\2\133" + - "\2\0\70\133\2\0\1\135\76\0\7\137\1\0\5\137" + - "\3\0\5\137\2\0\4\137\1\0\3\137\23\0\3\137" + - "\7\0\1\234\6\137\1\0\5\137\3\0\5\137\2\0" + - "\4\137\1\0\3\137\23\0\3\137\2\0\1\141\3\0" + - "\70\141\2\142\2\0\26\142\1\0\41\142\2\0\1\144" + - "\71\0\2\142\2\0\1\146\10\142\1\235\14\142\1\0" + - "\41\142\4\0\1\150\10\0\1\236\2\0\1\237\1\0" + - "\1\152\2\0\1\240\7\0\1\237\42\0\1\150\7\0" + - "\1\241\5\0\1\152\2\0\1\240\52\0\1\152\103\0" + - "\1\242\64\0\7\154\1\242\5\154\3\0\5\154\2\0" + - "\4\154\1\0\3\154\23\0\3\154\16\0\1\243\57\0" + - "\1\244\3\0\70\244\14\0\1\245\64\0\7\160\1\245" + - "\5\160\3\0\5\160\2\0\4\160\1\0\3\160\23\0" + - "\3\160\7\0\1\30\1\31\1\30\1\31\1\30\2\31" + - "\1\155\5\30\1\0\1\156\1\157\1\30\1\246\3\30" + - "\2\0\4\30\1\0\1\31\1\30\1\31\23\0\3\30" + - "\7\0\7\50\1\0\5\50\2\0\6\50\2\0\4\50" + - "\1\0\3\50\23\0\1\247\2\50\7\0\7\50\1\0" + - "\5\50\2\0\3\50\1\250\2\50\2\0\4\50\1\0" + - "\3\50\23\0\3\50\2\0\1\201\3\0\70\201\1\204" + - "\3\0\70\204\1\206\3\0\70\206\5\0\7\50\1\0" + - "\5\50\2\0\3\50\1\251\2\50\2\0\4\50\1\0" + - "\3\50\23\0\3\50\21\0\1\252\75\0\1\252\52\0" + - "\2\224\2\0\27\224\1\253\11\224\1\254\26\224\1\127" + - "\1\125\2\0\1\224\25\127\1\224\17\127\1\224\21\127" + - "\2\226\2\0\27\226\1\255\12\226\1\254\25\226\1\130" + - "\1\125\2\0\1\226\25\130\1\226\17\130\1\226\21\130" + - "\2\230\2\0\27\230\1\256\13\230\1\254\24\230\1\131" + - "\1\125\2\0\1\230\25\131\1\230\17\131\1\230\21\131" + - "\2\232\2\0\27\232\1\257\15\232\1\254\22\232\1\132" + - "\1\125\2\0\1\232\25\132\1\232\17\132\1\232\21\132" + - "\5\0\7\137\1\0\5\137\3\0\1\137\1\260\3\137" + - "\2\0\4\137\1\0\3\137\23\0\3\137\2\0\2\142" + - "\2\0\25\142\1\261\1\0\41\142\16\0\1\262\72\0" + - "\1\263\63\0\1\264\73\0\1\30\1\31\1\30\1\31" + - "\1\30\2\31\1\155\5\30\1\0\1\156\1\157\2\30" + - "\1\265\2\30\2\0\4\30\1\0\1\31\1\30\1\31" + - "\23\0\3\30\2\0\1\224\3\0\70\224\1\226\3\0" + - "\70\226\1\230\3\0\70\230\1\232\3\0\70\232\5\0" + - "\7\137\1\0\5\137\3\0\2\137\1\266\2\137\2\0" + - "\4\137\1\0\3\137\23\0\3\137\2\0\2\142\2\0" + - "\3\142\1\267\22\142\1\0\41\142\17\0\1\270\75\0" + - "\1\270\100\0\1\271\52\0\1\30\1\31\1\30\1\31" + - "\1\30\2\31\1\155\5\30\1\0\1\156\1\157\3\30" + - "\1\272\1\30\2\0\4\30\1\0\1\31\1\30\1\31" + - "\23\0\3\30\7\0\7\137\1\0\5\137\3\0\3\137" + - "\1\273\1\137\2\0\4\137\1\0\3\137\23\0\3\137" + - "\2\0\2\142\2\0\21\142\1\274\4\142\1\0\41\142" + - "\27\0\1\275\44\0\2\274\2\0\26\274\1\0\41\274" + - "\30\0\1\276\47\0\1\276\67\0"; + "\7\0\7\50\1\0\3\50\1\167\1\50\2\0\6\50" + + "\2\0\1\50\1\167\2\50\1\0\3\50\23\0\3\50" + + "\7\0\7\50\1\0\5\50\2\0\3\50\1\170\2\50" + + "\2\0\4\50\1\0\3\50\23\0\1\165\2\50\7\0" + + "\4\171\4\0\1\171\10\0\1\171\5\0\1\171\4\0" + + "\3\171\25\0\1\171\7\0\7\50\1\0\5\50\2\0" + + "\2\50\1\172\3\50\2\0\4\50\1\0\3\50\23\0" + + "\3\50\43\0\1\173\40\0\1\174\1\0\1\174\30\0" + + "\1\174\32\0\2\175\2\0\27\175\1\176\11\175\1\177" + + "\26\175\2\200\2\0\27\200\1\201\12\200\1\177\25\200" + + "\2\202\2\0\27\202\1\203\13\202\1\177\24\202\5\0" + + "\7\50\1\0\5\50\2\0\2\50\1\204\3\50\2\0" + + "\4\50\1\0\3\50\23\0\3\50\7\0\7\50\1\0" + + "\5\50\2\0\6\50\2\0\1\205\3\50\1\0\3\50" + + "\23\0\2\50\1\205\24\0\1\206\73\0\1\207\25\0" + + "\1\210\1\211\44\0\1\212\26\0\1\213\44\0\1\211" + + "\135\0\1\214\74\0\1\215\74\0\1\100\23\0\1\216" + + "\72\0\1\217\63\0\7\123\1\0\5\123\1\0\7\123" + + "\1\0\5\123\1\0\3\123\23\0\3\123\2\0\2\124" + + "\3\0\25\124\1\0\17\124\1\0\21\124\2\126\2\0" + + "\1\220\25\126\1\220\1\221\11\126\1\124\4\126\1\220" + + "\21\126\2\127\2\0\1\222\25\127\1\222\1\223\12\127" + + "\1\124\3\127\1\222\21\127\2\130\2\0\1\224\25\130" + + "\1\224\1\225\13\130\1\124\2\130\1\224\21\130\2\131" + + "\2\0\1\226\25\131\1\226\1\227\15\131\1\124\1\226" + + "\21\131\2\132\2\0\70\132\2\0\1\134\76\0\7\136" + + "\1\0\5\136\3\0\5\136\2\0\4\136\1\0\3\136" + + "\23\0\3\136\7\0\1\230\6\136\1\0\5\136\3\0" + + "\5\136\2\0\4\136\1\0\3\136\23\0\3\136\2\0" + + "\1\140\3\0\70\140\2\141\2\0\26\141\1\0\41\141" + + "\2\0\1\143\71\0\2\141\2\0\1\145\10\141\1\231" + + "\14\141\1\0\41\141\4\0\1\147\10\0\1\232\2\0" + + "\1\233\1\0\1\151\2\0\1\234\7\0\1\233\42\0" + + "\1\147\7\0\1\235\5\0\1\151\2\0\1\234\52\0" + + "\1\151\103\0\1\236\64\0\7\153\1\236\5\153\3\0" + + "\5\153\2\0\4\153\1\0\3\153\23\0\3\153\16\0" + + "\1\237\57\0\1\240\3\0\70\240\14\0\1\241\64\0" + + "\7\157\1\241\5\157\3\0\5\157\2\0\4\157\1\0" + + "\3\157\23\0\3\157\7\0\1\30\1\31\1\30\1\31" + + "\1\30\2\31\1\154\5\30\1\0\1\155\1\156\1\30" + + "\1\242\3\30\2\0\4\30\1\0\1\31\1\30\1\31" + + "\23\0\3\30\7\0\7\50\1\0\5\50\2\0\6\50" + + "\2\0\4\50\1\0\3\50\23\0\1\243\2\50\7\0" + + "\7\50\1\0\5\50\2\0\3\50\1\244\2\50\2\0" + + "\4\50\1\0\3\50\23\0\3\50\2\0\1\175\3\0" + + "\70\175\1\200\3\0\70\200\1\202\3\0\70\202\5\0" + + "\7\50\1\0\5\50\2\0\3\50\1\245\2\50\2\0" + + "\4\50\1\0\3\50\23\0\3\50\21\0\1\246\75\0" + + "\1\246\52\0\2\220\2\0\27\220\1\247\11\220\1\250" + + "\26\220\1\126\1\124\2\0\1\220\25\126\1\220\17\126" + + "\1\220\21\126\2\222\2\0\27\222\1\251\12\222\1\250" + + "\25\222\1\127\1\124\2\0\1\222\25\127\1\222\17\127" + + "\1\222\21\127\2\224\2\0\27\224\1\252\13\224\1\250" + + "\24\224\1\130\1\124\2\0\1\224\25\130\1\224\17\130" + + "\1\224\21\130\2\226\2\0\27\226\1\253\15\226\1\250" + + "\22\226\1\131\1\124\2\0\1\226\25\131\1\226\17\131" + + "\1\226\21\131\5\0\7\136\1\0\5\136\3\0\1\136" + + "\1\254\3\136\2\0\4\136\1\0\3\136\23\0\3\136" + + "\2\0\2\141\2\0\25\141\1\255\1\0\41\141\16\0" + + "\1\256\72\0\1\257\63\0\1\260\73\0\1\30\1\31" + + "\1\30\1\31\1\30\2\31\1\154\5\30\1\0\1\155" + + "\1\156\2\30\1\261\2\30\2\0\4\30\1\0\1\31" + + "\1\30\1\31\23\0\3\30\2\0\1\220\3\0\70\220" + + "\1\222\3\0\70\222\1\224\3\0\70\224\1\226\3\0" + + "\70\226\5\0\7\136\1\0\5\136\3\0\2\136\1\262" + + "\2\136\2\0\4\136\1\0\3\136\23\0\3\136\2\0" + + "\2\141\2\0\3\141\1\263\22\141\1\0\41\141\17\0" + + "\1\264\75\0\1\264\100\0\1\265\52\0\1\30\1\31" + + "\1\30\1\31\1\30\2\31\1\154\5\30\1\0\1\155" + + "\1\156\3\30\1\266\1\30\2\0\4\30\1\0\1\31" + + "\1\30\1\31\23\0\3\30\7\0\7\136\1\0\5\136" + + "\3\0\3\136\1\267\1\136\2\0\4\136\1\0\3\136" + + "\23\0\3\136\2\0\2\141\2\0\21\141\1\270\4\141" + + "\1\0\41\141\27\0\1\271\44\0\2\270\2\0\26\270" + + "\1\0\41\270\30\0\1\272\47\0\1\272\67\0"; private static int[] zzUnpackTrans() { - int[] result = new int[7200]; + int[] result = new int[7140]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -470,17 +468,17 @@ public class _M68kLexer implements FlexLexer { private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\17\0\2\11\12\1\1\11\3\1\1\11\22\1\12\11" + + "\17\0\2\11\12\1\1\11\3\1\1\11\21\1\12\11" + "\2\1\1\11\1\1\1\11\2\1\4\11\1\1\4\11" + "\3\1\1\11\2\1\1\11\11\1\1\11\6\1\1\11" + - "\3\1\1\0\5\1\3\0\1\1\3\11\14\1\2\0" + + "\3\1\1\0\5\1\3\0\1\1\3\11\11\1\2\0" + "\1\11\4\0\2\1\10\11\3\0\1\1\1\0\1\1" + "\1\0\1\1\1\0\3\1\3\0\5\11\4\1\1\11" + "\1\0\1\11\3\0\2\1\3\0\3\1\2\0\3\1" + "\1\0\1\1"; private static int[] zzUnpackAttribute() { - int[] result = new int[190]; + int[] result = new int[186]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -879,14 +877,17 @@ public class _M68kLexer implements FlexLexer { } //if(isEndDirective(yytext())) { yybegin(YYINITIAL); zzAtEOF = true; return null; } if (isDataDirective(yytext())) { + eatOneWhitespace = true; startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; } if (isPlainDirective(yytext())) { + eatOneWhitespace = true; yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; } if (isOtherDirective(yytext())) { + eatOneWhitespace = true; startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.flex b/src/main/java/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.flex index 488ab82..1e133f4 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.flex +++ b/src/main/java/de/platon42/intellij/plugins/m68k/lexer/_M68kLexer.flex @@ -118,9 +118,9 @@ PLAIN_MACRO_LINE=[^;\r\n]+ 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; } + if(isDataDirective(yytext())) { eatOneWhitespace = true; startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; } + if(isPlainDirective(yytext())) { eatOneWhitespace = true; yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; } + if(isOtherDirective(yytext())) { eatOneWhitespace = true; startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; } return handleMacroMode(this); } {MACRONAME} { return handleMacroMode(this); } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/parser/M68kParserDefinition.kt b/src/main/java/de/platon42/intellij/plugins/m68k/parser/M68kParserDefinition.kt index d40236c..ffeea08 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/parser/M68kParserDefinition.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/parser/M68kParserDefinition.kt @@ -10,15 +10,14 @@ import de.platon42.intellij.plugins.m68k.lexer.M68kLexer import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs import de.platon42.intellij.plugins.m68k.psi.M68kFile import de.platon42.intellij.plugins.m68k.psi.M68kTypes +import de.platon42.intellij.plugins.m68k.settings.M68kProjectSettings import de.platon42.intellij.plugins.m68k.stubs.M68kElementTypes class M68kParserDefinition : ParserDefinition { - val lexerPrefs = M68kLexerPrefs() // TODO make this configurable - override fun createLexer(project: Project): Lexer { - // TODO take prefs from project somehow - return M68kLexer(lexerPrefs) + val settings = project.getService(M68kProjectSettings::class.java) + return M68kLexer(settings?.settings ?: M68kLexerPrefs()) } override fun createParser(project: Project) = M68kParser() diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/settings/M68kProjectSettings.kt b/src/main/java/de/platon42/intellij/plugins/m68k/settings/M68kProjectSettings.kt new file mode 100644 index 0000000..df4adc1 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/settings/M68kProjectSettings.kt @@ -0,0 +1,19 @@ +package de.platon42.intellij.plugins.m68k.settings + +import com.intellij.openapi.components.PersistentStateComponent +import com.intellij.openapi.components.State +import com.intellij.openapi.components.Storage +import com.intellij.openapi.components.StoragePathMacros +import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs + +@State(name = "M68k.Settings", storages = [Storage(StoragePathMacros.WORKSPACE_FILE)]) +class M68kProjectSettings : PersistentStateComponent { + + var settings: M68kLexerPrefs = M68kLexerPrefs() + + override fun getState() = settings + + override fun loadState(state: M68kLexerPrefs) { + settings = state + } +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/settings/M68kProjectSettingsConfigurable.kt b/src/main/java/de/platon42/intellij/plugins/m68k/settings/M68kProjectSettingsConfigurable.kt new file mode 100644 index 0000000..f7187e8 --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/settings/M68kProjectSettingsConfigurable.kt @@ -0,0 +1,45 @@ +package de.platon42.intellij.plugins.m68k.settings + +import com.intellij.openapi.options.Configurable +import com.intellij.openapi.options.ConfigurationException +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.NlsContexts.ConfigurableName +import com.intellij.ui.components.JBCheckBox +import com.intellij.uiDesigner.core.Spacer +import com.intellij.util.ui.FormBuilder +import com.intellij.util.ui.UIUtil +import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs +import javax.swing.JComponent + +class M68kProjectSettingsConfigurable(project: Project?) : Configurable { + + private val settings = project?.getService(M68kProjectSettings::class.java) + + private val spacesOptionField = JBCheckBox("Space introduces comment (-spaces)", settings?.settings?.spaceIntroducesComment ?: false) + + override fun getDisplayName(): @ConfigurableName String = "M68k" + + override fun createComponent(): JComponent? { + return FormBuilder.createFormBuilder() + .setAlignLabelOnRight(false) + .setHorizontalGap(UIUtil.DEFAULT_HGAP) + .setVerticalGap(UIUtil.DEFAULT_VGAP) + .addComponent(spacesOptionField) + .addComponentFillVertically(Spacer(), 0) + .panel + } + + override fun isModified(): Boolean { + return settings?.settings?.spaceIntroducesComment != spacesOptionField.isSelected + } + + @Throws(ConfigurationException::class) + override fun apply() { + settings?.settings?.spaceIntroducesComment = spacesOptionField.isSelected + } + + override fun reset() { + val default = M68kLexerPrefs() + settings?.settings?.spaceIntroducesComment = default.spaceIntroducesComment + } +} \ No newline at end of file diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt index 4a29d6b..42e19a1 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/syntax/M68kSyntaxHighlighter.kt @@ -11,15 +11,13 @@ import com.intellij.psi.tree.IElementType import de.platon42.intellij.plugins.m68k.lexer.M68kLexer import de.platon42.intellij.plugins.m68k.lexer.M68kLexerPrefs import de.platon42.intellij.plugins.m68k.psi.M68kTypes +import de.platon42.intellij.plugins.m68k.settings.M68kProjectSettings class M68kSyntaxHighlighter(val project: Project?) : SyntaxHighlighterBase() { + private val settings = project?.getService(M68kProjectSettings::class.java) + override fun getHighlightingLexer(): Lexer { - if (project == null) { - return M68kLexer(M68kLexerPrefs()) // Use some defaults - } else { - // FIXME Where do we get the prefs from? - return M68kLexer(M68kLexerPrefs()) - } + return M68kLexer(settings?.settings ?: M68kLexerPrefs()) // Use some defaults } override fun getTokenHighlights(tokenType: IElementType): Array { diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index f63b278..c147df6 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -68,6 +68,12 @@ + + + + diff --git a/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java b/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java index 1d59ad3..24545d9 100644 --- a/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java +++ b/src/test/java/de/platon42/intellij/jupiter/ParsingTestExtension.java @@ -2,6 +2,7 @@ package de.platon42.intellij.jupiter; import com.intellij.lang.ParserDefinition; +import com.intellij.mock.MockProjectEx; import com.intellij.openapi.Disposable; import com.intellij.openapi.util.Disposer; import com.intellij.psi.PsiFile; @@ -113,6 +114,8 @@ public class ParsingTestExtension implements ParameterResolver, AfterTestExecuti public interface IParsingTestCase { + MockProjectEx getProject(); + ParserDefinition getParserDefinition(); void ensureNoErrorElements(); diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/parser/CommentsTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/parser/CommentsTest.kt index 0786953..1508ab1 100644 --- a/src/test/java/de/platon42/intellij/plugins/m68k/parser/CommentsTest.kt +++ b/src/test/java/de/platon42/intellij/plugins/m68k/parser/CommentsTest.kt @@ -3,6 +3,7 @@ package de.platon42.intellij.plugins.m68k.parser import de.platon42.intellij.jupiter.MyTestCase import de.platon42.intellij.jupiter.ParsingTestExtension import de.platon42.intellij.jupiter.TestDataSubPath +import de.platon42.intellij.plugins.m68k.settings.M68kProjectSettings import org.junit.jupiter.api.Test @TestDataSubPath("comments") @@ -50,37 +51,51 @@ internal class CommentsTest : AbstractParsingTest() { @Test internal fun comment_after_instruction_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - (testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = true + setSpacesSetting(testCase, true) testGoodSyntax(testCase, " add.w d0,d0 hey comment\n") } @Test internal fun comment_after_assignment_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - (testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = true + setSpacesSetting(testCase, true) + testGoodSyntax(testCase, "FOO = 123+23 hey comment\n") } + @Test + internal fun comment_after_data_directive_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + setSpacesSetting(testCase, true) + + testGoodSyntax(testCase, " dc.w $1234,$2345 hey comment\n") + } + @Test internal fun comment_after_macro_call_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - (testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = true + setSpacesSetting(testCase, true) testGoodSyntax(testCase, " PUSHM d0,d0 hey comment\n") } @Test internal fun space_does_not_start_comment_within_instruction_without_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - (testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = false + setSpacesSetting(testCase, false) testGoodSyntax(testCase, " add.w # 234, d0 ; hey comment\n") } @Test internal fun space_does_not_start_comment_within_assignment_without_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - (testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = false + setSpacesSetting(testCase, false) testGoodSyntax(testCase, "FOO = 123 + 23 ; hey comment\n") } @Test internal fun space_does_not_start_comment_within_macro_call_without_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - (testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = false + setSpacesSetting(testCase, false) testGoodSyntax(testCase, " PUSHM d0, d0 ; hey comment\n") } + + private fun setSpacesSetting(testCase: ParsingTestExtension.IParsingTestCase, spacesOption: Boolean) { + val settings = M68kProjectSettings() + settings.settings.spaceIntroducesComment = spacesOption + testCase.project.registerService(M68kProjectSettings::class.java, settings) + } } \ No newline at end of file diff --git a/src/test/resources/parser/comments/comment_after_data_directive_with_space_introduces_comment_option.txt b/src/test/resources/parser/comments/comment_after_data_directive_with_space_introduces_comment_option.txt new file mode 100644 index 0000000..656d176 --- /dev/null +++ b/src/test/resources/parser/comments/comment_after_data_directive_with_space_introduces_comment_option.txt @@ -0,0 +1,15 @@ +Assembly File: a.asm + PsiWhiteSpace(' ') + M68kStatementImpl(STATEMENT) + M68kPreprocessorDirectiveImpl(PREPROCESSOR_DIRECTIVE) + M68kPreprocessorKeywordImpl(PREPROCESSOR_KEYWORD) + PsiElement(M68kTokenType.DATA_DIRECTIVE)('dc.w') + PsiWhiteSpace(' ') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.HEXADECIMAL)('$1234') + PsiElement(M68kTokenType.SEPARATOR)(',') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.HEXADECIMAL)('$2345') + PsiWhiteSpace(' ') + PsiComment(M68kTokenType.COMMENT)('hey comment') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file