Skip to content

Commit

Permalink
Add triple backtick quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Aug 26, 2024
1 parent 4556045 commit 62a9d3c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CoffeeScript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,18 @@ contexts:
pop: 1

backtick-quoted-strings:
- match: \`{3}
scope: meta.string.heredoc.coffee string.quoted.script.coffee punctuation.definition.string.begin.coffee
embed: scope:source.jsx
embed_scope: meta.string.heredoc.coffee meta.embedded.coffee source.jsx.embedded.coffee
escape: '{{no_escape_behind}}`{3}'
escape_captures:
0: meta.string.heredoc.coffee string.quoted.script.coffee punctuation.definition.string.end.coffee
- match: \`
scope: meta.string.coffee string.quoted.script.coffee punctuation.definition.string.begin.coffee
embed: scope:source.jsx
embed_scope: meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee
escape: \`
escape: '{{no_escape_behind}}`'
escape_captures:
0: meta.string.coffee string.quoted.script.coffee punctuation.definition.string.end.coffee

Expand Down Expand Up @@ -764,6 +771,10 @@ variables:

ascii_space: '\t\n\f '

# A lookbehind used in embed..escape patterns, to check for unescaped characters
# in embed...escape statements.
no_escape_behind: (?<![^\\]\\)(?<![\\]{3})

identifier: '[a-zA-Z\$_]\w*'

component_names: '[A-Z][[:alnum:]_.-]*'
Expand Down
21 changes: 21 additions & 0 deletions tests/syntax_test_scope.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,27 @@ class App.Router extends Snakeskin.Router
# <- meta.string.heredoc.coffee string.quoted.single.coffee
#^ meta.string.heredoc.coffee string.quoted.single.coffee
# ^^^ meta.string.heredoc.coffee string.quoted.single.coffee punctuation.definition.string.end.coffee
# ^ - meta.string - string

```
# ^^^ meta.string.heredoc.coffee string.quoted.script.coffee punctuation.definition.string.begin.coffee
# ^ meta.string.heredoc.coffee meta.embedded.coffee source.jsx.embedded.coffee - string

var i = `back ${tick} string`;
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.coffee meta.embedded.coffee source.jsx.embedded.coffee - source.jsx source.jsx
# ^^^ keyword.declaration
# ^^^^^^ meta.string string.quoted.other.js
# ^^^^^^^ meta.string meta.interpolation.js
# ^^^^^^^ meta.string string.quoted.other.js
return (<h1>Hello {World}</h1>)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.coffee meta.embedded.coffee source.jsx.embedded.coffee - source.jsx source.jsx
# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.js meta.jsx.js
# ^^^^ meta.tag
# ^^^^^ meta.tag
```
# <- meta.string.heredoc.coffee meta.embedded.coffee source.jsx.embedded.coffee - string
#^ meta.string.heredoc.coffee meta.embedded.coffee source.jsx.embedded.coffee - string
# ^^^ meta.string.heredoc.coffee string.quoted.script.coffee punctuation.definition.string.end.coffee
# ^ - meta.string - string

`
Expand Down

0 comments on commit 62a9d3c

Please sign in to comment.