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