From 9a10cac598ddd9944114062676f8f5f7f5f6893a Mon Sep 17 00:00:00 2001 From: Jakob Nybo Nissen Date: Sat, 3 Dec 2022 02:49:50 +0100 Subject: [PATCH] Improve Julia syntax highlighting (#2643) Specifically, do not allow multiline single-quote strings, which are not a thing in Julia. The existing rule broke when adjoints were used, such as `b = a'`. The syntax rules have been copied from Rust, which also uses single ticks for character literals, and also uses the ' symbol for things unrelated to chars. --- runtime/syntax/julia.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/syntax/julia.yaml b/runtime/syntax/julia.yaml index fda0e333..c96ef0f3 100644 --- a/runtime/syntax/julia.yaml +++ b/runtime/syntax/julia.yaml @@ -39,13 +39,12 @@ rules: rules: - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})" + # Lifted from Rust's syntax highlighting + - constant.string: "'(\\\\.|.)'" - constant.string: - start: "'" + start: "'\"" end: "'" - skip: "\\\\." - rules: - - error: "..+" - - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})" + rules: [] - comment: start: "#="