From 639f9cb02183d1bdf17f13a4045320f007c35020 Mon Sep 17 00:00:00 2001 From: laniakea64 Date: Mon, 30 Sep 2024 20:03:17 -0400 Subject: [PATCH] Initial support for `\u{...}` escape sequences --- syntax/just.vim | 33 +++++++++++++++++++-------------- tests/cases/expressions.html | 10 ++++++++++ tests/cases/expressions.just | 10 ++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/syntax/just.vim b/syntax/just.vim index c0d5f04..08eb187 100644 --- a/syntax/just.vim +++ b/syntax/just.vim @@ -32,8 +32,8 @@ syn region justBacktick start=/`/ end=/`/ syn region justBacktick start=/```/ end=/```/ syn region justRawString start=/'/ end=/'/ syn region justRawString start=/'''/ end=/'''/ -syn region justString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=justStringEscapeSequence -syn region justString start=/"""/ skip=/\\\\\|\\"/ end=/"""/ contains=justStringEscapeSequence +syn region justString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=justStringEscapeSequence,justStringUEscapeSequence +syn region justString start=/"""/ skip=/\\\\\|\\"/ end=/"""/ contains=justStringEscapeSequence,justStringUEscapeSequence syn region justShellExpandRawString start=/\v\k@1[private] hidden := 'foo' not_hidden := '-' + hidden + +u_escape := "test \u{1F916} test" +u_escape_triple_quoted := """ + test + \u{1f9Ea} + test +""" +u_escape_shell_expanded := x"shell ${FOO:-(\u{1f41a})} shell" +u_escape_in_replace_regex := replace_regex('foo', '^.', "\u{46}") +not_u_escape := '\u{1F916}' diff --git a/tests/cases/expressions.just b/tests/cases/expressions.just index 5ba95b5..9129452 100644 --- a/tests/cases/expressions.just +++ b/tests/cases/expressions.just @@ -54,3 +54,13 @@ now_utc := datetime_utc('%Y-%m-%d %H:%M:%S %Z') [private] hidden := 'foo' not_hidden := '-' + hidden + +u_escape := "test \u{1F916} test" +u_escape_triple_quoted := """ + test + \u{1f9Ea} + test +""" +u_escape_shell_expanded := x"shell ${FOO:-(\u{1f41a})} shell" +u_escape_in_replace_regex := replace_regex('foo', '^.', "\u{46}") +not_u_escape := '\u{1F916}'