runtime(python2): Highlight b-strings in Python 2.7 Commit: https://github.com/vim/vim/commit/edce68912eacb45704cb6654940e3967afe2bd96 Author: Rob B <git...@0x7e.net> Date: Tue Jul 15 20:23:59 2025 +0200
runtime(python2): Highlight b-strings in Python 2.7 related: https://github.com/vim/vim/issues/14033 related: https://github.com/vim/vim/issues/17726 closes: #17757 Signed-off-by: Rob B <git...@0x7e.net> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/syntax/python2.vim b/runtime/syntax/python2.vim index 90c8dcaa3..a4a7a822e 100644 --- a/runtime/syntax/python2.vim +++ b/runtime/syntax/python2.vim @@ -3,6 +3,7 @@ " Maintainer: Zvezdan Petkovic <zpetko...@acm.org> " Last Change: 2016 Oct 29 " 2025 Jul 14 by Vim project: highlight unicode strings +" 2025 Jul 15 by Vim project: highlight b-strings " Credits: Neil Schemenauer <n...@python.ca> " Dmitry Vasiliev " Rob B @@ -143,16 +144,16 @@ syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained " Triple-quoted strings can contain doctests. syn region pythonString matchgroup=pythonQuotes - \ start=+\z(['"]\)+ end="\z1" skip="\\\|\\z1" + \ start=+[bB]\=\z(['"]\)+ end="\z1" skip="\\\|\\z1" \ contains=pythonEscape,@Spell syn region pythonString matchgroup=pythonTripleQuotes - \ start=+\z('''\|"""\)+ end="\z1" keepend + \ start=+[bB]\=\z('''\|"""\)+ end="\z1" keepend \ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell syn region pythonRawString matchgroup=pythonQuotes - \ start=+[rR]\z(['"]\)+ end="\z1" skip="\\\|\\z1" + \ start=+[bB]\=[rR]\z(['"]\)+ end="\z1" skip="\\\|\\z1" \ contains=@Spell syn region pythonRawString matchgroup=pythonTripleQuotes - \ start=+[rR]\z('''\|"""\)+ end="\z1" keepend + \ start=+[bB]\=[rR]\z('''\|"""\)+ end="\z1" keepend \ contains=pythonSpaceError,pythonDoctest,@Spell " Unicode strings diff --git a/runtime/syntax/testdir/dumps/python2_strings_02.dump b/runtime/syntax/testdir/dumps/python2_strings_02.dump index 2ad1938b6..94c40aa5f 100644 --- a/runtime/syntax/testdir/dumps/python2_strings_02.dump +++ b/runtime/syntax/testdir/dumps/python2_strings_02.dump @@ -1,20 +1,20 @@ |#+0#0000e05#ffffff0| |B|-|s|t|r|i|n|g|s|:| |P|r|e|f|i|x| |i|s| |a|l@1|o|w|e|d| |b|u|t| |i|g|n|o|r|e|d| |(|h|t@1|p|s|:|/@1|p|e|p|s|.|p|y|t|h|o|n|.|o|r|g|/|p|e|p|-|3|1@1 |2|)| +0#0000000&@72 -|t|e|s|t| |=| |b|'+0#e000002&|S|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|'| +0#e000002&|a|n|d| |\+0#e000e06&|"| +0#e000002&|a|n|d| |\+0#e000e06&|t|'+0#e000002&| +0#0000000&@28 -|t|e|s|t| |=| |B|"+0#e000002&|S|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|0|4|0| +0#e000002&|a|n|d| |\+0#e000e06&|x|F@1|"+0#e000002&| +0#0000000&@31 -|t|e|s|t| |=| |b|'+0#e000002&|S|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C|L|A|M|A|T +|t|e|s|t| |=| |b+0#e000002&|'|S|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|'| +0#e000002&|a|n|d| |\+0#e000e06&|"| +0#e000002&|a|n|d| |\+0#e000e06&|t|'+0#e000002&| +0#0000000&@28 +|t|e|s|t| |=| |B+0#e000002&|"|S|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|0|4|0| +0#e000002&|a|n|d| |\+0#e000e06&|x|F@1|"+0#e000002&| +0#0000000&@31 +|t|e|s|t| |=| |b+0#e000002&|'|S|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C|L|A|M|A|T |I|O|N| |M|A|R|K|}|'| +0#0000000&@64 ->t|e|s|t| |=| |B|"+0#e000002&|S|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|d| |\+0#e000e06&@1| +0#e000002&|b|a|c|k|s|l|a|s|h| |a|n|d| |i|g|n|o|r|e|d| |\+0#e000e06&| +0#0000000&@19 +>t|e|s|t| |=| |B+0#e000002&|"|S|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|d| |\+0#e000e06&@1| +0#e000002&|b|a|c|k|s|l|a|s|h| |a|n|d| |i|g|n|o|r|e|d| |\+0#e000e06&| +0#0000000&@19 |n+0#e000002&|e|w|l|i|n|e|"| +0#0000000&@66 -|t|e|s|t| |=| |b|'+0#e000002&@2|S|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@37 +|t|e|s|t| |=| |b+0#e000002&|'@2|S|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@37 |a+0#e000002&|n|d| |e|s|c|a|p|e|s| |\+0#e000e06&|t| +0#e000002&|a|n|d| |\+0#e000e06&|0|4|0| +0#e000002&|a|n|d| |\+0#e000e06&|x|F@1| +0#0000000&@42 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5|'@2| +0#0000000&@38 -|t|e|s|t| |=| |B|"+0#e000002&@2|S|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@37 +|t|e|s|t| |=| |B+0#e000002&|"@2|S|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@37 |a+0#e000002&|n|d| |e|s|c|a|p|e|s| |\+0#e000e06&|t| +0#e000002&|a|n|d| |\+0#e000e06&|0|4|0| +0#e000002&|a|n|d| |\+0#e000e06&|x|F@1| +0#0000000&@42 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5|"@2| +0#0000000&@38 @75 |#+0#0000e05&| |R|a|w| |b|-|s|t|r|i|n|g|s| +0#0000000&@59 -|t|e|s|t| |=| |b|r+0#e000002&|'|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|'| |a|n|d| |\|"| |a|n|d| |\|t|'| +0#0000000&@23 -|t|e|s|t| |=| |b|R+0#e000002&|"|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|0|4|0| |a|n|d| |\|x|F@1|"| +0#0000000&@26 -|t|e|s|t| |=| |B|r+0#e000002&|'|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |@+0#4040ff13&@2 +|t|e|s|t| |=| |b+0#e000002&|r|'|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|'| |a|n|d| |\|"| |a|n|d| |\|t|'| +0#0000000&@23 +|t|e|s|t| |=| |b+0#e000002&|R|"|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|0|4|0| |a|n|d| |\|x|F@1|"| +0#0000000&@26 +|t|e|s|t| |=| |B+0#e000002&|r|'|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |@+0#4040ff13&@2 | +0#0000000&@56|3|4|,|1| @9|4|3|%| diff --git a/runtime/syntax/testdir/dumps/python2_strings_03.dump b/runtime/syntax/testdir/dumps/python2_strings_03.dump index 749866e10..9f8c18e8c 100644 --- a/runtime/syntax/testdir/dumps/python2_strings_03.dump +++ b/runtime/syntax/testdir/dumps/python2_strings_03.dump @@ -1,11 +1,11 @@ -|t+0&#ffffff0|e|s|t| |=| |B|r+0#e000002&|'|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C +|t+0&#ffffff0|e|s|t| |=| |B+0#e000002&|r|'|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C |L|A|M|A|T|I|O|N| |M|A|R|K|}|'| +0#0000000&@59 -|t|e|s|t| |=| |B|R+0#e000002&|"|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@12 +|t|e|s|t| |=| |B+0#e000002&|R|"|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@12 |n+0#e000002&|e|w|l|i|n|e|"| +0#0000000&@66 -|t|e|s|t| |=| |b|r+0#e000002&|'@2|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@32 +|t|e|s|t| |=| |b+0#e000002&|r|'@2|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@32 >a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|t| |a|n|d| |\|0|4|0| |a|n|d| |\|x|F@1| >+0#0000000&@42 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5|'@2| +0#0000000&@38 -|t|e|s|t| |=| |B|R+0#e000002&|"@2|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@32 +|t|e|s|t| |=| |B+0#e000002&|R|"@2|R|a|w| |s|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@32 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|t| |a|n|d| |\|0|4|0| |a|n|d| |\|x|F@1| +0#0000000&@42 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5|"@2| +0#0000000&@38 @75 diff --git a/runtime/syntax/testdir/input/sh_ksh_array.sh b/runtime/syntax/testdir/input/sh_ksh_array.sh old mode 100755 new mode 100644 -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1ubkPk-007cJP-Gu%40256bit.org.