Added macro call. Extended syntax highlighting.

This commit is contained in:
Chris Hodges 2021-07-15 22:15:22 +02:00
parent aa14984a8e
commit beea9b2763
17 changed files with 396 additions and 283 deletions

View File

@ -190,19 +190,19 @@ public class _M68kLexer implements FlexLexer {
private static final String ZZ_ACTION_PACKED_0 = private static final String ZZ_ACTION_PACKED_0 =
"\11\0\1\1\2\2\1\3\1\4\1\1\1\5\2\6" + "\11\0\1\1\2\2\1\3\1\4\1\1\1\5\2\6" +
"\1\2\1\7\2\10\1\11\2\12\1\7\1\13\1\14" + "\1\2\1\7\2\10\1\11\2\12\1\7\1\13\1\14" +
"\1\15\1\1\1\13\1\16\4\13\1\17\1\13\1\1" + "\1\15\1\1\1\16\1\17\5\16\1\20\1\16\1\1" +
"\1\20\4\1\1\21\1\22\1\23\1\24\1\25\1\26" + "\1\21\4\1\1\22\1\23\1\24\1\25\1\26\1\27" +
"\1\27\1\30\1\31\1\32\1\33\1\34\1\35\1\36" + "\1\30\1\31\1\32\1\33\1\34\1\35\1\36\1\37" +
"\1\37\2\13\2\1\1\40\1\13\1\12\4\13\1\0" + "\1\40\2\16\2\1\1\41\1\42\1\12\4\42\1\0" +
"\1\41\1\4\2\42\1\0\3\10\1\43\1\44\1\45" + "\1\43\1\4\2\44\1\0\3\10\1\45\1\46\1\47" +
"\1\46\1\47\1\50\1\13\1\51\1\43\1\44\1\52" + "\1\50\1\51\1\52\1\16\1\53\1\45\1\46\1\54" +
"\1\53\1\54\1\0\1\55\5\0\1\56\1\57\1\60" + "\1\55\1\56\1\0\1\42\5\0\1\57\1\60\1\61" +
"\1\61\1\62\1\63\1\64\2\13\3\0\1\13\1\0" + "\1\62\1\63\1\64\1\65\2\16\2\0\3\42\1\0" +
"\1\13\1\0\1\13\1\0\1\13\2\0\1\4\1\42" + "\1\42\2\0\1\4\1\44\1\7\1\66\1\67\1\70" +
"\1\7\1\65\1\66\1\67\1\70\1\13\7\0"; "\1\71\4\0";
private static int[] zzUnpackAction() { private static int[] zzUnpackAction() {
int[] result = new int[135]; int[] result = new int[129];
int offset = 0; int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result; return result;
@ -232,21 +232,21 @@ public class _M68kLexer implements FlexLexer {
"\0\u0201\0\u0357\0\u0390\0\u03c9\0\u0402\0\u043b\0\u0474\0\u0201" + "\0\u0201\0\u0357\0\u0390\0\u03c9\0\u0402\0\u043b\0\u0474\0\u0201" +
"\0\u04ad\0\u04e6\0\u051f\0\u0558\0\u0591\0\u05ca\0\u0603\0\u063c" + "\0\u04ad\0\u04e6\0\u051f\0\u0558\0\u0591\0\u05ca\0\u0603\0\u063c" +
"\0\u0675\0\u06ae\0\u06e7\0\u0720\0\u0759\0\u0792\0\u07cb\0\u0804" + "\0\u0675\0\u06ae\0\u06e7\0\u0720\0\u0759\0\u0792\0\u07cb\0\u0804" +
"\0\u083d\0\u0876\0\u08af\0\u08e8\0\u0921\0\u095a\0\u0201\0\u0201" + "\0\u083d\0\u0876\0\u08af\0\u08e8\0\u0921\0\u095a\0\u0993\0\u0201" +
"\0\u0993\0\u09cc\0\u0a05\0\u0201\0\u0201\0\u0201\0\u0201\0\u0201" + "\0\u0201\0\u09cc\0\u0a05\0\u0a3e\0\u0201\0\u0201\0\u0201\0\u0201" +
"\0\u0201\0\u0201\0\u0201\0\u0a3e\0\u0a77\0\u0ab0\0\u0ae9\0\u0201" + "\0\u0201\0\u0201\0\u0201\0\u0201\0\u0a77\0\u0ab0\0\u0ae9\0\u0b22" +
"\0\u0b22\0\u0b22\0\u0b5b\0\u0b94\0\u0bcd\0\u0c06\0\u0c3f\0\u0c78" + "\0\u0201\0\u0b5b\0\u0b5b\0\u0b94\0\u0bcd\0\u0c06\0\u0c3f\0\u0c78" +
"\0\u0cb1\0\u0cea\0\u0d23\0\u0d5c\0\u0d95\0\u0dce\0\u0e07\0\u0201" + "\0\u0cb1\0\u0cea\0\u0d23\0\u0d5c\0\u0d95\0\u0dce\0\u0e07\0\u0e40" +
"\0\u0201\0\u051f\0\u051f\0\u051f\0\u051f\0\u0e40\0\u0201\0\u051f" + "\0\u0201\0\u0201\0\u0720\0\u0720\0\u0720\0\u0720\0\u0e79\0\u0201" +
"\0\u051f\0\u07cb\0\u0804\0\u083d\0\u0876\0\u0201\0\u0e79\0\u08af" + "\0\u0720\0\u0720\0\u0804\0\u083d\0\u0876\0\u08af\0\u0201\0\u0eb2" +
"\0\u0eb2\0\u08e8\0\u0eeb\0\u0201\0\u0201\0\u0201\0\u0201\0\u0201" + "\0\u08e8\0\u0eeb\0\u0921\0\u0f24\0\u0201\0\u0201\0\u0201\0\u0201" +
"\0\u0201\0\u0201\0\u0f24\0\u0f5d\0\u0f96\0\u0fcf\0\u1008\0\u1041" + "\0\u0201\0\u0201\0\u0201\0\u0f5d\0\u0f96\0\u0fcf\0\u1008\0\u1041" +
"\0\u107a\0\u10b3\0\u10ec\0\u1125\0\u115e\0\u1197\0\u11d0\0\u1209" + "\0\u107a\0\u10b3\0\u10ec\0\u1125\0\u115e\0\u1197\0\u0201\0\u0201" +
"\0\u0201\0\u0201\0\u0201\0\u051f\0\u051f\0\u051f\0\u0201\0\u0201" + "\0\u0201\0\u0720\0\u0720\0\u0720\0\u0201\0\u11d0\0\u1209\0\u1242" +
"\0\u1242\0\u127b\0\u12b4\0\u12ed\0\u1326\0\u135f\0\u0c78"; "\0\u0cb1";
private static int[] zzUnpackRowMap() { private static int[] zzUnpackRowMap() {
int[] result = new int[135]; int[] result = new int[129];
int offset = 0; int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result; return result;
@ -279,84 +279,82 @@ public class _M68kLexer implements FlexLexer {
"\4\32\1\12\1\33\2\12\3\32\2\12\3\32\1\12" + "\4\32\1\12\1\33\2\12\3\32\2\12\3\32\1\12" +
"\1\32\10\12\1\34\14\12\5\32\1\12\2\30\1\31" + "\1\32\10\12\1\34\14\12\5\32\1\12\2\30\1\31" +
"\1\35\15\12\1\36\24\12\1\34\22\12\2\30\1\31" + "\1\35\15\12\1\36\24\12\1\34\22\12\2\30\1\31" +
"\1\23\1\37\1\40\1\41\1\42\1\43\2\33\1\12" + "\1\23\1\37\1\40\1\41\1\42\1\43\2\44\1\12" +
"\2\33\1\44\1\33\1\45\1\46\1\12\1\47\1\41" + "\2\44\1\45\1\44\1\46\1\47\1\12\1\50\1\41" +
"\2\33\1\50\1\40\1\37\1\43\1\33\1\40\1\33" + "\2\44\1\51\1\40\1\37\1\43\1\44\1\40\1\44" +
"\1\51\1\52\1\12\1\53\1\54\1\55\1\56\1\57" + "\1\52\1\53\1\12\1\54\1\55\1\56\1\57\1\60" +
"\1\34\1\60\1\61\1\62\1\63\1\64\1\65\1\66" + "\1\34\1\61\1\62\1\63\1\64\1\65\1\66\1\67" +
"\1\67\1\70\1\71\1\72\1\73\2\74\1\33\1\75" + "\1\70\1\71\1\72\1\73\1\74\2\75\1\44\1\76" +
"\1\33\1\12\2\30\1\31\1\23\2\12\1\76\5\12" + "\1\44\1\12\2\30\1\31\1\23\2\12\1\77\5\12" +
"\1\77\3\12\1\100\3\12\1\76\10\12\1\77\10\12" + "\1\100\3\12\1\101\3\12\1\77\10\12\1\100\10\12" +
"\1\34\22\12\2\30\1\31\1\23\1\33\1\40\5\33" + "\1\34\22\12\2\30\1\31\1\23\1\44\1\40\5\44" +
"\1\12\4\33\1\45\1\33\1\12\1\47\3\33\1\50" + "\1\12\4\44\1\46\1\44\1\12\1\50\3\44\1\51" +
"\1\40\3\33\1\40\1\33\1\51\1\52\1\12\1\53" + "\1\40\3\44\1\40\1\44\1\52\1\53\1\12\1\54" +
"\1\54\1\55\1\56\1\57\1\34\1\12\1\61\1\62" + "\1\55\1\56\1\57\1\60\1\34\1\12\1\62\1\63" +
"\1\63\1\64\1\65\1\66\1\67\1\70\1\71\1\72" + "\1\64\1\65\1\66\1\67\1\70\1\71\1\72\1\73" +
"\1\73\5\33\1\101\1\102\1\30\1\31\1\23\33\101" + "\1\74\5\44\1\102\1\103\1\30\1\31\1\23\33\102" +
"\1\103\1\101\1\104\1\105\1\106\1\101\1\57\1\34" + "\1\104\1\102\1\105\1\106\1\107\1\102\1\60\1\34" +
"\21\101\1\12\2\30\1\31\65\12\73\0\1\13\72\0" + "\21\102\1\12\2\30\1\31\65\12\73\0\1\13\72\0" +
"\1\15\70\0\1\107\14\16\1\110\1\0\1\111\1\112" + "\1\15\70\0\1\110\14\16\1\111\1\0\1\112\1\113" +
"\3\16\1\0\6\16\25\0\5\16\5\0\1\113\1\0" + "\3\16\1\0\6\16\25\0\5\16\5\0\1\114\1\0" +
"\5\113\1\0\4\113\4\0\3\113\2\0\3\113\1\0" + "\5\114\1\0\4\114\4\0\3\114\2\0\3\114\1\0" +
"\1\113\25\0\5\113\1\20\3\0\65\20\2\0\1\21" + "\1\114\25\0\5\114\1\20\3\0\65\20\2\0\1\21" +
"\72\0\1\23\71\0\1\24\1\25\4\24\2\25\4\24" + "\72\0\1\23\71\0\1\24\1\25\4\24\2\25\4\24" +
"\1\0\1\114\1\111\1\115\3\24\1\0\1\25\3\24" + "\1\0\1\115\1\112\1\116\3\24\1\0\1\25\3\24" +
"\1\25\1\24\25\0\5\24\5\0\14\25\2\0\1\111" + "\1\25\1\24\25\0\5\24\5\0\14\25\2\0\1\112" +
"\1\115\3\25\1\0\6\25\25\0\5\25\5\0\1\116" + "\1\116\3\25\1\0\6\25\25\0\5\25\5\0\1\117" +
"\1\117\5\116\1\117\4\116\3\0\1\117\3\116\1\0" + "\1\120\5\117\1\120\4\117\3\0\1\120\3\117\1\0" +
"\1\117\3\116\1\117\1\116\25\0\5\116\1\27\3\0" + "\1\120\3\117\1\120\1\117\25\0\5\117\1\27\3\0" +
"\65\27\2\0\1\30\73\0\1\32\1\33\4\32\2\33" + "\65\27\2\0\1\30\73\0\1\32\1\33\4\32\2\33" +
"\4\32\1\0\1\114\1\0\1\33\3\32\1\0\1\33" + "\4\32\1\0\1\115\1\0\1\33\3\32\1\0\1\33" +
"\3\32\1\33\1\32\25\0\5\32\5\0\14\33\3\0" + "\3\32\1\33\1\32\25\0\5\32\5\0\14\33\3\0" +
"\4\33\1\0\6\33\25\0\5\33\1\34\3\0\65\34" + "\4\33\1\0\6\33\25\0\5\33\1\34\3\0\65\34" +
"\4\0\1\35\111\0\2\120\1\121\46\0\1\33\1\122" + "\4\0\1\35\111\0\2\121\1\122\46\0\1\44\1\123" +
"\12\33\3\0\4\33\1\0\1\122\5\33\25\0\5\33" + "\12\44\3\0\4\44\1\0\1\123\5\44\25\0\5\44" +
"\6\0\1\40\22\0\1\40\3\0\1\40\40\0\3\33" + "\6\0\1\40\22\0\1\40\3\0\1\40\40\0\3\44" +
"\1\122\10\33\3\0\4\33\1\0\6\33\25\0\2\33" + "\1\123\10\44\3\0\4\44\1\0\6\44\25\0\2\44" +
"\1\123\2\33\5\0\14\33\3\0\4\33\1\0\6\33" + "\1\124\2\44\5\0\14\44\3\0\4\44\1\0\6\44" +
"\25\0\2\124\3\33\5\0\1\33\1\125\12\33\3\0" + "\25\0\2\125\3\44\5\0\1\44\1\126\12\44\3\0" +
"\4\33\1\0\1\125\5\33\25\0\5\33\5\0\2\33" + "\4\44\1\0\1\126\5\44\25\0\5\44\5\0\14\44" +
"\1\126\11\33\3\0\1\33\1\126\2\33\1\0\6\33" + "\3\0\4\44\1\0\6\44\25\0\5\44\5\0\2\44" +
"\25\0\5\33\21\0\1\127\54\0\14\33\3\0\1\33" + "\1\127\11\44\3\0\1\44\1\127\2\44\1\0\6\44" +
"\2\130\1\131\1\0\6\33\25\0\5\33\6\0\1\132" + "\25\0\5\44\21\0\1\130\54\0\14\44\3\0\1\44" +
"\17\0\1\132\2\0\6\132\26\0\1\132\34\0\1\133" + "\2\131\1\132\1\0\6\44\25\0\5\44\6\0\1\133" +
"\45\0\1\134\22\0\1\134\37\0\40\135\1\136\1\137" + "\17\0\1\133\2\0\6\133\26\0\1\133\34\0\1\134" +
"\27\135\41\140\1\141\1\136\26\140\41\142\1\143\1\142" + "\45\0\1\135\22\0\1\135\37\0\40\136\1\137\1\140" +
"\1\136\25\142\21\0\1\144\22\0\1\145\1\146\44\0" + "\27\136\41\141\1\142\1\137\26\141\41\143\1\144\1\143" +
"\1\147\23\0\1\150\74\0\1\151\71\0\1\152\37\0" + "\1\137\25\143\21\0\1\145\22\0\1\146\1\147\44\0" +
"\1\146\54\0\14\33\3\0\4\33\1\0\6\33\25\0" + "\1\150\23\0\1\151\74\0\1\152\71\0\1\153\37\0" +
"\2\153\3\33\5\0\14\33\3\0\2\33\1\154\1\33" + "\1\147\54\0\14\44\3\0\4\44\1\0\6\44\25\0" +
"\1\0\6\33\25\0\4\33\1\154\15\0\1\155\20\0" + "\2\154\3\44\5\0\14\44\3\0\2\44\1\155\1\44" +
"\1\155\50\0\1\156\52\0\2\101\3\0\41\101\2\0" + "\1\0\6\44\25\0\4\44\1\155\15\0\1\156\20\0" +
"\21\101\2\103\3\157\33\103\1\101\1\160\4\103\2\157" + "\1\156\50\0\1\157\52\0\2\102\3\0\41\102\2\0" +
"\21\103\2\104\3\161\34\104\1\162\1\101\3\104\2\161" + "\21\102\2\104\3\136\33\104\1\102\1\160\4\104\2\136" +
"\21\104\2\105\3\163\34\105\1\164\1\105\1\101\2\105" + "\21\104\2\105\3\141\34\105\1\161\1\102\3\105\2\141" +
"\2\163\21\105\2\106\3\165\34\106\1\166\3\106\1\101" + "\21\105\2\106\3\143\34\106\1\162\1\106\1\102\2\106" +
"\2\165\21\106\4\0\1\107\2\0\1\167\5\0\1\170" + "\2\143\21\106\2\107\3\163\34\107\1\164\3\107\1\102" +
"\3\0\1\110\3\0\1\167\10\0\1\170\36\0\1\110" + "\2\163\21\107\4\0\1\110\2\0\1\165\5\0\1\166" +
"\107\0\1\171\70\0\1\172\52\0\14\113\2\0\1\172" + "\3\0\1\111\3\0\1\165\10\0\1\166\36\0\1\111" +
"\1\0\3\113\1\0\6\113\25\0\5\113\1\173\3\0" + "\107\0\1\167\70\0\1\170\52\0\14\114\2\0\1\170" +
"\65\173\5\0\14\117\2\0\1\172\4\117\1\0\6\117" + "\1\0\3\114\1\0\6\114\25\0\5\114\1\171\3\0" +
"\25\0\5\117\5\0\14\116\2\0\1\172\1\117\3\116" + "\65\171\5\0\14\120\2\0\1\170\4\120\1\0\6\120" +
"\1\0\6\116\25\0\5\116\5\0\14\117\3\0\4\117" + "\25\0\5\120\5\0\14\117\2\0\1\170\1\120\3\117" +
"\1\0\6\117\25\0\5\117\5\0\3\33\1\174\10\33" + "\1\0\6\117\25\0\5\117\5\0\14\120\3\0\4\120" +
"\3\0\4\33\1\0\6\33\25\0\5\33\1\135\3\0" + "\1\0\6\120\25\0\5\120\5\0\3\44\1\172\10\44" +
"\65\135\1\140\3\0\65\140\1\142\3\0\65\142\5\0" + "\3\0\4\44\1\0\6\44\25\0\5\44\1\136\3\0" +
"\14\33\3\0\4\33\1\0\6\33\25\0\2\33\1\175" + "\65\136\1\141\3\0\65\141\1\143\3\0\65\143\5\0" +
"\2\33\5\0\14\33\3\0\4\33\1\0\6\33\25\0" + "\14\44\3\0\4\44\1\0\6\44\25\0\2\44\1\173" +
"\2\33\1\176\2\33\20\0\1\177\67\0\1\177\51\0" + "\2\44\5\0\14\44\3\0\4\44\1\0\6\44\25\0" +
"\40\157\1\200\1\201\27\157\1\103\1\101\2\0\1\157" + "\2\44\1\174\2\44\20\0\1\175\67\0\1\175\51\0" +
"\41\103\2\157\21\103\41\161\1\202\1\200\26\161\1\104" + "\1\104\1\102\2\0\1\136\41\104\2\136\21\104\1\105" +
"\1\101\2\0\1\161\41\104\2\161\21\104\41\163\1\203" + "\1\102\2\0\1\141\41\105\2\141\21\105\1\106\1\102" +
"\1\163\1\200\25\163\1\105\1\101\2\0\1\163\41\105" + "\2\0\1\143\41\106\2\143\21\106\41\163\1\176\3\163" +
"\2\163\21\105\41\165\1\204\3\165\1\200\23\165\1\106" + "\1\137\23\163\1\107\1\102\2\0\1\163\41\107\2\163" +
"\1\101\2\0\1\165\41\106\2\165\21\106\15\0\1\205" + "\21\107\15\0\1\177\20\0\1\177\50\0\1\200\52\0" +
"\20\0\1\205\50\0\1\206\52\0\1\157\3\0\65\157" + "\1\163\3\0\65\163\20\0\1\201\67\0\1\201\51\0";
"\1\161\3\0\65\161\1\163\3\0\65\163\1\165\3\0" +
"\65\165\20\0\1\207\67\0\1\207\51\0";
private static int[] zzUnpackTrans() { private static int[] zzUnpackTrans() {
int[] result = new int[5016]; int[] result = new int[4731];
int offset = 0; int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result; return result;
@ -394,14 +392,14 @@ public class _M68kLexer implements FlexLexer {
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 = private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\11\0\2\11\5\1\1\11\6\1\1\11\26\1\2\11" + "\11\0\2\11\5\1\1\11\6\1\1\11\27\1\2\11" +
"\3\1\10\11\4\1\1\11\6\1\1\0\4\1\1\0" + "\3\1\10\11\4\1\1\11\6\1\1\0\4\1\1\0" +
"\3\1\2\11\5\1\1\11\5\1\1\0\1\11\5\0" + "\3\1\2\11\5\1\1\11\5\1\1\0\1\11\5\0" +
"\7\11\2\1\3\0\1\1\1\0\1\1\1\0\1\1" + "\7\11\2\1\2\0\3\1\1\0\1\1\2\0\3\11" +
"\1\0\1\1\2\0\3\11\3\1\2\11\7\0"; "\3\1\1\11\4\0";
private static int[] zzUnpackAttribute() { private static int[] zzUnpackAttribute() {
int[] result = new int[135]; int[] result = new int[129];
int offset = 0; int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result; return result;
@ -724,40 +722,40 @@ public class _M68kLexer implements FlexLexer {
return BAD_CHARACTER; return BAD_CHARACTER;
} }
// fall through // fall through
case 57: case 58:
break; break;
case 2: { case 2: {
return WHITE_SPACE; return WHITE_SPACE;
} }
// fall through // fall through
case 58: case 59:
break; break;
case 3: { case 3: {
yybegin(NOSOL); yybegin(NOSOL);
return WHITE_SPACE; return WHITE_SPACE;
} }
// fall through // fall through
case 59: case 60:
break; break;
case 4: { case 4: {
yybegin(INSTRPART); yybegin(INSTRPART);
return GLOBAL_LABEL_DEF; return GLOBAL_LABEL_DEF;
} }
// fall through // fall through
case 60: case 61:
break; break;
case 5: { case 5: {
return COMMENT; return COMMENT;
} }
// fall through // fall through
case 61: case 62:
break; break;
case 6: { case 6: {
yybegin(YYINITIAL); yybegin(YYINITIAL);
return WHITE_SPACE; return WHITE_SPACE;
} }
// fall through // fall through
case 62: case 63:
break; break;
case 7: { case 7: {
if (isAsmMnemonicWithSize(yytext())) { if (isAsmMnemonicWithSize(yytext())) {
@ -777,315 +775,322 @@ public class _M68kLexer implements FlexLexer {
yybegin(EXPR); yybegin(EXPR);
return OTHER_DIRECTIVE; return OTHER_DIRECTIVE;
} }
yybegin(INSTRPART); yybegin(MACROCALL);
return SYMBOL; return MACRO_INVOKATION;
}
// fall through
case 63:
break;
case 8: {
yybegin(INSTRPART);
return SYMBOL;
} }
// fall through // fall through
case 64: case 64:
break; break;
case 8: {
yybegin(MACROCALL);
return SYMBOL;
}
// fall through
case 65:
break;
case 9: { case 9: {
yybegin(YYINITIAL); yybegin(YYINITIAL);
return COMMENT; return COMMENT;
} }
// fall through // fall through
case 65: case 66:
break; break;
case 10: { case 10: {
yybegin(YYINITIAL); yybegin(YYINITIAL);
return EOL; return EOL;
} }
// fall through // fall through
case 66: case 67:
break; break;
case 11: { case 11: {
return SYMBOL; yybegin(MACROCALL);
return MACRO_INVOKATION;
} }
// fall through // fall through
case 67: case 68:
break; break;
case 12: { case 12: {
yybegin(WAITEOL); yybegin(WAITEOL);
return COMMENT; return COMMENT;
} }
// fall through // fall through
case 68: case 69:
break; break;
case 13: { case 13: {
yybegin(ASMOPS); yybegin(ASMOPS);
return WHITE_SPACE; return WHITE_SPACE;
} }
// fall through // fall through
case 69:
break;
case 14: {
return DECIMAL;
}
// fall through
case 70: case 70:
break; break;
case 15: { case 14: {
return OP_ASSIGN; return SYMBOL;
} }
// fall through // fall through
case 71: case 71:
break; break;
case 16: { case 15: {
return OP_AR_MOD; return DECIMAL;
} }
// fall through // fall through
case 72: case 72:
break; break;
case 17: { case 16: {
return OP_CMP_LT; return OP_ASSIGN;
} }
// fall through // fall through
case 73: case 73:
break; break;
case 18: { case 17: {
return OP_CMP_GT; return OP_AR_MOD;
} }
// fall through // fall through
case 74: case 74:
break; break;
case 19: { case 18: {
return SEPARATOR; return OP_CMP_LT;
} }
// fall through // fall through
case 75: case 75:
break; break;
case 20: { case 19: {
return HASH; return OP_CMP_GT;
} }
// fall through // fall through
case 76: case 76:
break; break;
case 21: { case 20: {
return OP_BITWISE_AND; return SEPARATOR;
} }
// fall through // fall through
case 77: case 77:
break; break;
case 22: { case 21: {
return OP_BITWISE_OR; return HASH;
} }
// fall through // fall through
case 78: case 78:
break; break;
case 23: { case 22: {
return OP_UNARY_NOT; return OP_BITWISE_AND;
} }
// fall through // fall through
case 79: case 79:
break; break;
case 24: { case 23: {
return OP_BITWISE_XOR; return OP_BITWISE_OR;
} }
// fall through // fall through
case 80: case 80:
break; break;
case 25: { case 24: {
return ROUND_L; return OP_UNARY_NOT;
} }
// fall through // fall through
case 81: case 81:
break; break;
case 26: { case 25: {
return ROUND_R; return OP_BITWISE_XOR;
} }
// fall through // fall through
case 82: case 82:
break; break;
case 27: { case 26: {
return OP_UNARY_COMPL; return ROUND_L;
} }
// fall through // fall through
case 83: case 83:
break; break;
case 28: { case 27: {
return OP_PLUS; return ROUND_R;
} }
// fall through // fall through
case 84: case 84:
break; break;
case 29: { case 28: {
return OP_MINUS; return OP_UNARY_COMPL;
} }
// fall through // fall through
case 85: case 85:
break; break;
case 30: { case 29: {
return OP_AR_MUL; return OP_PLUS;
} }
// fall through // fall through
case 86: case 86:
break; break;
case 31: { case 30: {
return OP_AR_DIV; return OP_MINUS;
} }
// fall through // fall through
case 87: case 87:
break; break;
case 32: { case 31: {
yybegin(EXPR); return OP_AR_MUL;
return OP_ASSIGN;
} }
// fall through // fall through
case 88: case 88:
break; break;
case 32: {
return OP_AR_DIV;
}
// fall through
case 89:
break;
case 33: { case 33: {
yybegin(EXPR);
return OP_ASSIGN;
}
// fall through
case 90:
break;
case 34: {
return STRINGLIT;
}
// fall through
case 91:
break;
case 35: {
yybegin(ASSIGNMENT); yybegin(ASSIGNMENT);
yypushback(pushbackAssignment(yytext())); yypushback(pushbackAssignment(yytext()));
return SYMBOLDEF; return SYMBOLDEF;
} }
// fall through // fall through
case 89: case 92:
break; break;
case 34: { case 36: {
yybegin(INSTRPART); yybegin(INSTRPART);
return LOCAL_LABEL_DEF; return LOCAL_LABEL_DEF;
} }
// fall through // fall through
case 90:
break;
case 35: {
return OPSIZE_BS;
}
// fall through
case 91:
break;
case 36: {
return OPSIZE_WL;
}
// fall through
case 92:
break;
case 37: {
return AREG;
}
// fall through
case 93: case 93:
break; break;
case 38: { case 37: {
return REG_SR; return OPSIZE_BS;
} }
// fall through // fall through
case 94: case 94:
break; break;
case 39: { case 38: {
return PC; return OPSIZE_WL;
} }
// fall through // fall through
case 95: case 95:
break; break;
case 40: { case 39: {
return DREG; return AREG;
} }
// fall through // fall through
case 96: case 96:
break; break;
case 41: { case 40: {
return OP_CMP_EQ; return REG_SR;
} }
// fall through // fall through
case 97: case 97:
break; break;
case 42: { case 41: {
return HEXADECIMAL; return PC;
} }
// fall through // fall through
case 98: case 98:
break; break;
case 43: { case 42: {
return BINARY; return DREG;
} }
// fall through // fall through
case 99: case 99:
break; break;
case 44: { case 43: {
return OCTAL; return OP_CMP_EQ;
} }
// fall through // fall through
case 100: case 100:
break; break;
case 45: { case 44: {
return STRINGLIT; return HEXADECIMAL;
} }
// fall through // fall through
case 101: case 101:
break; break;
case 46: { case 45: {
return OP_CMP_LT_EQ; return BINARY;
} }
// fall through // fall through
case 102: case 102:
break; break;
case 47: { case 46: {
return OP_AR_SHIFT_L; return OCTAL;
} }
// fall through // fall through
case 103: case 103:
break; break;
case 48: { case 47: {
return OP_CMP_NOT_EQ; return OP_CMP_LT_EQ;
} }
// fall through // fall through
case 104: case 104:
break; break;
case 49: { case 48: {
return OP_CMP_GT_EQ; return OP_AR_SHIFT_L;
} }
// fall through // fall through
case 105: case 105:
break; break;
case 50: { case 49: {
return OP_AR_SHIFT_R; return OP_CMP_NOT_EQ;
} }
// fall through // fall through
case 106: case 106:
break; break;
case 51: { case 50: {
return OP_LOGICAL_AND; return OP_CMP_GT_EQ;
} }
// fall through // fall through
case 107: case 107:
break; break;
case 52: { case 51: {
return OP_LOGICAL_OR; return OP_AR_SHIFT_R;
} }
// fall through // fall through
case 108: case 108:
break; break;
case 53: { case 52: {
return REG_USP; return OP_LOGICAL_AND;
} }
// fall through // fall through
case 109: case 109:
break; break;
case 54: { case 53: {
return REG_CCR; return OP_LOGICAL_OR;
} }
// fall through // fall through
case 110: case 110:
break; break;
case 55: { case 54: {
return REG_VBR; return REG_USP;
} }
// fall through // fall through
case 111: case 111:
break; break;
case 55: {
return REG_CCR;
}
// fall through
case 112:
break;
case 56: { case 56: {
return REG_VBR;
}
// fall through
case 113:
break;
case 57: {
yybegin(EXPR); yybegin(EXPR);
return EQU; return EQU;
} }
// fall through // fall through
case 112: case 114:
break; break;
default: default:
zzScanError(ZZ_NO_MATCH); zzScanError(ZZ_NO_MATCH);

View File

@ -530,7 +530,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
// AsmInstruction | MacroCall // AsmInstruction | MacroCall
static boolean Instruction(PsiBuilder b, int l) { static boolean Instruction(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "Instruction")) return false; if (!recursion_guard_(b, l, "Instruction")) return false;
if (!nextTokenIs(b, "", MNEMONIC, SYMBOL)) return false; if (!nextTokenIs(b, "", MACRO_INVOKATION, MNEMONIC)) return false;
boolean r; boolean r;
r = AsmInstruction(b, l + 1); r = AsmInstruction(b, l + 1);
if (!r) r = MacroCall(b, l + 1); if (!r) r = MacroCall(b, l + 1);
@ -611,22 +611,22 @@ public class M68kParser implements PsiParser, LightPsiParser {
} }
/* ********************************************************** */ /* ********************************************************** */
// SYMBOL PreprocessorOperands? // MACRO_INVOKATION PlainOperands?
public static boolean MacroCall(PsiBuilder b, int l) { public static boolean MacroCall(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MacroCall")) return false; if (!recursion_guard_(b, l, "MacroCall")) return false;
if (!nextTokenIs(b, SYMBOL)) return false; if (!nextTokenIs(b, MACRO_INVOKATION)) return false;
boolean r; boolean r;
Marker m = enter_section_(b); Marker m = enter_section_(b);
r = consumeToken(b, SYMBOL); r = consumeToken(b, MACRO_INVOKATION);
r = r && MacroCall_1(b, l + 1); r = r && MacroCall_1(b, l + 1);
exit_section_(b, m, MACRO_CALL, r); exit_section_(b, m, MACRO_CALL, r);
return r; return r;
} }
// PreprocessorOperands? // PlainOperands?
private static boolean MacroCall_1(PsiBuilder b, int l) { private static boolean MacroCall_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "MacroCall_1")) return false; if (!recursion_guard_(b, l, "MacroCall_1")) return false;
PreprocessorOperands(b, l + 1); PlainOperands(b, l + 1);
return true; return true;
} }
@ -643,6 +643,40 @@ public class M68kParser implements PsiParser, LightPsiParser {
return r; return r;
} }
/* ********************************************************** */
// STRINGLIT (SEPARATOR STRINGLIT)*
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 = r && PlainOperands_1(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// (SEPARATOR STRINGLIT)*
private static boolean PlainOperands_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "PlainOperands_1")) return false;
while (true) {
int c = current_position_(b);
if (!PlainOperands_1_0(b, l + 1)) break;
if (!empty_element_parsed_guard_(b, "PlainOperands_1", c)) break;
}
return true;
}
// SEPARATOR STRINGLIT
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);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */ /* ********************************************************** */
// Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE) // Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE)
// PreprocessorOperands? // PreprocessorOperands?

View File

@ -2,13 +2,7 @@
package de.platon42.intellij.plugins.m68k.psi; package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public interface M68kMacroCall extends PsiElement { public interface M68kMacroCall extends PsiElement {
@NotNull
List<M68kExpr> getExprList();
} }

View File

@ -81,6 +81,7 @@ public interface M68kTypes {
IElementType HASH = new M68kTokenType("HASH"); IElementType HASH = new M68kTokenType("HASH");
IElementType HEXADECIMAL = new M68kTokenType("HEXADECIMAL"); IElementType HEXADECIMAL = new M68kTokenType("HEXADECIMAL");
IElementType LOCAL_LABEL_DEF = new M68kTokenType("LOCAL_LABEL_DEF"); IElementType LOCAL_LABEL_DEF = new M68kTokenType("LOCAL_LABEL_DEF");
IElementType MACRO_INVOKATION = new M68kTokenType("MACRO_INVOKATION");
IElementType MNEMONIC = new M68kTokenType("MNEMONIC"); IElementType MNEMONIC = new M68kTokenType("MNEMONIC");
IElementType OCTAL = new M68kTokenType("OCTAL"); IElementType OCTAL = new M68kTokenType("OCTAL");
IElementType OPSIZE_BS = new M68kTokenType("OPSIZE_BS"); IElementType OPSIZE_BS = new M68kTokenType("OPSIZE_BS");

View File

@ -4,14 +4,10 @@ package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement; import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import de.platon42.intellij.plugins.m68k.psi.M68kExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall; import de.platon42.intellij.plugins.m68k.psi.M68kMacroCall;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor; import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List;
public class M68kMacroCallImpl extends ASTWrapperPsiElement implements M68kMacroCall { public class M68kMacroCallImpl extends ASTWrapperPsiElement implements M68kMacroCall {
public M68kMacroCallImpl(@NotNull ASTNode node) { public M68kMacroCallImpl(@NotNull ASTNode node) {
@ -28,10 +24,4 @@ public class M68kMacroCallImpl extends ASTWrapperPsiElement implements M68kMacro
else super.accept(visitor); else super.accept(visitor);
} }
@Override
@NotNull
public List<M68kExpr> getExprList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, M68kExpr.class);
}
} }

View File

@ -29,7 +29,7 @@ object AssemblerDirectives {
//"iif" // not supported //"iif" // not supported
"else", "endif", "endc", "else", "endif", "endc",
"macro", "exitm", "mexit", "macro", "exitm", "mexit", "endm",
"extern", "nref", "xdef", "xref", "globl", "public", "weak", "extern", "nref", "xdef", "xref", "globl", "public", "weak",

View File

@ -70,10 +70,10 @@ HASH_COMMENT=([#;*].*+)
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
if(isDataDirective(yytext())) { yybegin(EXPR); return DATA_DIRECTIVE; } if(isDataDirective(yytext())) { yybegin(EXPR); return DATA_DIRECTIVE; }
if(isOtherDirective(yytext())) { yybegin(EXPR); return OTHER_DIRECTIVE; } if(isOtherDirective(yytext())) { yybegin(EXPR); return OTHER_DIRECTIVE; }
yybegin(INSTRPART); return SYMBOL; yybegin(MACROCALL); return MACRO_INVOKATION;
} }
// {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { yybegin(INSTRPART); return SYMBOL; } } // {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { yybegin(INSTRPART); return SYMBOL; } }
{SYMBOL} { yybegin(INSTRPART); return SYMBOL; } {SYMBOL} { yybegin(MACROCALL); return SYMBOL; }
{HASH_COMMENT} { yybegin(YYINITIAL); return COMMENT; } {HASH_COMMENT} { yybegin(YYINITIAL); return COMMENT; }
} }
@ -86,10 +86,10 @@ HASH_COMMENT=([#;*].*+)
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
if(isDataDirective(yytext())) { yybegin(EXPR); return DATA_DIRECTIVE; } if(isDataDirective(yytext())) { yybegin(EXPR); return DATA_DIRECTIVE; }
if(isOtherDirective(yytext())) { yybegin(EXPR); return OTHER_DIRECTIVE; } if(isOtherDirective(yytext())) { yybegin(EXPR); return OTHER_DIRECTIVE; }
yybegin(INSTRPART); return SYMBOL; yybegin(MACROCALL); return MACRO_INVOKATION;
} }
// {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { return SYMBOL; } } // {MNEMONIC} { if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; } else { return SYMBOL; } }
{SYMBOL} { return SYMBOL; } {SYMBOL} { yybegin(MACROCALL); return MACRO_INVOKATION; }
{COMMENT} { yybegin(WAITEOL); return COMMENT; } {COMMENT} { yybegin(WAITEOL); return COMMENT; }
} }
@ -112,7 +112,7 @@ HASH_COMMENT=([#;*].*+)
"," { return SEPARATOR; } "," { return SEPARATOR; }
{PLAINPARAM} { return SYMBOL; } {PLAINPARAM} { return STRINGLIT; }
} }
<ASSIGNMENT> { <ASSIGNMENT> {

View File

@ -147,7 +147,7 @@ AsmOp ::= MNEMONIC OperandSize?
PreprocessorDirective ::= Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE) PreprocessorDirective ::= Label? (DATA_DIRECTIVE | OTHER_DIRECTIVE)
PreprocessorOperands? PreprocessorOperands?
MacroCall ::= SYMBOL PreprocessorOperands? MacroCall ::= MACRO_INVOKATION PlainOperands?
AsmInstruction ::= AsmOp AsmOperands? AsmInstruction ::= AsmOp AsmOperands?
private Instruction ::= AsmInstruction | MacroCall private Instruction ::= AsmInstruction | MacroCall
//external Instruction ::= parseMacroCallOrAsmInstruction //external Instruction ::= parseMacroCallOrAsmInstruction
@ -155,9 +155,10 @@ private Instruction ::= AsmInstruction | MacroCall
private AsmOperands ::= AddressingMode (SEPARATOR AddressingMode)? private AsmOperands ::= AddressingMode (SEPARATOR AddressingMode)?
private PreprocessorOperands ::= PreprocessorOperand (SEPARATOR PreprocessorOperand)* private PreprocessorOperands ::= PreprocessorOperand (SEPARATOR PreprocessorOperand)*
private PreprocessorOperand ::= expr private PreprocessorOperand ::= expr
private PlainOperands ::= STRINGLIT (SEPARATOR STRINGLIT)*
DataRegister ::= DREG {extends=Register} DataRegister ::= DREG {extends=Register}
AddressRegister ::= AREG {extends=Register} AddressRegister ::= AREG {extends=Register}
SpecialRegister ::= REG_CCR | REG_SR | REG_USP | REG_VBR {extends=Register} SpecialRegister ::= REG_CCR | REG_SR | REG_USP | REG_VBR {extends=Register}

View File

@ -10,17 +10,20 @@ import de.platon42.intellij.plugins.m68k.M68kIcons.FILE
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.AREG import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.AREG
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.BAD_CHARACTER import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.BAD_CHARACTER
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.COMMENT import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.COMMENT
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.DATA_PREPROCESSOR
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.DATA_WIDTH
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.DREG import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.DREG
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.GLOBAL_LABEL import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.GLOBAL_LABEL
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.KEYWORD
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.LOCAL_LABEL import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.LOCAL_LABEL
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.MACRO_CALL
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.MNEMONIC import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.MNEMONIC
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.NUMBER import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.NUMBER
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.PREPROCESSOR import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.OTHER_PREPROCESSOR
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SEPARATOR import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SEPARATOR
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SPECIAL_REG import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SPECIAL_REG
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.STRING import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.STRING
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SYMBOL import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SYMBOL
import de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighter.Companion.SYMBOLDEF
import org.jetbrains.annotations.NonNls import org.jetbrains.annotations.NonNls
import javax.swing.Icon import javax.swing.Icon
@ -54,6 +57,9 @@ demo_init ; global label
dbra d7,.loop dbra d7,.loop
POPM POPM
rts rts
hello: dc.b 'Hello World!',10,0
even
""" """
} }
@ -75,19 +81,22 @@ demo_init ; global label
companion object { companion object {
private val DESCRIPTORS = arrayOf( private val DESCRIPTORS = arrayOf(
AttributesDescriptor("SEPARATOR", SEPARATOR), AttributesDescriptor("Global labels", GLOBAL_LABEL),
AttributesDescriptor("GLOBAL_LABEL", GLOBAL_LABEL), AttributesDescriptor("Local labels", LOCAL_LABEL),
AttributesDescriptor("LOCAL_LABEL", LOCAL_LABEL), AttributesDescriptor("Comma (separator)", SEPARATOR),
AttributesDescriptor("SYMBOL", SYMBOL), AttributesDescriptor("Symbol definition", SYMBOLDEF),
AttributesDescriptor("MNEMONIC", MNEMONIC), AttributesDescriptor("Symbol reference", SYMBOL),
AttributesDescriptor("KEYWORD", KEYWORD), AttributesDescriptor("Assembly mnemonic", MNEMONIC),
AttributesDescriptor("PREPROCESSOR", PREPROCESSOR), AttributesDescriptor("Macro invocation", MACRO_CALL),
AttributesDescriptor("STRING", STRING), AttributesDescriptor("Data/address width", DATA_WIDTH),
AttributesDescriptor("NUMBER", NUMBER), AttributesDescriptor("Data preprocessor directives", DATA_PREPROCESSOR),
AttributesDescriptor("AREG", AREG), AttributesDescriptor("Other preprocessor directives", OTHER_PREPROCESSOR),
AttributesDescriptor("DREG", DREG), AttributesDescriptor("Strings", STRING),
AttributesDescriptor("SPECIAL_REG", SPECIAL_REG), AttributesDescriptor("Numbers", NUMBER),
AttributesDescriptor("COMMENT", COMMENT), AttributesDescriptor("Address registers", AREG),
AttributesDescriptor("BAD_CHARACTER", BAD_CHARACTER)) AttributesDescriptor("Data registers", DREG),
AttributesDescriptor("Special registers", SPECIAL_REG),
AttributesDescriptor("Comments", COMMENT),
AttributesDescriptor("Bad characters", BAD_CHARACTER))
} }
} }

View File

@ -19,14 +19,17 @@ class M68kSyntaxHighlighter : SyntaxHighlighterBase() {
return when (tokenType) { return when (tokenType) {
M68kTypes.SEPARATOR -> arrayOf(SEPARATOR) M68kTypes.SEPARATOR -> arrayOf(SEPARATOR)
M68kTypes.GLOBAL_LABEL_DEF, M68kTypes.GLOBAL_LABEL -> arrayOf(GLOBAL_LABEL) M68kTypes.GLOBAL_LABEL_DEF, M68kTypes.GLOBAL_LABEL -> arrayOf(GLOBAL_LABEL)
M68kTypes.LOCAL_LABEL_DEF, M68kTypes.LOCAL_LABEL_DEF -> arrayOf(LOCAL_LABEL) M68kTypes.LOCAL_LABEL_DEF, M68kTypes.LOCAL_LABEL -> arrayOf(LOCAL_LABEL)
M68kTypes.SYMBOLDEF, M68kTypes.SYMBOL -> arrayOf(SYMBOL) M68kTypes.SYMBOLDEF -> arrayOf(SYMBOLDEF)
M68kTypes.MNEMONIC, M68kTypes.ASM_OP -> arrayOf(MNEMONIC) M68kTypes.SYMBOL -> arrayOf(SYMBOL)
M68kTypes.OPERAND_SIZE, M68kTypes.DATA_WIDTH, M68kTypes.ADDRESS_SIZE -> arrayOf(MNEMONIC) M68kTypes.MNEMONIC -> arrayOf(MNEMONIC)
M68kTypes.MACRO_INVOKATION -> arrayOf(MACRO_CALL)
M68kTypes.DATA_DIRECTIVE -> arrayOf(DATA_PREPROCESSOR)
M68kTypes.OTHER_DIRECTIVE -> arrayOf(OTHER_PREPROCESSOR)
M68kTypes.OPSIZE_BS, M68kTypes.OPSIZE_WL -> arrayOf(DATA_WIDTH)
M68kTypes.ADDRESS_REGISTER, M68kTypes.AREG -> arrayOf(AREG) M68kTypes.ADDRESS_REGISTER, M68kTypes.AREG -> arrayOf(AREG)
M68kTypes.DATA_REGISTER, M68kTypes.DREG -> arrayOf(DREG) M68kTypes.DATA_REGISTER, M68kTypes.DREG -> arrayOf(DREG)
M68kTypes.SPECIAL_REGISTER, M68kTypes.REG_USP, M68kTypes.REG_SR, M68kTypes.REG_CCR -> arrayOf(SPECIAL_REG) M68kTypes.SPECIAL_REGISTER, M68kTypes.REG_USP, M68kTypes.REG_SR, M68kTypes.REG_CCR -> arrayOf(SPECIAL_REG)
M68kTypes.PREPROCESSOR_DIRECTIVE -> arrayOf(PREPROCESSOR)
M68kTypes.COMMENT -> arrayOf(COMMENT) M68kTypes.COMMENT -> arrayOf(COMMENT)
M68kTypes.DECIMAL, M68kTypes.HEXADECIMAL, M68kTypes.OCTAL -> arrayOf(NUMBER) M68kTypes.DECIMAL, M68kTypes.HEXADECIMAL, M68kTypes.OCTAL -> arrayOf(NUMBER)
M68kTypes.STRINGLIT -> arrayOf(STRING) M68kTypes.STRINGLIT -> arrayOf(STRING)
@ -36,18 +39,21 @@ class M68kSyntaxHighlighter : SyntaxHighlighterBase() {
} }
companion object { companion object {
val SEPARATOR = TextAttributesKey.createTextAttributesKey("M68K_SEPARATOR", DefaultLanguageHighlighterColors.COMMA)
val GLOBAL_LABEL = TextAttributesKey.createTextAttributesKey("M68K_LOCAL_LABEL", DefaultLanguageHighlighterColors.LOCAL_VARIABLE) val GLOBAL_LABEL = TextAttributesKey.createTextAttributesKey("M68K_LOCAL_LABEL", DefaultLanguageHighlighterColors.LOCAL_VARIABLE)
val LOCAL_LABEL = TextAttributesKey.createTextAttributesKey("M68K_GLOBAL_LABEL", DefaultLanguageHighlighterColors.GLOBAL_VARIABLE) val LOCAL_LABEL = TextAttributesKey.createTextAttributesKey("M68K_GLOBAL_LABEL", DefaultLanguageHighlighterColors.GLOBAL_VARIABLE)
val SEPARATOR = TextAttributesKey.createTextAttributesKey("M68K_SEPARATOR", DefaultLanguageHighlighterColors.COMMA)
val SYMBOLDEF = TextAttributesKey.createTextAttributesKey("M68K_SYMBOLDEF", DefaultLanguageHighlighterColors.STATIC_FIELD)
val SYMBOL = TextAttributesKey.createTextAttributesKey("M68K_SYMBOL", DefaultLanguageHighlighterColors.IDENTIFIER) val SYMBOL = TextAttributesKey.createTextAttributesKey("M68K_SYMBOL", DefaultLanguageHighlighterColors.IDENTIFIER)
val MNEMONIC = TextAttributesKey.createTextAttributesKey("M68K_MNEMONIC", DefaultLanguageHighlighterColors.FUNCTION_CALL) val MNEMONIC = TextAttributesKey.createTextAttributesKey("M68K_MNEMONIC", DefaultLanguageHighlighterColors.FUNCTION_CALL)
val KEYWORD = TextAttributesKey.createTextAttributesKey("M68K_KEYWORD", DefaultLanguageHighlighterColors.KEYWORD) val MACRO_CALL = TextAttributesKey.createTextAttributesKey("M68K_MACRO_CALL", DefaultLanguageHighlighterColors.STATIC_METHOD)
val PREPROCESSOR = TextAttributesKey.createTextAttributesKey("M68K_PREPROCESSOR", DefaultLanguageHighlighterColors.KEYWORD) val DATA_WIDTH = TextAttributesKey.createTextAttributesKey("M68K_DATA_WIDTH", DefaultLanguageHighlighterColors.INSTANCE_METHOD)
val DATA_PREPROCESSOR = TextAttributesKey.createTextAttributesKey("M68K_DATA_PREPROCESSOR", DefaultLanguageHighlighterColors.CONSTANT)
val OTHER_PREPROCESSOR = TextAttributesKey.createTextAttributesKey("M68K_OTHER_PREPROCESSOR", DefaultLanguageHighlighterColors.KEYWORD)
val STRING = TextAttributesKey.createTextAttributesKey("M68K_STRING", DefaultLanguageHighlighterColors.STRING) val STRING = TextAttributesKey.createTextAttributesKey("M68K_STRING", DefaultLanguageHighlighterColors.STRING)
val NUMBER = TextAttributesKey.createTextAttributesKey("M68K_NUMBER", DefaultLanguageHighlighterColors.NUMBER) val NUMBER = TextAttributesKey.createTextAttributesKey("M68K_NUMBER", DefaultLanguageHighlighterColors.NUMBER)
val AREG = TextAttributesKey.createTextAttributesKey("M68K_AREG", DefaultLanguageHighlighterColors.CONSTANT) val AREG = TextAttributesKey.createTextAttributesKey("M68K_AREG", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL)
val DREG = TextAttributesKey.createTextAttributesKey("M68K_DREG", DefaultLanguageHighlighterColors.CONSTANT) val DREG = TextAttributesKey.createTextAttributesKey("M68K_DREG", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL)
val SPECIAL_REG = TextAttributesKey.createTextAttributesKey("M68K_SPECIALREG", DefaultLanguageHighlighterColors.CONSTANT) val SPECIAL_REG = TextAttributesKey.createTextAttributesKey("M68K_SPECIALREG", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL)
val COMMENT = TextAttributesKey.createTextAttributesKey("M68K_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT) val COMMENT = TextAttributesKey.createTextAttributesKey("M68K_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT)
val BAD_CHARACTER = TextAttributesKey.createTextAttributesKey("M68K_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER) val BAD_CHARACTER = TextAttributesKey.createTextAttributesKey("M68K_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER)
} }

View File

@ -0,0 +1,31 @@
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 org.junit.jupiter.api.Test
@TestDataSubPath("macros")
internal class MacroCallTest : AbstractParsingTest() {
@Test
internal fun standard_macrocall_without_parameters(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " BLTHOGON\n")
}
@Test
internal fun call_with_complex_parameters(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " COPIMOVE (3<<0)|(3<<3)|(1<<6),bplcon2\n")
}
@Test
internal fun pushm_call_with_register_list(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, " PUSHM d0/d3/d5-d7/a0-a2/a4-a6 ; save a couple of registers\n")
}
@Test
internal fun putmsg_call_with_specially_bracketed_parameters(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
// FIXME this doesn't work as intended...
testGoodSyntax(testCase, "\tPUTMSG 10,<\"%s has left the building at %d:%d\",10,'Yup!'>,a0,$42(a1,d0.w),#42\n")
}
}

View File

@ -1,6 +1,5 @@
Assembly File: a.asm Assembly File: a.asm
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT) PsiErrorElement:'.local_label' unexpected
M68kMacroCallImpl(MACRO_CALL) PsiElement(M68kTokenType.SYMBOL)('.local_label')
PsiElement(M68kTokenType.SYMBOL)('.local_label')
PsiElement(M68kTokenType.EOL)('\n') PsiElement(M68kTokenType.EOL)('\n')

View File

@ -1,6 +1,5 @@
Assembly File: a.asm Assembly File: a.asm
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT) PsiErrorElement:'local_label$' unexpected
M68kMacroCallImpl(MACRO_CALL) PsiElement(M68kTokenType.SYMBOL)('local_label$')
PsiElement(M68kTokenType.SYMBOL)('local_label$')
PsiElement(M68kTokenType.EOL)('\n') PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,10 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kMacroCallImpl(MACRO_CALL)
PsiElement(M68kTokenType.MACRO_INVOKATION)('COPIMOVE')
PsiWhiteSpace(' ')
PsiElement(M68kTokenType.STRINGLIT)('(3<<0)|(3<<3)|(1<<6)')
PsiElement(M68kTokenType.SEPARATOR)(',')
PsiElement(M68kTokenType.STRINGLIT)('bplcon2')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,10 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kMacroCallImpl(MACRO_CALL)
PsiElement(M68kTokenType.MACRO_INVOKATION)('PUSHM')
PsiWhiteSpace(' ')
PsiElement(M68kTokenType.STRINGLIT)('d0/d3/d5-d7/a0-a2/a4-a6')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; save a couple of registers')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,18 @@
Assembly File: a.asm
PsiWhiteSpace('\t')
M68kStatementImpl(STATEMENT)
M68kMacroCallImpl(MACRO_CALL)
PsiElement(M68kTokenType.MACRO_INVOKATION)('PUTMSG')
PsiWhiteSpace(' ')
PsiElement(M68kTokenType.STRINGLIT)('10')
PsiElement(M68kTokenType.SEPARATOR)(',')
PsiElement(M68kTokenType.STRINGLIT)('<"%s has left the building at %d:%d",10,'Yup!'>')
PsiElement(M68kTokenType.SEPARATOR)(',')
PsiElement(M68kTokenType.STRINGLIT)('a0')
PsiElement(M68kTokenType.SEPARATOR)(',')
PsiElement(M68kTokenType.STRINGLIT)('$42(a1')
PsiElement(M68kTokenType.SEPARATOR)(',')
PsiElement(M68kTokenType.STRINGLIT)('d0.w)')
PsiElement(M68kTokenType.SEPARATOR)(',')
PsiElement(M68kTokenType.STRINGLIT)('#42')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -0,0 +1,6 @@
Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kMacroCallImpl(MACRO_CALL)
PsiElement(M68kTokenType.MACRO_INVOKATION)('BLTHOGON')
PsiElement(M68kTokenType.EOL)('\n')