From d53a1fbac8c900be5fb56c88fa971984fb48cc7b Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Fri, 16 Jul 2021 14:13:29 +0200 Subject: [PATCH] Nosfe also likes to place assignments with colons. Fixed assignment symbol detection (again :-/). --- .../plugins/m68k/lexer/_M68kLexer.java | 648 +++++++++--------- .../plugins/m68k/parser/M68kParser.java | 12 +- .../intellij/plugins/m68k/psi/M68kTypes.java | 1 + .../intellij/plugins/m68k/lexer/LexerUtil.kt | 8 +- .../plugins/m68k/lexer/_M68kLexer.flex | 3 +- .../platon42/intellij/plugins/m68k/m68k.bnf | 2 +- .../plugins/m68k/parser/AssignmentTest.kt | 12 +- .../assignment/assignment_with_colon.txt | 11 + .../assignment_with_colon_and_set.txt | 11 + .../assignment_with_local_label.txt | 1 + 10 files changed, 380 insertions(+), 329 deletions(-) create mode 100644 src/test/resources/parser/assignment/assignment_with_colon.txt create mode 100644 src/test/resources/parser/assignment/assignment_with_colon_and_set.txt 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 37b8c3c..d0c684b 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 @@ -134,10 +134,10 @@ public class _M68kLexer implements FlexLexer { /* The ZZ_CMAP_A table has 3200 entries */ static final char ZZ_CMAP_A[] = zzUnpackCMap( "\11\0\1\4\1\2\2\1\1\3\22\0\1\4\1\55\1\44\1\51\1\24\1\32\1\62\1\43\1\53\1\54" + - "\1\61\1\57\1\47\1\60\1\22\1\64\2\33\6\6\2\37\1\23\1\50\1\45\1\21\1\46\1\0" + - "\1\41\1\5\1\71\1\65\1\11\1\15\6\12\1\31\3\12\1\10\1\16\1\67\1\7\1\20\1\17" + + "\1\61\1\57\1\47\1\60\1\23\1\64\2\33\6\6\2\37\1\15\1\50\1\45\1\22\1\46\1\0" + + "\1\41\1\5\1\71\1\65\1\11\1\16\6\12\1\31\3\12\1\10\1\17\1\67\1\7\1\21\1\20" + "\1\70\1\30\3\12\1\0\1\25\1\0\1\52\1\13\1\42\1\34\1\27\1\66\1\35\1\40\1\36" + - "\5\12\1\31\3\12\1\10\1\16\1\67\1\26\1\20\1\17\1\70\1\30\3\12\1\0\1\63\1\0" + + "\5\12\1\31\3\12\1\10\1\17\1\67\1\26\1\21\1\20\1\70\1\30\3\12\1\0\1\63\1\0" + "\1\56\6\0\1\1\12\0\1\4\11\0\1\12\12\0\1\12\4\0\1\12\5\0\27\12\1\0\27\12\1" + "\7\2\12\4\0\14\12\16\0\5\12\7\0\1\12\1\0\1\12\1\0\5\12\1\0\2\12\2\0\4\12\1" + "\0\1\12\6\0\1\12\1\0\3\12\1\0\1\12\1\0\4\12\1\0\23\12\1\0\13\12\10\0\6\12" + @@ -196,21 +196,22 @@ public class _M68kLexer implements FlexLexer { "\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\36\1\37\1\40\1\41\1\42\1\43\1\44\1\45" + - "\1\46\1\47\1\42\1\50\2\1\1\51\1\52\1\53" + - "\6\1\1\54\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\65\1\73\1\74\1\12\4\74\1\0\1\75\1\4" + - "\2\76\3\0\1\77\1\100\1\101\1\102\1\103\1\104" + - "\1\105\1\15\1\106\1\107\1\110\2\0\1\111\4\0" + - "\2\15\1\32\1\77\1\100\1\101\1\112\1\113\1\114" + - "\1\115\1\116\1\117\1\120\2\0\1\121\1\122\1\123" + - "\2\0\1\124\4\0\1\56\1\125\1\126\1\127\1\130" + - "\1\131\1\132\1\133\1\0\1\74\1\0\1\74\1\0" + - "\1\74\1\0\1\74\2\0\1\4\1\76\1\7\1\134" + - "\1\135\1\136\1\137\1\0\1\74\6\0"; + "\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"; private static int[] zzUnpackAction() { - int[] result = new int[193]; + int[] result = new int[195]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -244,25 +245,25 @@ public class _M68kLexer implements FlexLexer { "\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\0\u0fdc" + - "\0\u0fdc\0\u1016\0\u1050\0\u108a\0\u10c4\0\u10fe\0\u1138\0\u1172" + - "\0\u11ac\0\u11e6\0\u1220\0\u11ac\0\u125a\0\u027e\0\u027e\0\u027e" + - "\0\u07b4\0\u07b4\0\u07b4\0\u07b4\0\u1294\0\u0828\0\u0862\0\u089c" + - "\0\u08d6\0\u12ce\0\u027e\0\u0910\0\u1308\0\u094a\0\u1342\0\u137c" + - "\0\u13b6\0\u027e\0\u09f8\0\u09f8\0\u09f8\0\u027e\0\u027e\0\u027e" + - "\0\u027e\0\u027e\0\u027e\0\u027e\0\u13f0\0\u142a\0\u0cea\0\u0d24" + - "\0\u0d5e\0\u0d98\0\u1464\0\u027e\0\u0dd2\0\u149e\0\u0e0c\0\u14d8" + - "\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e" + - "\0\u1512\0\u154c\0\u1586\0\u15c0\0\u15fa\0\u1634\0\u166e\0\u16a8" + - "\0\u16e2\0\u171c\0\u027e\0\u027e\0\u027e\0\u07b4\0\u07b4\0\u07b4" + - "\0\u027e\0\u1756\0\u027e\0\u1790\0\u17ca\0\u1804\0\u183e\0\u1878" + - "\0\u1138"; + "\0\u0b54\0\u0b8e\0\u0bc8\0\u0c02\0\u027e\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" + + "\0\u0fdc\0\u0fdc\0\u1016\0\u1050\0\u108a\0\u10c4\0\u10fe\0\u1138" + + "\0\u1172\0\u11ac\0\u11e6\0\u1220\0\u125a\0\u11ac\0\u1294\0\u027e" + + "\0\u027e\0\u027e\0\u07b4\0\u07b4\0\u07b4\0\u07b4\0\u12ce\0\u0828" + + "\0\u0862\0\u089c\0\u08d6\0\u1308\0\u027e\0\u0910\0\u1342\0\u094a" + + "\0\u137c\0\u13b6\0\u13f0\0\u027e\0\u09f8\0\u09f8\0\u09f8\0\u027e" + + "\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u142a\0\u1464" + + "\0\u0cea\0\u0d24\0\u0d5e\0\u0d98\0\u149e\0\u027e\0\u0dd2\0\u14d8" + + "\0\u0e0c\0\u1512\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e\0\u027e" + + "\0\u027e\0\u027e\0\u154c\0\u1586\0\u15c0\0\u15fa\0\u1634\0\u166e" + + "\0\u16a8\0\u16e2\0\u171c\0\u1756\0\u027e\0\u027e\0\u027e\0\u07b4" + + "\0\u07b4\0\u07b4\0\u027e\0\u1790\0\u027e\0\u17ca\0\u1804\0\u183e" + + "\0\u1878\0\u18b2\0\u1172"; private static int[] zzUnpackRowMap() { - int[] result = new int[193]; + int[] result = new int[195]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -285,114 +286,119 @@ public class _M68kLexer implements FlexLexer { private static final int[] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\1\14\2\15\1\16\1\17\1\20\1\14\5\20\1\14" + - "\4\20\1\14\1\21\3\14\4\20\2\14\3\20\1\14" + + "\1\14\2\15\1\16\1\17\1\20\1\14\5\20\2\14" + + "\4\20\1\14\1\21\2\14\4\20\2\14\3\20\1\14" + "\1\20\7\14\2\22\7\14\1\22\3\14\5\20\1\14" + - "\2\23\1\24\1\25\1\26\1\14\4\26\1\27\1\14" + - "\4\26\1\14\1\30\3\14\4\26\2\14\3\26\1\14" + + "\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\1\14" + - "\4\34\5\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\15\14" + - "\1\40\25\14\1\36\22\14\2\32\1\33\1\25\1\41" + - "\1\42\1\43\1\44\1\45\2\46\1\14\2\46\1\47" + - "\1\46\1\14\1\46\1\14\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\1\14\4\72\1\73\1\74\3\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" + - "\3\14\1\116\4\14\1\114\11\14\1\115\7\14\1\36" + - "\22\14\2\32\1\33\1\25\1\117\1\120\5\117\1\14" + - "\4\117\1\14\1\117\1\14\1\121\1\14\4\117\1\122" + - "\1\120\3\117\1\120\1\117\1\123\1\124\1\125\1\126" + - "\2\14\1\56\1\36\1\14\1\60\1\61\1\127\1\63" + - "\1\64\1\65\1\66\1\130\3\14\5\117\1\14\2\32" + - "\1\33\1\25\14\14\1\131\10\14\1\132\12\14\1\133" + - "\1\134\1\135\1\36\1\14\1\136\1\137\1\103\1\140" + - "\1\141\1\142\1\143\1\144\1\145\1\146\1\147\5\14" + - "\1\150\1\151\1\32\1\33\1\25\35\150\1\152\1\153" + - "\1\154\1\155\1\150\1\56\1\36\21\150\1\14\2\32" + - "\1\33\66\14\74\0\1\15\73\0\1\17\71\0\1\156" + - "\14\20\1\157\1\0\1\160\1\161\1\0\4\20\1\0" + - "\6\20\24\0\5\20\5\0\1\162\1\0\5\162\1\0" + - "\4\162\5\0\4\162\2\0\3\162\1\0\1\162\24\0" + - "\5\162\1\22\3\0\66\22\2\0\1\23\73\0\1\25" + - "\72\0\1\26\1\27\4\26\2\27\4\26\1\0\1\163" + - "\1\160\1\164\1\0\4\26\1\0\1\27\3\26\1\27" + - "\1\26\24\0\5\26\5\0\14\27\2\0\1\160\1\164" + - "\1\0\4\27\1\0\6\27\24\0\5\27\5\0\1\165" + - "\1\0\5\165\1\0\4\165\5\0\4\165\2\0\3\165" + - "\1\0\1\165\24\0\5\165\1\31\3\0\66\31\2\0" + - "\1\32\74\0\1\34\1\35\4\34\2\35\4\34\1\0" + - "\1\163\3\0\4\34\1\0\1\35\3\34\1\35\1\34" + - "\24\0\5\34\5\0\14\35\5\0\4\35\1\0\6\35" + - "\24\0\5\35\1\36\3\0\66\36\4\0\1\37\113\0" + - "\2\166\1\167\1\170\45\0\1\46\1\171\12\46\3\0" + - "\1\46\1\0\4\46\1\0\1\171\5\46\24\0\5\46" + - "\6\0\1\42\24\0\1\42\3\0\1\42\37\0\3\46" + - "\1\171\10\46\3\0\1\46\1\0\4\46\1\0\6\46" + - "\24\0\2\46\1\172\2\46\5\0\14\46\3\0\1\46" + - "\1\0\4\46\1\0\6\46\24\0\2\173\3\46\5\0" + - "\1\46\1\174\12\46\3\0\1\46\1\0\4\46\1\0" + - "\1\174\5\46\24\0\5\46\5\0\14\46\3\0\1\46" + - "\1\0\4\46\1\0\6\46\24\0\5\46\5\0\2\46" + - "\1\175\11\46\3\0\1\46\1\0\1\175\3\46\1\0" + - "\6\46\24\0\5\46\6\0\1\176\20\0\1\176\3\0" + - "\6\176\25\0\1\176\36\0\1\177\44\0\1\200\24\0" + - "\1\200\36\0\25\201\1\202\14\201\1\203\27\201\25\204" + - "\1\205\15\204\1\203\26\204\25\206\1\207\16\206\1\203" + - "\25\206\5\0\14\46\3\0\1\46\1\0\4\46\1\0" + - "\6\46\24\0\2\210\3\46\5\0\14\46\3\0\1\46" + - "\1\0\1\46\1\211\2\46\1\0\6\46\24\0\4\46" + - "\1\211\5\0\14\72\3\0\1\72\1\0\4\72\1\0" + - "\6\72\24\0\5\72\21\0\1\212\55\0\14\72\3\0" + - "\1\72\1\0\2\213\1\214\1\215\1\0\6\72\24\0" + - "\5\72\21\0\1\216\23\0\1\217\1\220\44\0\1\221" + - "\24\0\1\222\44\0\1\220\132\0\1\223\72\0\1\224" + - "\72\0\1\75\22\0\1\225\22\0\1\225\47\0\1\226" + - "\60\0\14\117\1\0\1\117\1\0\6\117\1\0\6\117" + - "\24\0\5\117\6\0\1\120\24\0\1\120\3\0\1\120" + - "\40\0\1\227\20\0\1\227\3\0\6\227\25\0\1\227" + - "\36\0\1\230\44\0\1\231\24\0\1\231\36\0\25\232" + - "\1\233\14\232\1\234\27\232\25\235\1\236\15\235\1\234" + - "\26\235\25\237\1\240\16\237\1\234\25\237\21\0\1\241" + - "\71\0\1\242\23\0\1\243\1\244\44\0\1\245\24\0" + - "\1\246\44\0\1\244\132\0\1\247\72\0\1\250\72\0" + - "\1\132\5\0\2\150\3\0\42\150\2\0\21\150\2\152" + - "\3\251\20\152\1\252\14\152\1\150\4\152\2\251\21\152" + - "\2\153\3\253\20\153\1\254\15\153\1\150\3\153\2\253" + - "\21\153\2\154\3\255\20\154\1\256\16\154\1\150\2\154" + - "\2\255\21\154\2\155\3\257\20\155\1\260\20\155\1\150" + - "\2\257\21\155\4\0\1\156\2\0\1\261\5\0\1\262" + - "\3\0\1\157\4\0\1\261\11\0\1\262\35\0\1\157" + - "\110\0\1\263\71\0\1\264\53\0\14\162\2\0\1\264" + - "\2\0\4\162\1\0\6\162\24\0\5\162\1\265\3\0" + - "\66\265\5\0\14\165\2\0\1\264\2\0\4\165\1\0" + - "\6\165\24\0\5\165\5\0\3\46\1\266\10\46\3\0" + - "\1\46\1\0\4\46\1\0\6\46\24\0\5\46\1\201" + - "\3\0\66\201\1\204\3\0\66\204\1\206\3\0\66\206" + - "\5\0\14\46\3\0\1\46\1\0\4\46\1\0\6\46" + - "\24\0\2\46\1\267\2\46\5\0\14\46\3\0\1\46" + - "\1\0\4\46\1\0\6\46\24\0\2\46\1\270\2\46" + - "\20\0\1\271\70\0\1\271\52\0\1\232\3\0\66\232" + - "\1\235\3\0\66\235\1\237\3\0\66\237\25\251\1\272" + - "\14\251\1\273\27\251\1\152\1\150\2\0\1\251\42\152" + - "\2\251\21\152\25\253\1\274\15\253\1\273\26\253\1\153" + - "\1\150\2\0\1\253\42\153\2\253\21\153\25\255\1\275" + - "\16\255\1\273\25\255\1\154\1\150\2\0\1\255\42\154" + - "\2\255\21\154\25\257\1\276\20\257\1\273\23\257\1\155" + - "\1\150\2\0\1\257\42\155\2\257\21\155\15\0\1\277" + - "\22\0\1\277\47\0\1\300\53\0\1\251\3\0\66\251" + - "\1\253\3\0\66\253\1\255\3\0\66\255\1\257\3\0" + - "\66\257\20\0\1\301\70\0\1\301\52\0"; + "\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\25\203\1\204\14\203\1\205\27\203\25\206" + + "\1\207\15\206\1\205\26\206\25\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\25\234" + + "\1\235\14\234\1\236\27\234\25\237\1\240\15\237\1\236" + + "\26\237\25\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" + + "\3\253\20\153\1\254\14\153\1\151\4\153\2\253\21\153" + + "\2\154\3\255\20\154\1\256\15\154\1\151\3\154\2\255" + + "\21\154\2\155\3\257\20\155\1\260\16\155\1\151\2\155" + + "\2\257\21\155\2\156\3\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\25\253\1\274\14\253\1\275\27\253" + + "\1\153\1\151\2\0\1\253\42\153\2\253\21\153\25\255" + + "\1\276\15\255\1\275\26\255\1\154\1\151\2\0\1\255" + + "\42\154\2\255\21\154\25\257\1\277\16\257\1\275\25\257" + + "\1\155\1\151\2\0\1\257\42\155\2\257\21\155\25\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[6322]; + int[] result = new int[6380]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -431,16 +437,16 @@ public class _M68kLexer implements FlexLexer { 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\5\1\1\11" + - "\10\1\2\11\1\1\1\11\2\1\3\11\1\1\4\11" + - "\11\1\1\0\4\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\1\1\1\0" + - "\1\1\1\0\1\1\2\0\3\11\3\1\1\11\1\0" + - "\1\11\6\0"; + "\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" + + "\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" + + "\1\1\1\0\1\1\1\0\1\1\2\0\3\11\3\1" + + "\1\11\1\0\1\11\6\0"; private static int[] zzUnpackAttribute() { - int[] result = new int[193]; + int[] result = new int[195]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -763,40 +769,40 @@ public class _M68kLexer implements FlexLexer { return BAD_CHARACTER; } // fall through - case 96: + case 97: break; case 2: { return WHITE_SPACE; } // fall through - case 97: + case 98: break; case 3: { yybegin(NOSOL); return WHITE_SPACE; } // fall through - case 98: + case 99: break; case 4: { yybegin(INSTRPART); return GLOBAL_LABEL_DEF; } // fall through - case 99: + case 100: break; case 5: { return COMMENT; } // fall through - case 100: + case 101: break; case 6: { yybegin(YYINITIAL); return WHITE_SPACE; } // fall through - case 101: + case 102: break; case 7: { if (isAsmMnemonicWithSize(yytext())) { @@ -820,610 +826,616 @@ public class _M68kLexer implements FlexLexer { return MACRO_INVOKATION; } // fall through - case 102: + case 103: break; case 8: { yybegin(MACROCALL); return MACRO_INVOKATION; } // fall through - case 103: + case 104: break; case 9: { yybegin(YYINITIAL); return COMMENT; } // fall through - case 104: + case 105: break; case 10: { yybegin(YYINITIAL); return EOL; } // fall through - case 105: + case 106: break; case 11: { yybegin(WAITEOL); return COMMENT; } // fall through - case 106: + case 107: break; case 12: { yybegin(ASMOPS); return WHITE_SPACE; } // fall through - case 107: + case 108: break; case 13: { yybegin(ASMOPS_OP); return SYMBOL; } // fall through - case 108: + case 109: break; case 14: { yybegin(ASMOPS_OP); return DECIMAL; } // fall through - case 109: + case 110: break; case 15: { return SEPARATOR; } // fall through - case 110: + case 111: break; case 16: { return HASH; } // fall through - case 111: + case 112: break; case 17: { return OP_BITWISE_XOR; } // fall through - case 112: + case 113: break; case 18: { return ROUND_L; } // fall through - case 113: + case 114: break; case 19: { yybegin(ASMOPS_OP); return ROUND_R; } // fall through - case 114: + case 115: break; case 20: { return OP_UNARY_NOT; } // fall through - case 115: + case 116: break; case 21: { return OP_UNARY_COMPL; } // fall through - case 116: + case 117: break; case 22: { return OP_PLUS; } // fall through - case 117: + case 118: break; case 23: { return OP_MINUS; } // fall through - case 118: + case 119: break; case 24: { yybegin(ASMOPS_OP); return CURRENT_PC_SYMBOL; } // fall through - case 119: + case 120: break; case 25: { return SYMBOL; } // fall through - case 120: + case 121: break; case 26: { yybegin(ASMOPS); return OP_CMP_EQ; } // fall through - case 121: + case 122: break; case 27: { yybegin(ASMOPS); return OP_AR_MOD; } // fall through - case 122: + case 123: break; case 28: { yybegin(ASMOPS); return OP_CMP_LT; } // fall through - case 123: + case 124: break; case 29: { yybegin(ASMOPS); return OP_CMP_GT; } // fall through - case 124: + case 125: break; case 30: { yybegin(ASMOPS); return SEPARATOR; } // fall through - case 125: + case 126: break; case 31: { yybegin(ASMOPS); return OP_BITWISE_XOR; } // fall through - case 126: + case 127: break; case 32: { yybegin(ASMOPS); return ROUND_L; } // fall through - case 127: + case 128: break; case 33: { return ROUND_R; } // fall through - case 128: + case 129: break; case 34: { yybegin(ASMOPS); return OP_BITWISE_OR; } // fall through - case 129: + case 130: break; case 35: { yybegin(ASMOPS); return OP_UNARY_COMPL; } // fall through - case 130: + case 131: break; case 36: { yybegin(ASMOPS); return OP_PLUS; } // fall through - case 131: + case 132: break; case 37: { yybegin(ASMOPS); return OP_MINUS; } // fall through - case 132: + case 133: break; case 38: { yybegin(ASMOPS); return OP_AR_MUL; } // fall through - case 133: + case 134: break; case 39: { yybegin(ASMOPS); return OP_BITWISE_AND; } // fall through - case 134: + case 135: break; case 40: { yybegin(ASMOPS); return OP_AR_DIV; } // fall through - case 135: - break; - case 41: { - yybegin(EXPR); - return OP_ASSIGN; - } - // fall through case 136: break; - case 42: { - yybegin(EXPR_OP); - return SYMBOL; + case 41: { + return COLON; } // fall through case 137: break; - case 43: { - yybegin(EXPR_OP); - return DECIMAL; + case 42: { + yybegin(EXPR); + return OP_ASSIGN; } // fall through case 138: break; - case 44: { + case 43: { yybegin(EXPR_OP); - return ROUND_R; + return SYMBOL; } // fall through case 139: break; - case 45: { + case 44: { yybegin(EXPR_OP); - return CURRENT_PC_SYMBOL; + return DECIMAL; } // fall through case 140: break; - case 46: { - yybegin(EXPR); - return OP_CMP_EQ; + case 45: { + yybegin(EXPR_OP); + return ROUND_R; } // fall through case 141: break; - case 47: { - yybegin(EXPR); - return OP_AR_MOD; + case 46: { + yybegin(EXPR_OP); + return CURRENT_PC_SYMBOL; } // fall through case 142: break; - case 48: { + case 47: { yybegin(EXPR); - return OP_CMP_LT; + return OP_CMP_EQ; } // fall through case 143: break; - case 49: { + case 48: { yybegin(EXPR); - return OP_CMP_GT; + return OP_AR_MOD; } // fall through case 144: break; - case 50: { + case 49: { yybegin(EXPR); - return SEPARATOR; + return OP_CMP_LT; } // fall through case 145: break; - case 51: { + case 50: { yybegin(EXPR); - return OP_BITWISE_XOR; + return OP_CMP_GT; } // fall through case 146: break; - case 52: { + case 51: { yybegin(EXPR); - return ROUND_L; + return SEPARATOR; } // fall through case 147: break; - case 53: { + case 52: { yybegin(EXPR); - return OP_BITWISE_OR; + return OP_BITWISE_XOR; } // fall through case 148: break; - case 54: { + case 53: { yybegin(EXPR); - return OP_UNARY_COMPL; + return ROUND_L; } // fall through case 149: break; - case 55: { + case 54: { yybegin(EXPR); - return OP_PLUS; + return OP_BITWISE_OR; } // fall through case 150: break; - case 56: { + case 55: { yybegin(EXPR); - return OP_MINUS; + return OP_UNARY_COMPL; } // fall through case 151: break; - case 57: { + case 56: { yybegin(EXPR); - return OP_AR_MUL; + return OP_PLUS; } // fall through case 152: break; - case 58: { + case 57: { yybegin(EXPR); - return OP_BITWISE_AND; + return OP_MINUS; } // fall through case 153: break; - case 59: { + case 58: { yybegin(EXPR); - return OP_AR_DIV; + return OP_AR_MUL; } // fall through case 154: break; - case 60: { - return STRINGLIT; + case 59: { + yybegin(EXPR); + return OP_BITWISE_AND; } // fall through case 155: break; + case 60: { + yybegin(EXPR); + return OP_AR_DIV; + } + // fall through + case 156: + break; case 61: { + return STRINGLIT; + } + // fall through + case 157: + break; + case 62: { yybegin(ASSIGNMENT); yypushback(pushbackAssignment(yytext())); return SYMBOLDEF; } // fall through - case 156: + case 158: break; - case 62: { + case 63: { yybegin(INSTRPART); return LOCAL_LABEL_DEF; } // fall through - case 157: - break; - case 63: { - return OPSIZE_BS; - } - // fall through - case 158: - break; - case 64: { - return OPSIZE_W; - } - // fall through case 159: break; - case 65: { - return OPSIZE_L; + case 64: { + return OPSIZE_BS; } // fall through case 160: break; - case 66: { - yybegin(ASMOPS_OP); - return AREG; + case 65: { + return OPSIZE_W; } // fall through case 161: break; - case 67: { - yybegin(ASMOPS_OP); - return REG_SR; + case 66: { + return OPSIZE_L; } // fall through case 162: break; - case 68: { + case 67: { yybegin(ASMOPS_OP); - return PC; + return AREG; } // fall through case 163: break; - case 69: { + case 68: { yybegin(ASMOPS_OP); - return DREG; + return REG_SR; } // fall through case 164: break; - case 70: { + case 69: { yybegin(ASMOPS_OP); - return HEXADECIMAL; + return PC; } // fall through case 165: break; - case 71: { + case 70: { yybegin(ASMOPS_OP); - return BINARY; + return DREG; } // fall through case 166: break; - case 72: { + case 71: { yybegin(ASMOPS_OP); - return OCTAL; + return HEXADECIMAL; } // fall through case 167: break; - case 73: { + case 72: { yybegin(ASMOPS_OP); - return STRINGLIT; + return BINARY; } // fall through case 168: break; - case 74: { - yybegin(ASMOPS); - return OP_CMP_LT_EQ; + case 73: { + yybegin(ASMOPS_OP); + return OCTAL; } // fall through case 169: break; - case 75: { - yybegin(ASMOPS); - return OP_AR_SHIFT_L; + case 74: { + yybegin(ASMOPS_OP); + return STRINGLIT; } // fall through case 170: break; - case 76: { + case 75: { yybegin(ASMOPS); - return OP_CMP_NOT_EQ; + return OP_CMP_LT_EQ; } // fall through case 171: break; - case 77: { + case 76: { yybegin(ASMOPS); - return OP_CMP_GT_EQ; + return OP_AR_SHIFT_L; } // fall through case 172: break; - case 78: { + case 77: { yybegin(ASMOPS); - return OP_AR_SHIFT_R; + return OP_CMP_NOT_EQ; } // fall through case 173: break; - case 79: { + case 78: { yybegin(ASMOPS); - return OP_LOGICAL_AND; + return OP_CMP_GT_EQ; } // fall through case 174: break; - case 80: { + case 79: { yybegin(ASMOPS); - return OP_LOGICAL_OR; + return OP_AR_SHIFT_R; } // fall through case 175: break; - case 81: { - yybegin(EXPR_OP); - return HEXADECIMAL; + case 80: { + yybegin(ASMOPS); + return OP_LOGICAL_AND; } // fall through case 176: break; - case 82: { - yybegin(EXPR_OP); - return BINARY; + case 81: { + yybegin(ASMOPS); + return OP_LOGICAL_OR; } // fall through case 177: break; - case 83: { + case 82: { yybegin(EXPR_OP); - return OCTAL; + return HEXADECIMAL; } // fall through case 178: break; - case 84: { + case 83: { yybegin(EXPR_OP); - return STRINGLIT; + return BINARY; } // fall through case 179: break; - case 85: { - yybegin(EXPR); - return OP_CMP_LT_EQ; + case 84: { + yybegin(EXPR_OP); + return OCTAL; } // fall through case 180: break; - case 86: { - yybegin(EXPR); - return OP_AR_SHIFT_L; + case 85: { + yybegin(EXPR_OP); + return STRINGLIT; } // fall through case 181: break; - case 87: { + case 86: { yybegin(EXPR); - return OP_CMP_NOT_EQ; + return OP_CMP_LT_EQ; } // fall through case 182: break; - case 88: { + case 87: { yybegin(EXPR); - return OP_CMP_GT_EQ; + return OP_AR_SHIFT_L; } // fall through case 183: break; - case 89: { + case 88: { yybegin(EXPR); - return OP_AR_SHIFT_R; + return OP_CMP_NOT_EQ; } // fall through case 184: break; - case 90: { + case 89: { yybegin(EXPR); - return OP_LOGICAL_AND; + return OP_CMP_GT_EQ; } // fall through case 185: break; - case 91: { + case 90: { yybegin(EXPR); - return OP_LOGICAL_OR; + return OP_AR_SHIFT_R; } // fall through case 186: break; - case 92: { - yybegin(ASMOPS_OP); - return REG_USP; + case 91: { + yybegin(EXPR); + return OP_LOGICAL_AND; } // fall through case 187: break; - case 93: { - yybegin(ASMOPS_OP); - return REG_CCR; + case 92: { + yybegin(EXPR); + return OP_LOGICAL_OR; } // fall through case 188: break; - case 94: { + case 93: { yybegin(ASMOPS_OP); - return REG_VBR; + return REG_USP; } // fall through case 189: break; + case 94: { + yybegin(ASMOPS_OP); + return REG_CCR; + } + // fall through + case 190: + break; case 95: { + yybegin(ASMOPS_OP); + return REG_VBR; + } + // fall through + case 191: + break; + case 96: { yybegin(EXPR); return EQU; } // fall through - case 190: + case 192: break; default: zzScanError(ZZ_NO_MATCH); diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java b/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java index a97e86f..682625e 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/parser/M68kParser.java @@ -411,7 +411,7 @@ public class M68kParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // SYMBOLDEF (OP_ASSIGN|EQU) expr + // SYMBOLDEF COLON? (OP_ASSIGN|EQU) expr public static boolean Assignment(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Assignment")) return false; if (!nextTokenIs(b, SYMBOLDEF)) return false; @@ -419,14 +419,22 @@ public class M68kParser implements PsiParser, LightPsiParser { Marker m = enter_section_(b); r = consumeToken(b, SYMBOLDEF); r = r && Assignment_1(b, l + 1); + r = r && Assignment_2(b, l + 1); r = r && expr(b, l + 1, -1); exit_section_(b, m, ASSIGNMENT, r); return r; } - // OP_ASSIGN|EQU + // COLON? private static boolean Assignment_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Assignment_1")) return false; + consumeToken(b, COLON); + return true; + } + + // OP_ASSIGN|EQU + private static boolean Assignment_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "Assignment_2")) return false; boolean r; r = consumeToken(b, OP_ASSIGN); if (!r) r = consumeToken(b, EQU); diff --git a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java index 8838787..d361140 100644 --- a/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java +++ b/src/main/gen/de/platon42/intellij/plugins/m68k/psi/M68kTypes.java @@ -71,6 +71,7 @@ public interface M68kTypes { IElementType AREG = new M68kTokenType("AREG"); IElementType BINARY = new M68kTokenType("BINARY"); + IElementType COLON = new M68kTokenType("COLON"); IElementType COMMENT = new M68kTokenType("COMMENT"); IElementType CURRENT_PC_SYMBOL = new M68kTokenType("CURRENT_PC_SYMBOL"); IElementType DATA_DIRECTIVE = new M68kTokenType("DATA_DIRECTIVE"); diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/lexer/LexerUtil.kt b/src/main/java/de/platon42/intellij/plugins/m68k/lexer/LexerUtil.kt index f374e7a..7e0791e 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/lexer/LexerUtil.kt +++ b/src/main/java/de/platon42/intellij/plugins/m68k/lexer/LexerUtil.kt @@ -5,7 +5,7 @@ import de.platon42.intellij.plugins.m68k.asm.M68kIsa.mnemonics object LexerUtil { - private val ASSIGNMENT_SEPARATORS = charArrayOf(' ', '\t') + private val ASSIGNMENT_SEPARATORS = charArrayOf(' ', '\t', '=', ':') @JvmStatic fun isAsmMnemonic(text: CharSequence) = mnemonics.contains(text.toString().lowercase()) @@ -23,10 +23,6 @@ object LexerUtil { @JvmStatic fun pushbackAssignment(text: CharSequence): Int { - val spacePos = text.indexOfAny(ASSIGNMENT_SEPARATORS) - if (spacePos > -1) { - return text.length - spacePos - } - return text.length - text.indexOf('=') + return text.length - text.indexOfAny(ASSIGNMENT_SEPARATORS) } } \ No newline at end of file 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 c024d96..4c75f6f 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 @@ -28,7 +28,7 @@ EOL=\R WHITE_SPACE=\p{Blank}+ AREG=((a[0-7])|sp) DREG=(d[0-7]) -ASSIGNMENT=(([:letter:]|_)(([:letter:]|[:digit:])|_)*((\p{Blank}+equ\p{Blank}+)|(\p{Blank}+set\p{Blank}+)|\p{Blank}*=\p{Blank}*)) +ASSIGNMENT=(([:letter:]|_)(([:letter:]|[:digit:])|_)*:?((\p{Blank}+equ\p{Blank}+)|(\p{Blank}+set\p{Blank}+)|\p{Blank}*=\p{Blank}*)) LOCAL_LABEL=(\.([:letter:]|_)(([:letter:]|[:digit:])|_)*:?)|(([:letter:]|_)(([:letter:]|[:digit:])|_)*\$:?) LOCAL_LABEL_WC=(\.([:letter:]|_)(([:letter:]|[:digit:])|_)*:)|(([:letter:]|_)(([:letter:]|[:digit:])|_)*\$:) GLOBAL_LABEL=(([:letter:]|_)(([:letter:]|[:digit:])|_)*:?:?) @@ -125,6 +125,7 @@ HASH_COMMENT=([#;*].*+) "equ"|"set" { yybegin(EXPR); return EQU; } + ":" { return COLON; } "=" { yybegin(EXPR); return OP_ASSIGN; } {COMMENT} { yybegin(WAITEOL); return COMMENT; } diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf index 0ca18ec..3ba6643 100644 --- a/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf +++ b/src/main/java/de/platon42/intellij/plugins/m68k/m68k.bnf @@ -126,7 +126,7 @@ statement ::= (Assignment private statement_recover ::= !(EOL) -Assignment ::= SYMBOLDEF (OP_ASSIGN|EQU) expr +Assignment ::= SYMBOLDEF COLON? (OP_ASSIGN|EQU) expr private LabelInsts ::= LabelWithInstruction | LabelOnly | InstructionOnly diff --git a/src/test/java/de/platon42/intellij/plugins/m68k/parser/AssignmentTest.kt b/src/test/java/de/platon42/intellij/plugins/m68k/parser/AssignmentTest.kt index d419d47..d81c0fe 100644 --- a/src/test/java/de/platon42/intellij/plugins/m68k/parser/AssignmentTest.kt +++ b/src/test/java/de/platon42/intellij/plugins/m68k/parser/AssignmentTest.kt @@ -20,7 +20,17 @@ internal class AssignmentTest : AbstractParsingTest() { @Test internal fun assignment_with_local_label(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { - testGoodSyntax(testCase, "FOO=.local-.bar\n") + testGoodSyntax(testCase, "FOO= .local-.bar\n") + } + + @Test + internal fun assignment_with_colon(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, "FOO: = 123\n") + } + + @Test + internal fun assignment_with_colon_and_set(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) { + testGoodSyntax(testCase, "FOO: set 123\n") } @Test diff --git a/src/test/resources/parser/assignment/assignment_with_colon.txt b/src/test/resources/parser/assignment/assignment_with_colon.txt new file mode 100644 index 0000000..72df188 --- /dev/null +++ b/src/test/resources/parser/assignment/assignment_with_colon.txt @@ -0,0 +1,11 @@ +Assembly File: a.asm + M68kStatementImpl(STATEMENT) + M68kAssignmentImpl(ASSIGNMENT) + PsiElement(M68kTokenType.SYMBOLDEF)('FOO') + PsiElement(M68kTokenType.COLON)(':') + PsiWhiteSpace(' ') + PsiElement(M68kTokenType.OP_ASSIGN)('=') + PsiWhiteSpace(' ') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('123') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt b/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt new file mode 100644 index 0000000..42b543d --- /dev/null +++ b/src/test/resources/parser/assignment/assignment_with_colon_and_set.txt @@ -0,0 +1,11 @@ +Assembly File: a.asm + M68kStatementImpl(STATEMENT) + M68kAssignmentImpl(ASSIGNMENT) + PsiElement(M68kTokenType.SYMBOLDEF)('FOO') + PsiElement(M68kTokenType.COLON)(':') + PsiWhiteSpace(' ') + PsiElement(M68kTokenType.EQU)('set') + PsiWhiteSpace(' ') + M68kLiteralExprImpl(LITERAL_EXPR) + PsiElement(M68kTokenType.DECIMAL)('123') + PsiElement(M68kTokenType.EOL)('\n') \ No newline at end of file diff --git a/src/test/resources/parser/assignment/assignment_with_local_label.txt b/src/test/resources/parser/assignment/assignment_with_local_label.txt index 590f4c8..2c1218d 100644 --- a/src/test/resources/parser/assignment/assignment_with_local_label.txt +++ b/src/test/resources/parser/assignment/assignment_with_local_label.txt @@ -3,6 +3,7 @@ Assembly File: a.asm M68kAssignmentImpl(ASSIGNMENT) PsiElement(M68kTokenType.SYMBOLDEF)('FOO') PsiElement(M68kTokenType.OP_ASSIGN)('=') + PsiWhiteSpace(' ') M68kBinarySubExprImpl(BINARY_SUB_EXPR) M68kRefExprImpl(REF_EXPR) PsiElement(M68kTokenType.SYMBOL)('.local')