mirror of
https://github.com/neovim/neovim.git
synced 2025-12-09 16:12:48 +00:00
vim-patch:8d8c907: runtime(python): Highlight t-strings
- Highlight t-strings
- Update comments
- Add tests
closes: vim/vim#18679
8d8c9074c3
Co-authored-by: Rob B <github@0x7e.net>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
|
||||
" Last Change: 2025 Sep 08
|
||||
" 2025 Sep 25 by Vim Project: fix wrong type highlighting #18394
|
||||
" 2025 Dec 03 by Vim Project: highlight t-strings #18679
|
||||
" Credits: Neil Schemenauer <nas@python.ca>
|
||||
" Dmitry Vasiliev
|
||||
" Rob B
|
||||
@@ -168,27 +169,29 @@ syn region pythonRawString matchgroup=pythonTripleQuotes
|
||||
|
||||
" Formatted string literals (f-strings)
|
||||
" https://docs.python.org/3/reference/lexical_analysis.html#f-strings
|
||||
" Template string literals (t-strings)
|
||||
" https://docs.python.org/3/reference/lexical_analysis.html#template-string-literals
|
||||
syn region pythonFString
|
||||
\ matchgroup=pythonQuotes
|
||||
\ start=+\cF\z(['"]\)+
|
||||
\ start=+\c[FT]\z(['"]\)+
|
||||
\ end="\z1"
|
||||
\ skip="\\\\\|\\\z1"
|
||||
\ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,@Spell
|
||||
syn region pythonFString
|
||||
\ matchgroup=pythonTripleQuotes
|
||||
\ start=+\cF\z('''\|"""\)+
|
||||
\ start=+\c[FT]\z('''\|"""\)+
|
||||
\ end="\z1"
|
||||
\ keepend
|
||||
\ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,pythonSpaceError,pythonDoctest,@Spell
|
||||
syn region pythonRawFString
|
||||
\ matchgroup=pythonQuotes
|
||||
\ start=+\c\%(FR\|RF\)\z(['"]\)+
|
||||
\ start=+\c\%([FT]R\|R[FT]\)\z(['"]\)+
|
||||
\ end="\z1"
|
||||
\ skip="\\\\\|\\\z1"
|
||||
\ contains=pythonFStringField,pythonFStringSkip,@Spell
|
||||
syn region pythonRawFString
|
||||
\ matchgroup=pythonTripleQuotes
|
||||
\ start=+\c\%(FR\|RF\)\z('''\|"""\)+
|
||||
\ start=+\c\%([FT]R\|R[FT]\)\z('''\|"""\)+
|
||||
\ end="\z1"
|
||||
\ keepend
|
||||
\ contains=pythonFStringField,pythonFStringSkip,pythonSpaceError,pythonDoctest,@Spell
|
||||
|
||||
Reference in New Issue
Block a user