Reworked label handling: Colons are no longer part of the label definition itself. Added PsiNamedElement for Labels.

This commit is contained in:
Chris Hodges 2021-07-17 10:18:36 +02:00
parent 14dd7de763
commit 63c38f68c3
30 changed files with 520 additions and 250 deletions

View File

@ -192,23 +192,22 @@ public class _M68kLexer implements FlexLexer {
private static final String ZZ_ACTION_PACKED_0 =
"\13\0\1\1\2\2\1\3\1\4\1\1\1\5\2\6" +
"\1\2\1\7\1\10\1\1\1\11\2\12\1\7\1\10" +
"\1\13\1\14\1\1\1\15\1\16\5\15\6\1\1\17" +
"\1\13\1\14\1\15\1\1\1\16\1\17\5\16\6\1" +
"\1\20\1\21\1\22\1\23\1\24\1\25\1\26\1\27" +
"\1\30\2\15\1\31\1\32\1\31\1\33\1\34\1\35" +
"\1\30\1\31\2\16\1\32\1\33\1\32\1\34\1\35" +
"\1\36\1\37\1\40\1\41\1\42\1\43\1\44\1\45" +
"\1\46\1\47\1\42\1\50\1\1\1\51\1\1\1\52" +
"\1\53\1\54\6\1\1\55\1\56\1\57\1\60\1\61" +
"\1\62\1\63\1\64\1\65\1\66\1\67\1\70\1\71" +
"\1\72\1\73\1\66\1\74\1\75\1\12\4\75\1\0" +
"\1\4\1\76\2\77\1\4\3\0\1\100\1\101\1\102" +
"\1\103\1\104\1\105\1\106\1\15\1\107\1\110\1\111" +
"\2\0\1\112\4\0\2\15\1\32\1\100\1\101\1\102" +
"\1\113\1\114\1\115\1\116\1\117\1\120\1\121\2\0" +
"\1\122\1\123\1\124\2\0\1\125\4\0\1\57\1\126" +
"\1\127\1\130\1\131\1\132\1\133\1\134\1\0\1\75" +
"\1\0\1\75\1\0\1\75\1\0\1\75\2\0\1\4" +
"\1\77\1\7\1\135\1\136\1\137\1\140\1\0\1\75" +
"\6\0";
"\1\46\1\47\1\50\1\43\1\51\2\1\1\52\1\53" +
"\1\54\6\1\1\55\1\56\1\57\1\60\1\61\1\62" +
"\1\63\1\64\1\65\1\66\1\67\1\70\1\71\1\72" +
"\1\73\1\66\1\74\1\75\1\12\4\75\1\0\1\4" +
"\1\76\2\77\1\4\3\0\1\100\1\101\1\102\1\103" +
"\1\104\1\105\1\106\1\16\1\107\1\110\1\111\2\0" +
"\1\112\4\0\2\16\1\33\1\100\1\101\1\102\1\113" +
"\1\114\1\115\1\116\1\117\1\120\1\121\2\0\1\122" +
"\1\123\1\124\2\0\1\125\4\0\1\57\1\126\1\127" +
"\1\130\1\131\1\132\1\133\1\134\1\0\1\75\1\0" +
"\1\75\1\0\1\75\1\0\1\75\2\0\1\4\1\77" +
"\1\7\1\135\1\136\1\137\1\140\1\0\1\75\6\0";
private static int[] zzUnpackAction() {
int[] result = new int[195];
@ -239,13 +238,13 @@ public class _M68kLexer implements FlexLexer {
"\0\0\0\72\0\164\0\256\0\350\0\u0122\0\u015c\0\u0196" +
"\0\u01d0\0\u020a\0\u0244\0\u027e\0\u027e\0\u02b8\0\u02f2\0\u032c" +
"\0\u0366\0\u03a0\0\u027e\0\u03da\0\u0414\0\u044e\0\u0488\0\u04c2" +
"\0\u04fc\0\u027e\0\u0536\0\u0570\0\u05aa\0\u05e4\0\u061e\0\u0658" +
"\0\u0692\0\u06cc\0\u0706\0\u0740\0\u077a\0\u07b4\0\u07ee\0\u0828" +
"\0\u0862\0\u089c\0\u08d6\0\u0910\0\u094a\0\u027e\0\u027e\0\u027e" +
"\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u0984" +
"\0\u09be\0\u09f8\0\u0a32\0\u0a6c\0\u027e\0\u0aa6\0\u0ae0\0\u027e" +
"\0\u027e\0\u027e\0\u027e\0\u0b1a\0\u027e\0\u027e\0\u027e\0\u027e" +
"\0\u0b54\0\u0b8e\0\u0bc8\0\u0c02\0\u027e\0\u0c3c\0\u027e\0\u0c76" +
"\0\u04fc\0\u027e\0\u0536\0\u0570\0\u05aa\0\u027e\0\u05e4\0\u061e" +
"\0\u0658\0\u0692\0\u06cc\0\u0706\0\u0740\0\u077a\0\u07b4\0\u07ee" +
"\0\u0828\0\u0862\0\u089c\0\u08d6\0\u0910\0\u094a\0\u027e\0\u027e" +
"\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e" +
"\0\u0984\0\u09be\0\u09f8\0\u0a32\0\u0a6c\0\u027e\0\u0aa6\0\u0ae0" +
"\0\u027e\0\u027e\0\u027e\0\u027e\0\u0b1a\0\u027e\0\u027e\0\u027e" +
"\0\u027e\0\u0b54\0\u0b8e\0\u0bc8\0\u0c02\0\u0c3c\0\u027e\0\u0c76" +
"\0\u0cb0\0\u0cea\0\u0d24\0\u0d5e\0\u0d98\0\u0dd2\0\u0e0c\0\u027e" +
"\0\u027e\0\u0e46\0\u027e\0\u0e80\0\u0eba\0\u027e\0\u027e\0\u027e" +
"\0\u0ef4\0\u027e\0\u027e\0\u027e\0\u027e\0\u0f2e\0\u0f68\0\u0fa2" +
@ -292,113 +291,113 @@ public class _M68kLexer implements FlexLexer {
"\2\23\1\24\1\25\1\26\1\14\4\26\1\27\2\14" +
"\4\26\1\14\1\30\2\14\4\26\2\14\3\26\1\14" +
"\1\26\7\14\2\31\7\14\1\31\3\14\5\26\1\14" +
"\2\32\1\33\1\25\1\34\1\14\4\34\1\35\2\14" +
"\4\34\4\14\4\34\2\14\3\34\1\14\1\34\7\14" +
"\1\36\14\14\5\34\1\14\2\32\1\33\1\37\16\14" +
"\1\40\24\14\1\36\22\14\2\32\1\33\1\25\1\41" +
"\1\42\1\43\1\44\1\45\2\46\2\14\2\46\1\47" +
"\1\46\1\14\1\46\1\50\1\14\1\43\3\46\1\51" +
"\1\42\1\41\1\45\1\46\1\42\1\46\1\52\1\53" +
"\1\54\1\55\2\14\1\56\1\36\1\57\1\60\1\61" +
"\1\62\1\63\1\64\1\65\1\66\1\67\3\14\2\70" +
"\1\46\1\71\1\46\1\14\2\32\1\33\1\25\1\72" +
"\1\14\5\72\2\14\4\72\1\73\1\74\2\14\4\72" +
"\1\75\1\14\3\72\1\14\1\72\4\14\1\76\1\77" +
"\1\100\1\36\1\14\1\101\1\102\1\103\1\104\1\105" +
"\1\106\1\107\1\110\1\111\1\112\1\113\5\72\1\14" +
"\2\32\1\33\1\25\2\14\1\114\5\14\1\115\1\116" +
"\3\14\1\117\3\14\1\114\11\14\1\116\7\14\1\36" +
"\22\14\2\32\1\33\1\25\1\120\1\121\5\120\2\14" +
"\4\120\1\14\1\120\1\122\1\14\4\120\1\123\1\121" +
"\3\120\1\121\1\120\1\124\1\125\1\126\1\127\2\14" +
"\1\56\1\36\1\14\1\60\1\61\1\130\1\63\1\64" +
"\1\65\1\66\1\131\3\14\5\120\1\14\2\32\1\33" +
"\1\25\15\14\1\132\7\14\1\133\12\14\1\134\1\135" +
"\1\136\1\36\1\14\1\137\1\140\1\103\1\141\1\142" +
"\1\143\1\144\1\145\1\146\1\147\1\150\5\14\1\151" +
"\1\152\1\32\1\33\1\25\35\151\1\153\1\154\1\155" +
"\1\156\1\151\1\56\1\36\21\151\1\14\2\32\1\33" +
"\66\14\74\0\1\15\73\0\1\17\71\0\1\157\10\20" +
"\1\160\4\20\1\161\1\0\1\162\1\0\4\20\1\0" +
"\6\20\24\0\5\20\5\0\1\163\1\0\5\163\2\0" +
"\4\163\4\0\4\163\2\0\3\163\1\0\1\163\24\0" +
"\5\163\1\22\3\0\66\22\2\0\1\23\73\0\1\25" +
"\72\0\1\26\1\27\4\26\2\27\1\164\4\26\1\0" +
"\1\165\1\166\1\0\4\26\1\0\1\27\3\26\1\27" +
"\1\26\24\0\5\26\5\0\10\27\1\164\4\27\2\0" +
"\1\166\1\0\4\27\1\0\6\27\24\0\5\27\5\0" +
"\1\167\1\0\5\167\2\0\4\167\4\0\4\167\2\0" +
"\3\167\1\0\1\167\24\0\5\167\1\31\3\0\66\31" +
"\2\0\1\32\74\0\1\34\1\35\4\34\2\35\1\0" +
"\4\34\1\0\1\165\2\0\4\34\1\0\1\35\3\34" +
"\1\35\1\34\24\0\5\34\5\0\10\35\1\0\4\35" +
"\4\0\4\35\1\0\6\35\24\0\5\35\1\36\3\0" +
"\66\36\4\0\1\37\113\0\2\170\1\171\1\172\45\0" +
"\1\46\1\173\6\46\1\0\4\46\2\0\1\46\1\0" +
"\4\46\1\0\1\173\5\46\24\0\5\46\6\0\1\42" +
"\24\0\1\42\3\0\1\42\37\0\3\46\1\173\4\46" +
"\1\0\4\46\2\0\1\46\1\0\4\46\1\0\6\46" +
"\24\0\2\46\1\174\2\46\5\0\10\46\1\0\4\46" +
"\2\0\1\46\1\0\4\46\1\0\6\46\24\0\2\175" +
"\3\46\5\0\1\46\1\176\6\46\1\0\4\46\2\0" +
"\1\46\1\0\4\46\1\0\1\176\5\46\24\0\5\46" +
"\5\0\10\46\1\0\4\46\2\0\1\46\1\0\4\46" +
"\1\0\6\46\24\0\5\46\5\0\2\46\1\177\5\46" +
"\1\0\4\46\2\0\1\46\1\0\1\177\3\46\1\0" +
"\6\46\24\0\5\46\6\0\1\200\20\0\1\200\3\0" +
"\6\200\25\0\1\200\36\0\1\201\44\0\1\202\24\0" +
"\1\202\36\0\2\203\2\0\21\203\1\204\14\203\1\205" +
"\27\203\2\206\2\0\21\206\1\207\15\206\1\205\26\206" +
"\2\210\2\0\21\210\1\211\16\210\1\205\25\210\5\0" +
"\10\46\1\0\4\46\2\0\1\46\1\0\4\46\1\0" +
"\6\46\24\0\2\212\3\46\5\0\10\46\1\0\4\46" +
"\2\0\1\46\1\0\1\46\1\213\2\46\1\0\6\46" +
"\24\0\4\46\1\213\5\0\10\72\1\0\4\72\2\0" +
"\1\72\1\0\4\72\1\0\6\72\24\0\5\72\22\0" +
"\1\214\54\0\10\72\1\0\4\72\2\0\1\72\1\0" +
"\2\215\1\216\1\217\1\0\6\72\24\0\5\72\22\0" +
"\1\220\22\0\1\221\1\222\45\0\1\223\23\0\1\224" +
"\45\0\1\222\131\0\1\225\72\0\1\226\72\0\1\75" +
"\23\0\1\227\21\0\1\227\50\0\1\230\57\0\10\120" +
"\1\0\4\120\1\0\7\120\1\0\6\120\24\0\5\120" +
"\6\0\1\121\24\0\1\121\3\0\1\121\40\0\1\231" +
"\20\0\1\231\3\0\6\231\25\0\1\231\36\0\1\232" +
"\44\0\1\233\24\0\1\233\36\0\2\234\2\0\21\234" +
"\1\235\14\234\1\236\27\234\2\237\2\0\21\237\1\240" +
"\15\237\1\236\26\237\2\241\2\0\21\241\1\242\16\241" +
"\1\236\25\241\22\0\1\243\71\0\1\244\22\0\1\245" +
"\1\246\45\0\1\247\23\0\1\250\45\0\1\246\131\0" +
"\1\251\72\0\1\252\72\0\1\133\5\0\2\151\3\0" +
"\42\151\2\0\21\151\2\153\2\0\1\253\20\153\1\254" +
"\14\153\1\151\4\153\2\253\21\153\2\154\2\0\1\255" +
"\20\154\1\256\15\154\1\151\3\154\2\255\21\154\2\155" +
"\2\0\1\257\20\155\1\260\16\155\1\151\2\155\2\257" +
"\21\155\2\156\2\0\1\261\20\156\1\262\20\156\1\151" +
"\2\261\21\156\4\0\1\157\2\0\1\263\6\0\1\264" +
"\3\0\1\161\3\0\1\263\11\0\1\264\35\0\1\157" +
"\10\0\1\265\4\0\1\161\53\0\1\161\102\0\1\266" +
"\61\0\10\163\1\266\4\163\4\0\4\163\1\0\6\163" +
"\24\0\5\163\15\0\1\265\54\0\1\267\3\0\66\267" +
"\5\0\10\167\1\266\4\167\4\0\4\167\1\0\6\167" +
"\24\0\5\167\5\0\3\46\1\270\4\46\1\0\4\46" +
"\2\0\1\46\1\0\4\46\1\0\6\46\24\0\5\46" +
"\1\203\3\0\66\203\1\206\3\0\66\206\1\210\3\0" +
"\66\210\5\0\10\46\1\0\4\46\2\0\1\46\1\0" +
"\4\46\1\0\6\46\24\0\2\46\1\271\2\46\5\0" +
"\10\46\1\0\4\46\2\0\1\46\1\0\4\46\1\0" +
"\6\46\24\0\2\46\1\272\2\46\21\0\1\273\70\0" +
"\1\273\51\0\1\234\3\0\66\234\1\237\3\0\66\237" +
"\1\241\3\0\66\241\2\253\2\0\21\253\1\274\14\253" +
"\1\275\27\253\1\153\1\151\2\0\1\253\42\153\2\253" +
"\21\153\2\255\2\0\21\255\1\276\15\255\1\275\26\255" +
"\1\154\1\151\2\0\1\255\42\154\2\255\21\154\2\257" +
"\2\0\21\257\1\277\16\257\1\275\25\257\1\155\1\151" +
"\2\0\1\257\42\155\2\257\21\155\2\261\2\0\21\261" +
"\1\300\20\261\1\275\23\261\1\156\1\151\2\0\1\261" +
"\42\156\2\261\21\156\16\0\1\301\21\0\1\301\50\0" +
"\1\302\52\0\1\253\3\0\66\253\1\255\3\0\66\255" +
"\1\257\3\0\66\257\1\261\3\0\66\261\21\0\1\303" +
"\70\0\1\303\51\0";
"\2\32\1\33\1\25\1\34\1\14\4\34\1\35\1\14" +
"\1\36\4\34\4\14\4\34\2\14\3\34\1\14\1\34" +
"\7\14\1\37\14\14\5\34\1\14\2\32\1\33\1\40" +
"\16\14\1\41\24\14\1\37\22\14\2\32\1\33\1\25" +
"\1\42\1\43\1\44\1\45\1\46\2\47\2\14\2\47" +
"\1\50\1\47\1\14\1\47\1\51\1\14\1\44\3\47" +
"\1\52\1\43\1\42\1\46\1\47\1\43\1\47\1\53" +
"\1\54\1\55\1\56\2\14\1\57\1\37\1\60\1\61" +
"\1\62\1\63\1\64\1\65\1\66\1\67\1\70\3\14" +
"\2\71\1\47\1\72\1\47\1\14\2\32\1\33\1\25" +
"\1\73\1\14\5\73\2\14\4\73\1\74\1\75\2\14" +
"\4\73\1\76\1\14\3\73\1\14\1\73\4\14\1\77" +
"\1\100\1\101\1\37\1\14\1\102\1\103\1\104\1\105" +
"\1\106\1\107\1\110\1\111\1\112\1\113\1\114\5\73" +
"\1\14\2\32\1\33\1\25\2\14\1\115\5\14\1\36" +
"\1\116\3\14\1\117\3\14\1\115\11\14\1\116\7\14" +
"\1\37\22\14\2\32\1\33\1\25\1\120\1\121\5\120" +
"\2\14\4\120\1\14\1\120\1\122\1\14\4\120\1\123" +
"\1\121\3\120\1\121\1\120\1\124\1\125\1\126\1\127" +
"\2\14\1\57\1\37\1\14\1\61\1\62\1\130\1\64" +
"\1\65\1\66\1\67\1\131\3\14\5\120\1\14\2\32" +
"\1\33\1\25\15\14\1\132\7\14\1\133\12\14\1\134" +
"\1\135\1\136\1\37\1\14\1\137\1\140\1\104\1\141" +
"\1\142\1\143\1\144\1\145\1\146\1\147\1\150\5\14" +
"\1\151\1\152\1\32\1\33\1\25\35\151\1\153\1\154" +
"\1\155\1\156\1\151\1\57\1\37\21\151\1\14\2\32" +
"\1\33\66\14\74\0\1\15\73\0\1\17\71\0\1\157" +
"\10\20\1\160\4\20\1\161\1\0\1\162\1\0\4\20" +
"\1\0\6\20\24\0\5\20\5\0\1\163\1\0\5\163" +
"\2\0\4\163\4\0\4\163\2\0\3\163\1\0\1\163" +
"\24\0\5\163\1\22\3\0\66\22\2\0\1\23\73\0" +
"\1\25\72\0\1\26\1\27\4\26\2\27\1\164\4\26" +
"\1\0\1\165\1\166\1\0\4\26\1\0\1\27\3\26" +
"\1\27\1\26\24\0\5\26\5\0\10\27\1\164\4\27" +
"\2\0\1\166\1\0\4\27\1\0\6\27\24\0\5\27" +
"\5\0\1\167\1\0\5\167\2\0\4\167\4\0\4\167" +
"\2\0\3\167\1\0\1\167\24\0\5\167\1\31\3\0" +
"\66\31\2\0\1\32\74\0\1\34\1\35\4\34\2\35" +
"\1\0\4\34\1\0\1\165\2\0\4\34\1\0\1\35" +
"\3\34\1\35\1\34\24\0\5\34\5\0\10\35\1\0" +
"\4\35\4\0\4\35\1\0\6\35\24\0\5\35\1\37" +
"\3\0\66\37\4\0\1\40\113\0\2\170\1\171\1\172" +
"\45\0\1\47\1\173\6\47\1\0\4\47\2\0\1\47" +
"\1\0\4\47\1\0\1\173\5\47\24\0\5\47\6\0" +
"\1\43\24\0\1\43\3\0\1\43\37\0\3\47\1\173" +
"\4\47\1\0\4\47\2\0\1\47\1\0\4\47\1\0" +
"\6\47\24\0\2\47\1\174\2\47\5\0\10\47\1\0" +
"\4\47\2\0\1\47\1\0\4\47\1\0\6\47\24\0" +
"\2\175\3\47\5\0\1\47\1\176\6\47\1\0\4\47" +
"\2\0\1\47\1\0\4\47\1\0\1\176\5\47\24\0" +
"\5\47\5\0\10\47\1\0\4\47\2\0\1\47\1\0" +
"\4\47\1\0\6\47\24\0\5\47\5\0\2\47\1\177" +
"\5\47\1\0\4\47\2\0\1\47\1\0\1\177\3\47" +
"\1\0\6\47\24\0\5\47\6\0\1\200\20\0\1\200" +
"\3\0\6\200\25\0\1\200\36\0\1\201\44\0\1\202" +
"\24\0\1\202\36\0\2\203\2\0\21\203\1\204\14\203" +
"\1\205\27\203\2\206\2\0\21\206\1\207\15\206\1\205" +
"\26\206\2\210\2\0\21\210\1\211\16\210\1\205\25\210" +
"\5\0\10\47\1\0\4\47\2\0\1\47\1\0\4\47" +
"\1\0\6\47\24\0\2\212\3\47\5\0\10\47\1\0" +
"\4\47\2\0\1\47\1\0\1\47\1\213\2\47\1\0" +
"\6\47\24\0\4\47\1\213\5\0\10\73\1\0\4\73" +
"\2\0\1\73\1\0\4\73\1\0\6\73\24\0\5\73" +
"\22\0\1\214\54\0\10\73\1\0\4\73\2\0\1\73" +
"\1\0\2\215\1\216\1\217\1\0\6\73\24\0\5\73" +
"\22\0\1\220\22\0\1\221\1\222\45\0\1\223\23\0" +
"\1\224\45\0\1\222\131\0\1\225\72\0\1\226\72\0" +
"\1\76\23\0\1\227\21\0\1\227\50\0\1\230\57\0" +
"\10\120\1\0\4\120\1\0\7\120\1\0\6\120\24\0" +
"\5\120\6\0\1\121\24\0\1\121\3\0\1\121\40\0" +
"\1\231\20\0\1\231\3\0\6\231\25\0\1\231\36\0" +
"\1\232\44\0\1\233\24\0\1\233\36\0\2\234\2\0" +
"\21\234\1\235\14\234\1\236\27\234\2\237\2\0\21\237" +
"\1\240\15\237\1\236\26\237\2\241\2\0\21\241\1\242" +
"\16\241\1\236\25\241\22\0\1\243\71\0\1\244\22\0" +
"\1\245\1\246\45\0\1\247\23\0\1\250\45\0\1\246" +
"\131\0\1\251\72\0\1\252\72\0\1\133\5\0\2\151" +
"\3\0\42\151\2\0\21\151\2\153\2\0\1\253\20\153" +
"\1\254\14\153\1\151\4\153\2\253\21\153\2\154\2\0" +
"\1\255\20\154\1\256\15\154\1\151\3\154\2\255\21\154" +
"\2\155\2\0\1\257\20\155\1\260\16\155\1\151\2\155" +
"\2\257\21\155\2\156\2\0\1\261\20\156\1\262\20\156" +
"\1\151\2\261\21\156\4\0\1\157\2\0\1\263\6\0" +
"\1\264\3\0\1\161\3\0\1\263\11\0\1\264\35\0" +
"\1\157\10\0\1\265\4\0\1\161\53\0\1\161\102\0" +
"\1\266\61\0\10\163\1\266\4\163\4\0\4\163\1\0" +
"\6\163\24\0\5\163\15\0\1\265\54\0\1\267\3\0" +
"\66\267\5\0\10\167\1\266\4\167\4\0\4\167\1\0" +
"\6\167\24\0\5\167\5\0\3\47\1\270\4\47\1\0" +
"\4\47\2\0\1\47\1\0\4\47\1\0\6\47\24\0" +
"\5\47\1\203\3\0\66\203\1\206\3\0\66\206\1\210" +
"\3\0\66\210\5\0\10\47\1\0\4\47\2\0\1\47" +
"\1\0\4\47\1\0\6\47\24\0\2\47\1\271\2\47" +
"\5\0\10\47\1\0\4\47\2\0\1\47\1\0\4\47" +
"\1\0\6\47\24\0\2\47\1\272\2\47\21\0\1\273" +
"\70\0\1\273\51\0\1\234\3\0\66\234\1\237\3\0" +
"\66\237\1\241\3\0\66\241\2\253\2\0\21\253\1\274" +
"\14\253\1\275\27\253\1\153\1\151\2\0\1\253\42\153" +
"\2\253\21\153\2\255\2\0\21\255\1\276\15\255\1\275" +
"\26\255\1\154\1\151\2\0\1\255\42\154\2\255\21\154" +
"\2\257\2\0\21\257\1\277\16\257\1\275\25\257\1\155" +
"\1\151\2\0\1\257\42\155\2\257\21\155\2\261\2\0" +
"\21\261\1\300\20\261\1\275\23\261\1\156\1\151\2\0" +
"\1\261\42\156\2\261\21\156\16\0\1\301\21\0\1\301" +
"\50\0\1\302\52\0\1\253\3\0\66\253\1\255\3\0" +
"\66\255\1\257\3\0\66\257\1\261\3\0\66\261\21\0" +
"\1\303\70\0\1\303\51\0";
private static int[] zzUnpackTrans() {
int[] result = new int[6380];
@ -439,9 +438,9 @@ public class _M68kLexer implements FlexLexer {
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\13\0\2\11\5\1\1\11\6\1\1\11\23\1\12\11" +
"\5\1\1\11\2\1\4\11\1\1\4\11\4\1\1\11" +
"\1\1\1\11\10\1\2\11\1\1\1\11\2\1\3\11" +
"\13\0\2\11\5\1\1\11\6\1\1\11\3\1\1\11" +
"\20\1\12\11\5\1\1\11\2\1\4\11\1\1\4\11" +
"\5\1\1\11\10\1\2\11\1\1\1\11\2\1\3\11" +
"\1\1\4\11\11\1\1\0\5\1\3\0\3\11\10\1" +
"\2\0\1\11\4\0\2\1\1\11\3\1\7\11\2\0" +
"\3\1\2\0\1\11\4\0\10\11\1\0\1\1\1\0" +
@ -789,6 +788,7 @@ public class _M68kLexer implements FlexLexer {
break;
case 4: {
yybegin(INSTRPART);
yypushback(pushbackLabelColons(yytext()));
return GLOBAL_LABEL_DEF;
}
// fall through
@ -853,207 +853,207 @@ public class _M68kLexer implements FlexLexer {
case 106:
break;
case 11: {
yybegin(WAITEOL);
return COMMENT;
return COLON;
}
// fall through
case 107:
break;
case 12: {
yybegin(ASMOPS);
return WHITE_SPACE;
yybegin(WAITEOL);
return COMMENT;
}
// fall through
case 108:
break;
case 13: {
yybegin(ASMOPS_OP);
return SYMBOL;
yybegin(ASMOPS);
return WHITE_SPACE;
}
// fall through
case 109:
break;
case 14: {
yybegin(ASMOPS_OP);
return DECIMAL;
return SYMBOL;
}
// fall through
case 110:
break;
case 15: {
return SEPARATOR;
yybegin(ASMOPS_OP);
return DECIMAL;
}
// fall through
case 111:
break;
case 16: {
return HASH;
return SEPARATOR;
}
// fall through
case 112:
break;
case 17: {
return OP_BITWISE_XOR;
return HASH;
}
// fall through
case 113:
break;
case 18: {
return ROUND_L;
return OP_BITWISE_XOR;
}
// fall through
case 114:
break;
case 19: {
yybegin(ASMOPS_OP);
return ROUND_R;
return ROUND_L;
}
// fall through
case 115:
break;
case 20: {
return OP_UNARY_NOT;
yybegin(ASMOPS_OP);
return ROUND_R;
}
// fall through
case 116:
break;
case 21: {
return OP_UNARY_COMPL;
return OP_UNARY_NOT;
}
// fall through
case 117:
break;
case 22: {
return OP_PLUS;
return OP_UNARY_COMPL;
}
// fall through
case 118:
break;
case 23: {
return OP_MINUS;
return OP_PLUS;
}
// fall through
case 119:
break;
case 24: {
yybegin(ASMOPS_OP);
return CURRENT_PC_SYMBOL;
return OP_MINUS;
}
// fall through
case 120:
break;
case 25: {
return SYMBOL;
yybegin(ASMOPS_OP);
return CURRENT_PC_SYMBOL;
}
// fall through
case 121:
break;
case 26: {
yybegin(ASMOPS);
return OP_CMP_EQ;
return SYMBOL;
}
// fall through
case 122:
break;
case 27: {
yybegin(ASMOPS);
return OP_AR_MOD;
return OP_CMP_EQ;
}
// fall through
case 123:
break;
case 28: {
yybegin(ASMOPS);
return OP_CMP_LT;
return OP_AR_MOD;
}
// fall through
case 124:
break;
case 29: {
yybegin(ASMOPS);
return OP_CMP_GT;
return OP_CMP_LT;
}
// fall through
case 125:
break;
case 30: {
yybegin(ASMOPS);
return SEPARATOR;
return OP_CMP_GT;
}
// fall through
case 126:
break;
case 31: {
yybegin(ASMOPS);
return OP_BITWISE_XOR;
return SEPARATOR;
}
// fall through
case 127:
break;
case 32: {
yybegin(ASMOPS);
return ROUND_L;
return OP_BITWISE_XOR;
}
// fall through
case 128:
break;
case 33: {
return ROUND_R;
yybegin(ASMOPS);
return ROUND_L;
}
// fall through
case 129:
break;
case 34: {
yybegin(ASMOPS);
return OP_BITWISE_OR;
return ROUND_R;
}
// fall through
case 130:
break;
case 35: {
yybegin(ASMOPS);
return OP_UNARY_COMPL;
return OP_BITWISE_OR;
}
// fall through
case 131:
break;
case 36: {
yybegin(ASMOPS);
return OP_PLUS;
return OP_UNARY_COMPL;
}
// fall through
case 132:
break;
case 37: {
yybegin(ASMOPS);
return OP_MINUS;
return OP_PLUS;
}
// fall through
case 133:
break;
case 38: {
yybegin(ASMOPS);
return OP_AR_MUL;
return OP_MINUS;
}
// fall through
case 134:
break;
case 39: {
yybegin(ASMOPS);
return OP_BITWISE_AND;
return OP_AR_MUL;
}
// fall through
case 135:
break;
case 40: {
yybegin(ASMOPS);
return OP_AR_DIV;
return OP_BITWISE_AND;
}
// fall through
case 136:
break;
case 41: {
return COLON;
yybegin(ASMOPS);
return OP_AR_DIV;
}
// fall through
case 137:
@ -1207,6 +1207,7 @@ public class _M68kLexer implements FlexLexer {
break;
case 63: {
yybegin(INSTRPART);
yypushback(pushbackLabelColons(yytext()));
return LOCAL_LABEL_DEF;
}
// fall through

View File

@ -87,9 +87,9 @@ public class M68kParser implements PsiParser, LightPsiParser {
// AREG
public static boolean AddressRegister(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "AddressRegister")) return false;
if (!nextTokenIs(b, "<Register>", AREG)) return false;
if (!nextTokenIs(b, "<address register>", AREG)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, ADDRESS_REGISTER, "<Register>");
Marker m = enter_section_(b, l, _NONE_, ADDRESS_REGISTER, "<address register>");
r = consumeToken(b, AREG);
exit_section_(b, l, m, r, false, null);
return r;
@ -288,9 +288,9 @@ public class M68kParser implements PsiParser, LightPsiParser {
// OPSIZE_W|OPSIZE_L
public static boolean AddressSize(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "AddressSize")) return false;
if (!nextTokenIs(b, "<address size>", OPSIZE_L, OPSIZE_W)) return false;
if (!nextTokenIs(b, "<.w|.l>", OPSIZE_L, OPSIZE_W)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, ADDRESS_SIZE, "<address size>");
Marker m = enter_section_(b, l, _NONE_, ADDRESS_SIZE, "<.w|.l>");
r = consumeToken(b, OPSIZE_W);
if (!r) r = consumeToken(b, OPSIZE_L);
exit_section_(b, l, m, r, false, null);
@ -445,9 +445,9 @@ public class M68kParser implements PsiParser, LightPsiParser {
// DataRegister | AddressRegister
static boolean DataOrAddressRegister(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "DataOrAddressRegister")) return false;
if (!nextTokenIs(b, "<Register>", AREG, DREG)) return false;
if (!nextTokenIs(b, "<data or address register>", AREG, DREG)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, null, "<Register>");
Marker m = enter_section_(b, l, _NONE_, null, "<data or address register>");
r = DataRegister(b, l + 1);
if (!r) r = AddressRegister(b, l + 1);
exit_section_(b, l, m, r, false, null);
@ -458,9 +458,9 @@ public class M68kParser implements PsiParser, LightPsiParser {
// DREG
public static boolean DataRegister(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "DataRegister")) return false;
if (!nextTokenIs(b, "<Register>", DREG)) return false;
if (!nextTokenIs(b, "<data register>", DREG)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, DATA_REGISTER, "<Register>");
Marker m = enter_section_(b, l, _NONE_, DATA_REGISTER, "<data register>");
r = consumeToken(b, DREG);
exit_section_(b, l, m, r, false, null);
return r;
@ -502,9 +502,9 @@ public class M68kParser implements PsiParser, LightPsiParser {
// OPSIZE_W|OPSIZE_L
public static boolean DataWidth(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "DataWidth")) return false;
if (!nextTokenIs(b, "<data width>", OPSIZE_L, OPSIZE_W)) return false;
if (!nextTokenIs(b, "<.w|.l>", OPSIZE_L, OPSIZE_W)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, DATA_WIDTH, "<data width>");
Marker m = enter_section_(b, l, _NONE_, DATA_WIDTH, "<.w|.l>");
r = consumeToken(b, OPSIZE_W);
if (!r) r = consumeToken(b, OPSIZE_L);
exit_section_(b, l, m, r, false, null);
@ -512,27 +512,39 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
// GLOBAL_LABEL_DEF
// GLOBAL_LABEL_DEF COLON*
public static boolean GlobalLabel(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "GlobalLabel")) return false;
if (!nextTokenIs(b, GLOBAL_LABEL_DEF)) return false;
if (!nextTokenIs(b, "<global label>", GLOBAL_LABEL_DEF)) return false;
boolean r;
Marker m = enter_section_(b);
Marker m = enter_section_(b, l, _NONE_, GLOBAL_LABEL, "<global label>");
r = consumeToken(b, GLOBAL_LABEL_DEF);
exit_section_(b, m, GLOBAL_LABEL, r);
r = r && GlobalLabel_1(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// COLON*
private static boolean GlobalLabel_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "GlobalLabel_1")) return false;
while (true) {
int c = current_position_(b);
if (!consumeToken(b, COLON)) break;
if (!empty_element_parsed_guard_(b, "GlobalLabel_1", c)) break;
}
return true;
}
/* ********************************************************** */
// HASH expr
public static boolean ImmediateData(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "ImmediateData")) return false;
if (!nextTokenIs(b, HASH)) return false;
if (!nextTokenIs(b, "<immediate data>", HASH)) return false;
boolean r;
Marker m = enter_section_(b);
Marker m = enter_section_(b, l, _NONE_, IMMEDIATE_DATA, "<immediate data>");
r = consumeToken(b, HASH);
r = r && expr(b, l + 1, -1);
exit_section_(b, m, IMMEDIATE_DATA, r);
exit_section_(b, l, m, r, false, null);
return r;
}
@ -597,17 +609,25 @@ public class M68kParser implements PsiParser, LightPsiParser {
}
/* ********************************************************** */
// LOCAL_LABEL_DEF
// LOCAL_LABEL_DEF COLON?
public static boolean LocalLabel(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "LocalLabel")) return false;
if (!nextTokenIs(b, LOCAL_LABEL_DEF)) return false;
if (!nextTokenIs(b, "<local label>", LOCAL_LABEL_DEF)) return false;
boolean r;
Marker m = enter_section_(b);
Marker m = enter_section_(b, l, _NONE_, LOCAL_LABEL, "<local label>");
r = consumeToken(b, LOCAL_LABEL_DEF);
exit_section_(b, m, LOCAL_LABEL, r);
r = r && LocalLabel_1(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// COLON?
private static boolean LocalLabel_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "LocalLabel_1")) return false;
consumeToken(b, COLON);
return true;
}
/* ********************************************************** */
// line*
static boolean M68kFile(PsiBuilder b, int l) {
@ -645,7 +665,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
public static boolean OperandSize(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "OperandSize")) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, OPERAND_SIZE, "<operand size>");
Marker m = enter_section_(b, l, _NONE_, OPERAND_SIZE, "<.s|.b|.w|.l>");
r = consumeToken(b, OPSIZE_BS);
if (!r) r = consumeToken(b, OPSIZE_W);
if (!r) r = consumeToken(b, OPSIZE_L);
@ -976,7 +996,7 @@ public class M68kParser implements PsiParser, LightPsiParser {
public static boolean SpecialRegister(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "SpecialRegister")) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, SPECIAL_REGISTER, "<Register>");
Marker m = enter_section_(b, l, _NONE_, SPECIAL_REGISTER, "<special register>");
r = consumeToken(b, REG_CCR);
if (!r) r = consumeToken(b, REG_SR);
if (!r) r = consumeToken(b, REG_USP);
@ -1062,9 +1082,9 @@ public class M68kParser implements PsiParser, LightPsiParser {
// 11: ATOM(ref_expr) ATOM(literal_expr) PREFIX(paren_expr)
public static boolean expr(PsiBuilder b, int l, int g) {
if (!recursion_guard_(b, l, "expr")) return false;
addVariant(b, "<expr>");
addVariant(b, "<expression>");
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, "<expr>");
Marker m = enter_section_(b, l, _NONE_, "<expression>");
r = unary_plus_expr(b, l + 1);
if (!r) r = unary_minus_expr(b, l + 1);
if (!r) r = unary_not_expr(b, l + 1);

View File

@ -1,6 +1,19 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
public interface M68kGlobalLabel extends M68kLabel {
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface M68kGlobalLabel extends M68kLabel, M68kNamedElement {
@Nullable
String getName();
@NotNull
PsiElement setName(@NotNull String name);
@NotNull
PsiElement getNameIdentifier();
}

View File

@ -1,6 +1,8 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
public interface M68kLiteralExpr extends M68kExpr {
import com.intellij.psi.PsiLiteralValue;
public interface M68kLiteralExpr extends M68kExpr, PsiLiteralValue {
}

View File

@ -1,6 +1,19 @@
// This is a generated file. Not intended for manual editing.
package de.platon42.intellij.plugins.m68k.psi;
public interface M68kLocalLabel extends M68kLabel {
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface M68kLocalLabel extends M68kLabel, M68kNamedElement {
@Nullable
String getName();
@NotNull
PsiElement setName(@NotNull String name);
@NotNull
PsiElement getNameIdentifier();
}

View File

@ -81,6 +81,7 @@ public class M68kVisitor extends PsiElementVisitor {
public void visitGlobalLabel(@NotNull M68kGlobalLabel o) {
visitLabel(o);
// visitNamedElement(o);
}
public void visitImmediateData(@NotNull M68kImmediateData o) {
@ -93,6 +94,7 @@ public class M68kVisitor extends PsiElementVisitor {
public void visitLocalLabel(@NotNull M68kLocalLabel o) {
visitLabel(o);
// visitNamedElement(o);
}
public void visitMacroCall(@NotNull M68kMacroCall o) {
@ -217,6 +219,7 @@ public class M68kVisitor extends PsiElementVisitor {
public void visitLiteralExpr(@NotNull M68kLiteralExpr o) {
visitExpr(o);
// visitPsiLiteralValue(o);
}
public void visitParenExpr(@NotNull M68kParenExpr o) {

View File

@ -2,18 +2,21 @@
package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
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 org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class M68kGlobalLabelImpl extends M68kLabelImpl implements M68kGlobalLabel {
public class M68kGlobalLabelImpl extends M68kGlobalLabelMixin implements M68kGlobalLabel {
public M68kGlobalLabelImpl(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(@NotNull M68kVisitor visitor) {
visitor.visitGlobalLabel(this);
}
@ -24,4 +27,22 @@ public class M68kGlobalLabelImpl extends M68kLabelImpl implements M68kGlobalLabe
else super.accept(visitor);
}
@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);
}
}

View File

@ -4,16 +4,16 @@ 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.M68kLiteralExpr;
import de.platon42.intellij.plugins.m68k.psi.M68kLiteralExprMixin;
import de.platon42.intellij.plugins.m68k.psi.M68kVisitor;
import org.jetbrains.annotations.NotNull;
public class M68kLiteralExprImpl extends M68kExprImpl implements M68kLiteralExpr {
public class M68kLiteralExprImpl extends M68kLiteralExprMixin implements M68kLiteralExpr {
public M68kLiteralExprImpl(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(@NotNull M68kVisitor visitor) {
visitor.visitLiteralExpr(this);
}

View File

@ -2,18 +2,21 @@
package de.platon42.intellij.plugins.m68k.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel;
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabelMixin;
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;
public class M68kLocalLabelImpl extends M68kLabelImpl implements M68kLocalLabel {
public class M68kLocalLabelImpl extends M68kLocalLabelMixin implements M68kLocalLabel {
public M68kLocalLabelImpl(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(@NotNull M68kVisitor visitor) {
visitor.visitLocalLabel(this);
}
@ -24,4 +27,22 @@ public class M68kLocalLabelImpl extends M68kLabelImpl implements M68kLocalLabel
else super.accept(visitor);
}
@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);
}
}

View File

@ -25,4 +25,9 @@ object LexerUtil {
fun pushbackAssignment(text: CharSequence): Int {
return text.length - text.indexOfAny(ASSIGNMENT_SEPARATORS)
}
@JvmStatic
fun pushbackLabelColons(text: CharSequence): Int {
return text.count { it == ':' }
}
}

View File

@ -57,8 +57,8 @@ HASH_COMMENT=([#;*].*+)
{WHITE_SPACE} { yybegin(NOSOL); return WHITE_SPACE; }
{EOL} { return WHITE_SPACE; }
{ASSIGNMENT} { yybegin(ASSIGNMENT); yypushback(pushbackAssignment(yytext())); return SYMBOLDEF; }
{LOCAL_LABEL} { yybegin(INSTRPART); return LOCAL_LABEL_DEF; }
{GLOBAL_LABEL} { yybegin(INSTRPART); return GLOBAL_LABEL_DEF; }
{LOCAL_LABEL} { yybegin(INSTRPART); yypushback(pushbackLabelColons(yytext())); return LOCAL_LABEL_DEF; }
{GLOBAL_LABEL} { yybegin(INSTRPART); yypushback(pushbackLabelColons(yytext())); return GLOBAL_LABEL_DEF; }
{HASH_COMMENT} { return COMMENT; }
}
@ -66,8 +66,8 @@ HASH_COMMENT=([#;*].*+)
<NOSOL> {
{WHITE_SPACE} { return WHITE_SPACE; }
{EOL} { yybegin(YYINITIAL); return WHITE_SPACE; }
{LOCAL_LABEL_WC} { yybegin(INSTRPART); return LOCAL_LABEL_DEF; }
{GLOBAL_LABEL_WC} { yybegin(INSTRPART); return GLOBAL_LABEL_DEF; }
{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; }
@ -84,6 +84,8 @@ HASH_COMMENT=([#;*].*+)
{WHITE_SPACE} { return WHITE_SPACE; }
{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; }

View File

@ -3,11 +3,11 @@
parserUtilClass="de.platon42.intellij.plugins.m68k.parser.M68kParserUtilBase"
extends="com.intellij.extapi.psi.ASTWrapperPsiElement"
psiClassPrefix="M68k"
psiImplClassSuffix="Impl"
psiPackage="de.platon42.intellij.plugins.m68k.psi"
psiImplPackage="de.platon42.intellij.plugins.m68k.psi.impl"
psiImplUtilClass="de.platon42.intellij.plugins.m68k.psi.M68kPsiImplUtil"
// elementTypeFactory="de.platon42.intellij.plugins.m68k.parser.M68kParserDefinition.createType"
// tokenTypeFactory="de.platon42.intellij.plugins.m68k.parser.M68kParserDefinition.createTokenType"
@ -134,13 +134,27 @@ private LabelOnly ::= Label
private LabelWithInstruction ::= Label Instruction
private InstructionOnly ::= Instruction
LocalLabel ::= LOCAL_LABEL_DEF {extends=Label}
GlobalLabel ::= GLOBAL_LABEL_DEF {extends=Label}
LocalLabel ::= LOCAL_LABEL_DEF COLON? {
name = "local label"
extends = Label
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kLocalLabelMixin"
methods = [getName setName getNameIdentifier]
}
GlobalLabel ::= GLOBAL_LABEL_DEF COLON* {
name = "global label"
extends = Label
implements = "de.platon42.intellij.plugins.m68k.psi.M68kNamedElement"
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kGlobalLabelMixin"
methods = [getName setName getNameIdentifier]
}
Label ::= LocalLabel | GlobalLabel
OperandSize ::= (OPSIZE_BS|OPSIZE_W|OPSIZE_L)
AddressSize ::= (OPSIZE_W|OPSIZE_L)
DataWidth ::= (OPSIZE_W|OPSIZE_L)
OperandSize ::= (OPSIZE_BS|OPSIZE_W|OPSIZE_L) { name = ".s|.b|.w|.l" }
AddressSize ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
DataWidth ::= (OPSIZE_W|OPSIZE_L) { name = ".w|.l" }
AsmOp ::= MNEMONIC OperandSize?
@ -159,13 +173,24 @@ private PreprocessorOperand ::= expr
private PlainOperands ::= STRINGLIT (SEPARATOR STRINGLIT)*
DataRegister ::= DREG {extends=Register}
AddressRegister ::= AREG {extends=Register}
SpecialRegister ::= REG_CCR | REG_SR | REG_USP | REG_VBR {extends=Register}
DataRegister ::= DREG {
name = "data register"
extends = Register
}
AddressRegister ::= AREG {
name = "address register"
extends = Register
}
SpecialRegister ::= REG_CCR | REG_SR | REG_USP | REG_VBR {
name = "special register"
extends = Register
}
Register ::= DataRegister | AddressRegister | SpecialRegister
private DataOrAddressRegister ::= DataRegister | AddressRegister
private DataOrAddressRegister ::= DataRegister | AddressRegister { name = "data or address register"}
AddressingMode ::= ImmediateData
| AddressRegisterIndirectPreDecAddressingMode
@ -202,7 +227,10 @@ ProgramCounterIndirectWithIndexNewAddressingMode ::= ROUND_L (expr SEPARATOR)? P
AbsoluteAddressAddressingMode ::= expr AddressSize? !ROUND_L
private RegisterRange ::= (DataOrAddressRegister OP_MINUS DataOrAddressRegister)
RegisterListAddressingMode ::= (DataOrAddressRegister|RegisterRange) ((OP_AR_DIV|OP_MINUS) (DataOrAddressRegister|RegisterRange))*
ImmediateData ::= HASH expr {extends=AddressingMode}
ImmediateData ::= HASH expr {
name = "immediate data"
extends = AddressingMode
}
expr ::= binary_logical_or_expr
| binary_logical_and_expr
@ -215,7 +243,7 @@ expr ::= binary_logical_or_expr
| binary_bitwise_and_expr
| binary_shift_group
| unary_group
| primary_group
| primary_group { name = "expression" }
// | macrobrace_expr
// private rules to define operators with the same priority
@ -247,11 +275,13 @@ binary_cmp_gt_expr ::= expr OP_CMP_GT expr
binary_cmp_ge_expr ::= expr OP_CMP_GT_EQ expr
binary_cmp_eq_expr ::= expr OP_CMP_EQ expr
binary_cmp_ne_expr ::= expr OP_CMP_NOT_EQ expr
//binary_cmp_ne_expr ::= expr (OP_CMP_NOT_EQ|OP_CMP_NOT_EQ2) expr
binary_logical_and_expr ::= expr OP_LOGICAL_AND expr
binary_logical_or_expr ::= expr OP_LOGICAL_OR expr
//macrobrace_expr ::= OP_CMP_LT expr OP_CMP_GT
paren_expr ::= ROUND_L expr ROUND_R //{pin=1 recoverWhile=statement_recover}
ref_expr ::= SYMBOL|CURRENT_PC_SYMBOL
literal_expr ::= BINARY|DECIMAL|HEXADECIMAL|OCTAL|STRINGLIT
literal_expr ::= BINARY|DECIMAL|HEXADECIMAL|OCTAL|STRINGLIT {
implements = "com.intellij.psi.PsiLiteralValue"
mixin = "de.platon42.intellij.plugins.m68k.psi.M68kLiteralExprMixin"
}

View File

@ -1,22 +1,7 @@
package de.platon42.intellij.plugins.m68k.parser;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.parser.GeneratedParserUtilBase;
import static de.platon42.intellij.plugins.m68k.psi.M68kTypes.SYMBOL;
public class M68kParserUtilBase extends GeneratedParserUtilBase {
public static boolean parseMacroCallOrAsmInstruction(PsiBuilder b, int level) {
boolean r = false;
if (!nextTokenIs(b, SYMBOL)) return M68kParser.MacroCall(b, level);
PsiBuilder.Marker m = enter_section_(b);
//M68kMnemonics.INSTANCE.getMnemonics().stream().findFirst() nextTokenIs(, )
r = M68kParser.AsmInstruction(b, level);
exit_section_(b, m, null, r);
return r;
}
}

View File

@ -0,0 +1,23 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.util.PsiTreeUtil
import de.platon42.intellij.plugins.m68k.M68kFileType.Companion.INSTANCE
object M68kElementFactory {
fun createGlobalLabel(project: Project, label: String): M68kGlobalLabel {
val file = createFile(project, label)
return PsiTreeUtil.findChildOfType(file, M68kGlobalLabel::class.java)!!
}
fun createLocalLabel(project: Project, label: String): M68kLocalLabel {
val file = createFile(project, label)
return PsiTreeUtil.findChildOfType(file, M68kLocalLabel::class.java)!!
}
fun createFile(project: Project, content: String): M68kFile {
return PsiFileFactory.getInstance(project).createFileFromText("dummy.m68k", INSTANCE, content) as M68kFile
}
}

View File

@ -0,0 +1,8 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.extapi.psi.ASTWrapperPsiElement
import com.intellij.lang.ASTNode
abstract class M68kGlobalLabelMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kGlobalLabel {
}

View File

@ -0,0 +1,51 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.extapi.psi.ASTWrapperPsiElement
import com.intellij.lang.ASTNode
abstract class M68kLiteralExprMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kLiteralExpr {
override fun getValue(): Any? {
val childNode = firstChild.node
when (childNode.elementType) {
M68kTypes.STRINGLIT -> {
return text.run {
when {
startsWith('"') -> removeSurrounding("\"")
startsWith('\'') -> removeSurrounding("'")
startsWith('<') -> removeSurrounding(">")
else -> this
}
}
}
M68kTypes.DECIMAL -> {
try {
return childNode.text.toInt()
} catch (ex: NumberFormatException) {
// ignore and fall through
}
}
M68kTypes.HEXADECIMAL -> {
try {
return childNode.text.substring(1).toInt(16)
} catch (ex: NumberFormatException) {
// ignore and fall through
}
}
M68kTypes.BINARY -> {
try {
return childNode.text.substring(1).toInt(2)
} catch (ex: NumberFormatException) {
// ignore and fall through
}
}
M68kTypes.OCTAL -> {
try {
return childNode.text.substring(1).toInt(8)
} catch (ex: NumberFormatException) {
// ignore and fall through
}
}
}
return text
}
}

View File

@ -0,0 +1,8 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.extapi.psi.ASTWrapperPsiElement
import com.intellij.lang.ASTNode
abstract class M68kLocalLabelMixin(node: ASTNode) : ASTWrapperPsiElement(node), M68kLocalLabel {
}

View File

@ -0,0 +1,6 @@
package de.platon42.intellij.plugins.m68k.psi;
import com.intellij.psi.PsiNameIdentifierOwner;
public interface M68kNamedElement extends PsiNameIdentifierOwner {
}

View File

@ -0,0 +1,42 @@
package de.platon42.intellij.plugins.m68k.psi
import com.intellij.psi.PsiElement
import com.intellij.util.IncorrectOperationException
import de.platon42.intellij.plugins.m68k.psi.M68kElementFactory.createGlobalLabel
import de.platon42.intellij.plugins.m68k.psi.M68kElementFactory.createLocalLabel
object M68kPsiImplUtil {
@JvmStatic
fun getName(element: M68kGlobalLabel): String? = element.firstChild.text
@JvmStatic
fun setName(element: M68kGlobalLabel, name: String): PsiElement {
val nameNode = element.node.findChildByType(M68kTypes.GLOBAL_LABEL_DEF)
if (nameNode != null) {
val newGlobalLabel = createGlobalLabel(element.project, name)
element.node.replaceChild(nameNode, newGlobalLabel.firstChild.node)
}
return element
}
@JvmStatic
fun getNameIdentifier(element: M68kGlobalLabel): PsiElement = element.firstChild
@JvmStatic
fun getName(element: M68kLocalLabel): String? = element.firstChild.text
@JvmStatic
fun setName(element: M68kLocalLabel, name: String): PsiElement {
if (!(name.startsWith(".") || name.endsWith("$"))) throw IncorrectOperationException("local label must start with '.' or end with '$'")
val nameNode = element.node.findChildByType(M68kTypes.LOCAL_LABEL_DEF)
if (nameNode != null) {
val newLocalLabel = createLocalLabel(element.project, name)
element.node.replaceChild(nameNode, newLocalLabel.firstChild.node)
}
return element
}
@JvmStatic
fun getNameIdentifier(element: M68kLocalLabel): PsiElement = element.firstChild
}

View File

@ -2,7 +2,8 @@ Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kPreprocessorDirectiveImpl(PREPROCESSOR_DIRECTIVE)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('foo:')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('foo')
PsiElement(M68kTokenType.COLON)(':')
PsiWhiteSpace(' ')
PsiElement(M68kTokenType.DATA_DIRECTIVE)('dc.b')
PsiWhiteSpace(' ')

View File

@ -2,7 +2,8 @@ Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kPreprocessorDirectiveImpl(PREPROCESSOR_DIRECTIVE)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('howto:')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('howto')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.OTHER_DIRECTIVE)('incbin')
PsiWhiteSpace(' ')
M68kRefExprImpl(REF_EXPR)

View File

@ -1,7 +1,8 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('start_demo:')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('start_demo')
PsiElement(M68kTokenType.COLON)(':')
PsiWhiteSpace(' ')
PsiComment(M68kTokenType.COMMENT)('; here we will do some cool stuff')
PsiElement(M68kTokenType.EOL)('\n')
@ -75,7 +76,8 @@ Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.skip:')
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.skip')
PsiElement(M68kTokenType.COLON)(':')
PsiWhiteSpace(' ')
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)
@ -92,7 +94,9 @@ Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('GlobalExit::')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('GlobalExit')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.COLON)(':')
PsiWhiteSpace(' ')
M68kAsmInstructionImpl(ASM_INSTRUCTION)
M68kAsmOpImpl(ASM_OP)

View File

@ -1,5 +1,6 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label:')
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -1,5 +1,7 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('External_Label::')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('External_Label')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -1,5 +1,6 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label:')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -2,5 +2,6 @@ Assembly File: a.asm
PsiWhiteSpace('\t')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label:')
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('.local_label')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -2,5 +2,7 @@ Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('External_Label::')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('External_Label')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -2,5 +2,6 @@ Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kGlobalLabelImpl(GLOBAL_LABEL)
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label:')
PsiElement(M68kTokenType.GLOBAL_LABEL_DEF)('Global_Label')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -2,5 +2,6 @@ Assembly File: a.asm
PsiWhiteSpace(' ')
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$:')
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')

View File

@ -1,5 +1,6 @@
Assembly File: a.asm
M68kStatementImpl(STATEMENT)
M68kLocalLabelImpl(LOCAL_LABEL)
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$:')
PsiElement(M68kTokenType.LOCAL_LABEL_DEF)('local_label$')
PsiElement(M68kTokenType.COLON)(':')
PsiElement(M68kTokenType.EOL)('\n')