From d52dfd87d54d45d876747d3c9e9cee31c1e0cef3 Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Tue, 12 Oct 2021 02:30:45 +0300 Subject: [PATCH 1/2] Improve labels and numeric syntax highlighting --- source/WebApp/components/internal/codemirror/mode-asm.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/WebApp/components/internal/codemirror/mode-asm.ts b/source/WebApp/components/internal/codemirror/mode-asm.ts index 275d6849b..6cd5b0be3 100644 --- a/source/WebApp/components/internal/codemirror/mode-asm.ts +++ b/source/WebApp/components/internal/codemirror/mode-asm.ts @@ -26,7 +26,7 @@ CodeMirror.defineMode('asm', () => { }, token(stream) { - if (stream.eatSpace() || stream.eat('[') || stream.eat(']')) { + if (stream.eatSpace() || stream.eat(/[[\]+-]/)) { return null; } @@ -36,7 +36,7 @@ CodeMirror.defineMode('asm', () => { } // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (stream.match(/\w+:/)) { + if (stream.match(/L[0-9a-f]{4,}/)) { return 'tag'; } @@ -59,6 +59,11 @@ CodeMirror.defineMode('asm', () => { } } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (stream.match(/(0x)?[0-9a-f]+/)) { + return 'string'; + } + stream.match(/\S+/); return null; } From bf3775165794ef35cdce97f03ab20054fcf255bb Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Tue, 12 Oct 2021 16:16:49 +0300 Subject: [PATCH 2/2] Include colon in tag class --- source/WebApp/components/internal/codemirror/mode-asm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/WebApp/components/internal/codemirror/mode-asm.ts b/source/WebApp/components/internal/codemirror/mode-asm.ts index 6cd5b0be3..3ca9fccab 100644 --- a/source/WebApp/components/internal/codemirror/mode-asm.ts +++ b/source/WebApp/components/internal/codemirror/mode-asm.ts @@ -36,7 +36,7 @@ CodeMirror.defineMode('asm', () => { } // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (stream.match(/L[0-9a-f]{4,}/)) { + if (stream.match(/L[0-9a-f]{4,}:?/)) { return 'tag'; }