From aad339c3f1ece572a81d78a1e2d6eb21522c2b64 Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Fri, 16 Jul 2021 17:03:35 +0200 Subject: [PATCH] Added string quote handler. Made strings abort on line break to improve performance. --- .../plugins/m68k/lexer/_M68kLexer.java | 63 ++++++++++--------- .../plugins/m68k/M68kStringQuoteHandler.java | 10 +++ .../plugins/m68k/lexer/_M68kLexer.flex | 4 +- src/main/resources/META-INF/plugin.xml | 1 + 4 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 src/main/java/de/platon42/intellij/plugins/m68k/M68kStringQuoteHandler.java 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 d0c684b..6f2d3d6 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 @@ -347,31 +347,33 @@ public class _M68kLexer implements FlexLexer { "\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" + + "\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" + @@ -386,11 +388,12 @@ public class _M68kLexer implements FlexLexer { "\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\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" + diff --git a/src/main/java/de/platon42/intellij/plugins/m68k/M68kStringQuoteHandler.java b/src/main/java/de/platon42/intellij/plugins/m68k/M68kStringQuoteHandler.java new file mode 100644 index 0000000..7e53eab --- /dev/null +++ b/src/main/java/de/platon42/intellij/plugins/m68k/M68kStringQuoteHandler.java @@ -0,0 +1,10 @@ +package de.platon42.intellij.plugins.m68k; + +import com.intellij.codeInsight.editorActions.SimpleTokenSetQuoteHandler; +import de.platon42.intellij.plugins.m68k.psi.M68kTypes; + +public class M68kStringQuoteHandler extends SimpleTokenSetQuoteHandler { + public M68kStringQuoteHandler() { + super(M68kTypes.STRINGLIT); + } +} 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 4c75f6f..459902f 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 @@ -45,8 +45,8 @@ BINARY=(%[01]+) HEXADECIMAL=(\$[0-9a-f]+) OCTAL=(@[0-7]+) DECIMAL=([0-9]+) -STRINGLIT=(`([^`\\]|\\.)*`|'([^'\\]|\\.)*'|\"([^\"\\]|\\.)*\") -PLAINPARAM=(`([^`\\]|\\.)*`|'([^'\\]|\\.)*'|\"([^\"\\]|\\.)*\")|<([^>\\]|\\.)*>|([^,;\p{Blank}\r\n])+ // why does \R not work, I have no idea +STRINGLIT=(`([^`\\\r\n]|\\.)*`|'([^'\\\r\n]|\\.)*'|\"([^\"\\\r\n]|\\.)*\") +PLAINPARAM=(`([^`\\\r\n]|\\.)*`|'([^'\\\r\n]|\\.)*'|\"([^\"\\\r\n]|\\.)*\")|<([^>\\\r\n]|\\.)*>|([^,;\p{Blank}\r\n])+ // why does \R not work, I have no idea COMMENT=([;].*+) HASH_COMMENT=([#;*].*+) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e5ae8b1..9257a72 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -22,6 +22,7 @@ implementationClass="de.platon42.intellij.plugins.m68k.syntax.M68kSyntaxHighlighterFactory"/> +