Skip to content

Commit

Permalink
Fix precision of shell-expanded string matches
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed May 25, 2024
1 parent 88d81ff commit 0991695
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions syntax/just.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ syn region justRawString start=/'''/ end=/'''/
syn region justString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=justLineContinuation,justStringEscapeSequence
syn region justString start=/"""/ skip=/\\\\\|\\"/ end=/"""/ contains=justLineContinuation,justStringEscapeSequence

syn region justShellExpandRawString start=/x'/ end=/'/
syn region justShellExpandRawString start=/\v\k@1<!x'/ end=/'/
\ contains=justShellExpandVarRaw
syn region justShellExpandRawString start=/x'''/ end=/'''/
syn region justShellExpandRawString start=/\v\k@1<!x'''/ end=/'''/
\ contains=justShellExpandVarRaw
syn region justShellExpandString
\ start=/x"/ skip=/\\\\\|\\"/ end=/"/
\ start=/\v\k@1<!x"/ skip=/\\\\\|\\"/ end=/"/
\ contains=justLineContinuation,justStringEscapeSequence,justShellExpandVar
syn region justShellExpandString
\ start=/x"""/ skip=/\\\\\|\\"/ end=/"""/
\ start=/\v\k@1<!x"""/ skip=/\\\\\|\\"/ end=/"""/
\ contains=justLineContinuation,justStringEscapeSequence,justShellExpandVar

syn cluster justStringLiterals
Expand Down
3 changes: 3 additions & 0 deletions tests/cases/tricky.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@

<span class="String">[dependencies]</span>
<span class="String">"""</span><span class="Normal">)</span><span class="Delimiter">}}</span><span class="Number"> &gt; </span><span class="Delimiter">{{</span><span class="Function">quote</span><span class="Normal">(</span><span class="Function">cache_directory</span><span class="Normal">() </span><span class="Operator">/</span><span class="Normal"> </span><span class="String">'Cargo.toml-'</span><span class="Normal"> </span><span class="Operator">+</span><span class="Normal"> </span><span class="Identifier">valid_uuid</span><span class="Normal">)</span><span class="Delimiter">}}</span>

<span class="Function">not-shell-expanded-string</span> <span class="Identifier">fix</span><span class="Operator">:</span> <span class="Delimiter">(</span><span class="Function">functions2</span> fix<span class="String">'$HOME'</span><span class="Delimiter">)</span>
<span class="Function">not-shell-expanded-string2</span> <span class="Identifier">_-x</span><span class="Operator">:</span> <span class="Delimiter">(</span><span class="Function">functions2</span> _-x<span class="String">"$HOME"</span><span class="Delimiter">)</span>
3 changes: 3 additions & 0 deletions tests/cases/tricky.just
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@ edition = "2021"
[dependencies]
""")}} > {{quote(cache_directory() / 'Cargo.toml-' + valid_uuid)}}
not-shell-expanded-string fix: (functions2 fix'$HOME')
not-shell-expanded-string2 _-x: (functions2 _-x"$HOME")

0 comments on commit 0991695

Please sign in to comment.