From ce4429d61e1dc9cafbeabd524720e48494916178 Mon Sep 17 00:00:00 2001 From: Helge Sverre Date: Mon, 10 Aug 2026 22:32:51 +0200 Subject: [PATCH] fix: add regex literal scope --- Sema.sublime-syntax | 12 ++++++++++++ tests/syntax_test_sema.sema | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/Sema.sublime-syntax b/Sema.sublime-syntax index c12aa59..c70dfcb 100644 --- a/Sema.sublime-syntax +++ b/Sema.sublime-syntax @@ -16,6 +16,7 @@ first_line_match: '^#!.*\bsema\b' contexts: main: - include: line-comment + - include: regex - include: string - include: quoted-expression - include: definition @@ -44,6 +45,17 @@ contexts: # --------------------------------------------------------------------- # STRINGS # --------------------------------------------------------------------- + regex: + - match: '#"' + scope: punctuation.definition.string.begin.sema string.regexp.sema + push: + - meta_scope: string.regexp.sema + - match: '\\.' + scope: string.regexp.sema + - match: '"' + scope: punctuation.definition.string.end.sema string.regexp.sema + pop: true + string: - match: '"' scope: punctuation.definition.string.begin.sema diff --git a/tests/syntax_test_sema.sema b/tests/syntax_test_sema.sema index 1214c75..508009b 100644 --- a/tests/syntax_test_sema.sema +++ b/tests/syntax_test_sema.sema @@ -30,3 +30,13 @@ ;^^^^^^^^^^^^ support.function.sema ; ^^ constant.language.boolean.sema ; ^^^ constant.language.nil.sema + +(regex/match? #"\d+" "abc123") +;^^^^^^^^^^^^ support.function.sema +; ^^^^^^ string.regexp.sema + +(regex/match? #"\"[^\"]+\"" text) +; ^^^^^^^^^^^^^ string.regexp.sema + +(regex/match? #"\\" text) +; ^^^^^ string.regexp.sema