diff --git a/CHANGELOG.md b/CHANGELOG.md index 838fe4332..caad86174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Changes to Calva. ## [Unreleased] +- [Fix: Lexing regex literal tokenisation](https://github.com/BetterThanTomorrow/calva/issues/463) ## [2.0.60] - 2019-11-11 - Re-enable default stylings for nREPL status bar items. diff --git a/src/webview/clojure-lexer.ts b/src/webview/clojure-lexer.ts index e212a9692..7ce69e414 100644 --- a/src/webview/clojure-lexer.ts +++ b/src/webview/clojure-lexer.ts @@ -53,8 +53,8 @@ toplevel.terminal(/:[^()[\]\{\}#,~@'`^\"\s;]*/, (l, m) => ({ type: "kw" })) toplevel.terminal(/[^()[\]\{\}#,~@'`^\"\s:;][^()[\]\{\}#,~@'`^\"\s;]*/, (l, m) => ({ type: "id" })) // complete string on a single line -toplevel.terminal(/"([^"\\]|\\.)*"/, (l, m) => ({ type: "str" })) -toplevel.terminal(/"([^"\\]|\\.)*/, (l, m) => ({ type: "str-start" })) +toplevel.terminal(/#?"([^"\\]|\\.)*"/, (l, m) => ({ type: "str" })) +toplevel.terminal(/#?"([^"\\]|\\.)*/, (l, m) => ({ type: "str-start" })) toplevel.terminal(/./, (l, m) => ({ type: "junk" })) /** This is the multi-line string grammar. It spits out 'str-end' once it is time to switch back to the 'toplevel' grammar, and 'str-inside' if the string continues. */