Skip to content

Commit

Permalink
nix: allow single quotes inside single-quoted strings (#2289)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncfavier committed Dec 3, 2022
1 parent 0065261 commit c949083
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions pygments/lexers/nix.py
Expand Up @@ -102,6 +102,7 @@ class NixLexer(RegexLexer):
(r"''\t", String.Escape),
(r"''", String.Single, '#pop'),
(r'\$\{', String.Interpol, 'antiquote'),
(r"'", String.Single),
(r"[^']", String.Single),
],
'doublequote': [
Expand Down
2 changes: 1 addition & 1 deletion tests/examplefiles/nixos/example.nix
Expand Up @@ -67,7 +67,7 @@ stdenv.mkDerivation rec {

# escape example
postInstall = ''
mv $out/sbin $out/bin ''' ''${
mv $out/sbin 'foo' $out/bin ''' ''${
${ if true then ${ "" } else false }
'';

Expand Down
6 changes: 6 additions & 0 deletions tests/examplefiles/nixos/example.nix.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c949083

Please sign in to comment.