@@ -769,21 +769,25 @@ repository:
769769 match : \\$
770770
771771 string-formatting :
772- name : constant.character. format.placeholder.other .python
772+ name : meta. format.percent .python
773773 match : |
774774 (?x)
775- % (\([\w\s]*\))?
776- [-+#0 ]*
777- (\d+|\*)? (\.(\d+|\*))?
778- ([hlL])?
779- [diouxXeEfFgGcrsa%]
775+ (
776+ % (\([\w\s]*\))?
777+ [-+#0 ]*
778+ (\d+|\*)? (\.(\d+|\*))?
779+ ([hlL])?
780+ [diouxXeEfFgGcrsa%]
781+ )
782+ captures :
783+ ' 1 ' : {name: constant.character.format.placeholder.other.python}
780784
781785 string-brace-formatting :
782786 patterns :
783- - name : constant.character. format.placeholder.other .python
787+ - name : meta. format.brace .python
784788 match : |
785789 (?x)
786- (?:
790+ (
787791 {{ | }}
788792 | (?:
789793 {
@@ -801,24 +805,33 @@ repository:
801805 # "storage.type..." is more likely to have special
802806 # highlighting in any given color scheme than
803807 # "support.other..."
804- #
805- ' 2 ' : {name: storage.type.format.python}
808+ ' 1 ' : {name: constant.character.format.placeholder.other.python}
806809 ' 3 ' : {name: storage.type.format.python}
807- - name : constant.character.format.placeholder.other.python
808- begin : |
810+ ' 4 ' : {name: storage.type.format.python}
811+
812+ # The reason for 2 separate rules is to establish which one
813+ # should be matched with a higher priority. The rule below is
814+ # more generic, so it should be matched only if the specific one
815+ # didn't.
816+ - name : meta.format.brace.python
817+ match : |
809818 (?x)
810- \{
819+ (
820+ {
811821 \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*?
812822 (![rsa])?
813823 (:)
814- (?=[^'"}\n]*\})
815- end : \}
816- beginCaptures :
817- ' 2 ' : {name: storage.type.format.python}
824+ (
825+ [^'"{}\n]+?
826+ |
827+ \{ [^'"}\n]*? \}
828+ )*
829+ }
830+ )
831+ captures :
832+ ' 1 ' : {name: constant.character.format.placeholder.other.python}
818833 ' 3 ' : {name: storage.type.format.python}
819- patterns :
820- - match : |
821- (?x) \{ [^'"}\n]*? \} (?=.*?\})
834+ ' 4 ' : {name: storage.type.format.python}
822835
823836 fstring-formatting :
824837 patterns :
0 commit comments