LnL7 / vim-nix

Vim configuration files for Nix http://nixos.org/nix
MIT License
287 stars 26 forks source link

match some specials #18

Closed danbornside closed 6 years ago

danbornside commented 6 years ago

inline heredoc style makefile breaks string highlighting; this fix adds the \ in interpolated strings

danbornside commented 6 years ago

the ''\ sequence causes nix to process escape sequences; in particular, the sequence does not end the nix string. this patch makes the syntax hilighter agree with the stringyness when strings do contain those escape sequences.

[dbornside@bornside vim-nix]$ for x in a b c d ; do echo "== $x ==" ; cat ${x}.nix ; echo "----" ; nix eval --raw -f ${x}.nix '' | hexdump -C ; done
== a ==
''\
''
----
00000000  5c 0a                                             |\.|
00000002
== b ==
''\t
''
----
00000000  5c 74 0a                                          |\t.|
00000003
== c ==
''''\t
''
----
00000000  09 0a                                             |..|
00000002
== d ==
''''a
''
----
error: syntax error, unexpected $end, expecting IND_STR or DOLLAR_CURLY or IND_STRING_CLOSE, at /home/dbornside/src/contrib/vim-nix/d.nix:2:1
[dbornside@bornside vim-nix]$ 
LnL7 commented 6 years ago

Oh! ''\ not \\, I totally misinterpreted this.