[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [syntax-highlighting] /: python syntax: added f-literals and improved string handling
From: Philipp A <flying-sheep () web ! de>
Date: 2016-12-10 14:23:57
Message-ID: E1cFiZB-00069H-PE () code ! kde ! org
[Download RAW message or body]
Git commit b3024d92e45f3e488b47d51f62e3d7e8c19a8b5c by Philipp A.
Committed on 10/12/2016 at 14:20.
Pushed by phils into branch 'master'.
python syntax: added f-literals and improved string handling
M +10 -0 autotests/folding/test.py.fold
M +10 -0 autotests/html/test.py.html
M +10 -0 autotests/input/test.py
M +10 -0 autotests/reference/test.py.ref
M +129 -71 data/syntax/python.xml
https://commits.kde.org/syntax-highlighting/b3024d92e45f3e488b47d51f62e3d7e8c19a8b5c
diff --git a/autotests/folding/test.py.fold b/autotests/folding/test.py.fold
index ae0b98a..d1758a2 100644
--- a/autotests/folding/test.py.fold
+++ b/autotests/folding/test.py.fold
@@ -26,3 +26,13 @@ def func<beginfold id='3'>(</beginfold id='3'>x<endfold \
id='3'>)</endfold id='3' continued line "<endfold id='3'>)</endfold id='3'>
print<beginfold id='3'>(</beginfold id='3'>'single line'<endfold \
id='3'>)</endfold id='3'> return float<beginfold id='3'>(</beginfold \
id='3'>len<beginfold id='3'>(</beginfold id='3'>a2<endfold id='3'>)</endfold \
id='3'><endfold id='3'>)</endfold id='3'> +
+
+def test_f_literals<beginfold id='3'>(</beginfold id='3'><endfold id='3'>)</endfold \
id='3'>: + f'xy'
+ f'x{bar}y'
+ f'x{bar<beginfold id='2'>[</beginfold id='2'>"baz"<endfold id='2'>]</endfold \
id='2'>}y' + f'x{bar<beginfold id='2'>[</beginfold id='2'>"baz"<endfold \
id='2'>]</endfold id='2'>}y\n' +
+ f'x{bar<beginfold id='2'>[</beginfold id='2'>"baz"<endfold id='2'>]</endfold \
id='2'>!r}y\n' + f'x{bar<beginfold id='2'>[</beginfold id='2'>"baz"<endfold \
id='2'>]</endfold id='2'>:.2}y\n'
diff --git a/autotests/html/test.py.html b/autotests/html/test.py.html
index ad953cd..76a8434 100644
--- a/autotests/html/test.py.html
+++ b/autotests/html/test.py.html
@@ -32,4 +32,14 @@
<span style="color:#bf0303;"> continued line "</span>)
<span style="color:#644a9b;font-weight:bold;">print</span>(<span \
style="color:#bf0303;">'single line'</span>) <span \
style="font-weight:bold;">return</span> <span \
style="color:#644a9b;font-weight:bold;">float</span>(<span \
style="color:#644a9b;font-weight:bold;">len</span>(a2)) +
+
+<span style="font-weight:bold;">def</span> test_f_literals():
+ <span style="color:#ff5500;">f'xy'</span>
+ <span style="color:#ff5500;">f'x</span><span \
style="color:#3daee9;">{</span>bar<span style="color:#3daee9;">}</span><span \
style="color:#ff5500;">y'</span> + <span style="color:#ff5500;">f'x</span><span \
style="color:#3daee9;">{</span>bar[<span \
style="color:#bf0303;">"baz"</span>]<span \
style="color:#3daee9;">}</span><span style="color:#ff5500;">y'</span> + <span \
style="color:#ff5500;">f'x</span><span style="color:#3daee9;">{</span>bar[<span \
style="color:#bf0303;">"baz"</span>]<span \
style="color:#3daee9;">}</span><span style="color:#ff5500;">y</span><span \
style="color:#924c9d;">\n</span><span style="color:#ff5500;">'</span> +
+ <span style="color:#ff5500;">f'x</span><span \
style="color:#3daee9;">{</span>bar[<span \
style="color:#bf0303;">"baz"</span>]<span \
style="color:#3daee9;">!r}</span><span style="color:#ff5500;">y</span><span \
style="color:#924c9d;">\n</span><span style="color:#ff5500;">'</span> + <span \
style="color:#ff5500;">f'x</span><span style="color:#3daee9;">{</span>bar[<span \
style="color:#bf0303;">"baz"</span>]<span \
style="color:#3daee9;">:.2}</span><span style="color:#ff5500;">y</span><span \
style="color:#924c9d;">\n</span><span style="color:#ff5500;">'</span> \
</pre></body></html>
diff --git a/autotests/input/test.py b/autotests/input/test.py
index 3c0392c..246bac4 100644
--- a/autotests/input/test.py
+++ b/autotests/input/test.py
@@ -26,3 +26,13 @@ def func(x):
continued line ")
print('single line')
return float(len(a2))
+
+
+def test_f_literals():
+ f'xy'
+ f'x{bar}y'
+ f'x{bar["baz"]}y'
+ f'x{bar["baz"]}y\n'
+
+ f'x{bar["baz"]!r}y\n'
+ f'x{bar["baz"]:.2}y\n'
diff --git a/autotests/reference/test.py.ref b/autotests/reference/test.py.ref
index bb85ce0..79da8bf 100644
--- a/autotests/reference/test.py.ref
+++ b/autotests/reference/test.py.ref
@@ -26,3 +26,13 @@
<String> continued line "</String><Normal Text>)</Normal Text><br/>
<Normal Text> </Normal Text><Builtin Function>print</Builtin Function><Normal \
Text>(</Normal Text><String>'single line'</String><Normal Text>)</Normal Text><br/> \
<Normal Text> </Normal Text><Flow Control Keyword>return</Flow Control \
Keyword><Normal Text> </Normal Text><Builtin Function>float</Builtin Function><Normal \
Text>(</Normal Text><Builtin Function>len</Builtin Function><Normal \
Text>(a2))</Normal Text><br/> +<dsNormal></dsNormal><br/>
+<dsNormal></dsNormal><br/>
+<Definition Keyword>def</Definition Keyword><Normal Text> test_f_literals():</Normal \
Text><br/> +<Normal Text> </Normal Text><F-String>f'xy'</F-String><br/>
+<Normal Text> </Normal Text><F-String>f'x</F-String><String \
Substitution>{</String Substitution><Normal Text>bar</Normal Text><String \
Substitution>}</String Substitution><F-String>y'</F-String><br/> +<Normal Text> \
</Normal Text><F-String>f'x</F-String><String Substitution>{</String \
Substitution><Normal Text>bar[</Normal Text><String>"baz"</String><Normal \
Text>]</Normal Text><String Substitution>}</String \
Substitution><F-String>y'</F-String><br/> +<Normal Text> </Normal \
Text><F-String>f'x</F-String><String Substitution>{</String Substitution><Normal \
Text>bar[</Normal Text><String>"baz"</String><Normal Text>]</Normal Text><String \
Substitution>}</String Substitution><F-String>y</F-String><String Char>\n</String \
Char><F-String>'</F-String><br/> +<dsNormal></dsNormal><br/>
+<Normal Text> </Normal Text><F-String>f'x</F-String><String \
Substitution>{</String Substitution><Normal Text>bar[</Normal \
Text><String>"baz"</String><Normal Text>]</Normal Text><String \
Substitution>!r}</String Substitution><F-String>y</F-String><String Char>\n</String \
Char><F-String>'</F-String><br/> +<Normal Text> </Normal \
Text><F-String>f'x</F-String><String Substitution>{</String Substitution><Normal \
Text>bar[</Normal Text><String>"baz"</String><Normal Text>]</Normal Text><String \
Substitution>:.2}</String Substitution><F-String>y</F-String><String Char>\n</String \
Char><F-String>'</F-String><br/>
diff --git a/data/syntax/python.xml b/data/syntax/python.xml
index 670e22a..071f170 100644
--- a/data/syntax/python.xml
+++ b/data/syntax/python.xml
@@ -14,7 +14,7 @@
<!-- v2.07 add support for %prog and co, see bug 142832 -->
<!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords \
--> <!-- v2.29 recognize escape sequenzes correctly -->
-<language name="Python" version="3" style="python" kateversion="5.0" \
section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript" \
mimetype="application/x-python;text/x-python" casesensitive="1" author="Michael \
Bueker" license=""> +<language name="Python" version="4" style="python" \
kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript" \
mimetype="application/x-python;text/x-python" casesensitive="1" author="Michael \
Bueker" license=""> <highlighting>
<list name="import">
<item> import </item>
@@ -377,60 +377,40 @@
<context name="StringVariants" attribute="Normal Text" lineEndContext="#stay">
<DetectSpaces/>
- <!-- ''' -->
- <StringDetect attribute="String" String="'''" context="Tripple A-string" \
beginRegion="Tripple A-region"/>
- <StringDetect attribute="String" String="u'''" insensitive="true" \
context="Tripple A-string" beginRegion="Tripple A-region"/>
- <!-- """ -->
- <StringDetect attribute="String" String=""""" context="Tripple \
Q-string" beginRegion="Tripple Q-region"/>
- <StringDetect attribute="String" String="u"""" insensitive="true" \
context="Tripple Q-string" beginRegion="Tripple Q-region"/>
- <!-- ' -->
- <DetectChar attribute="String" char="'" context="Single A-string"/>
- <StringDetect attribute="String" String="u'" insensitive="true" context="Single \
A-string"/>
- <!-- " -->
- <DetectChar attribute="String" char=""" context="Single Q-string"/>
- <StringDetect attribute="String" String="u"" insensitive="true" \
context="Single Q-string"/>
-
- <!-- ''' -->
- <StringDetect attribute="Raw String" String="r'''" insensitive="true" \
context="Raw Tripple A-string" beginRegion="Tripple A-region"/>
- <StringDetect attribute="Raw String" String="ur'''" insensitive="true" \
context="Raw Tripple A-string" beginRegion="Tripple A-region"/>
- <!-- """ -->
- <StringDetect attribute="Raw String" String="r"""" \
insensitive="true" context="Raw Tripple Q-string" \
beginRegion="Tripple Q-region"/>
- <StringDetect attribute="Raw String" String="ur"""" \
insensitive="true" context="Raw Tripple Q-string" \
beginRegion="Tripple Q-region"/>
- <!-- ' -->
- <StringDetect attribute="Raw String" String="r'" insensitive="true" context="Raw \
A-string"/>
- <StringDetect attribute="Raw String" String="ur'" insensitive="true" \
context="Raw A-string"/>
- <!-- " -->
- <StringDetect attribute="Raw String" String="r"" insensitive="true" \
context="Raw Q-string"/>
- <StringDetect attribute="Raw String" String="ur"" insensitive="true" \
context="Raw Q-string"/> +
+ <RegExpr attribute="String" String="u?'''" insensitive="true" \
context="Triple A-string" beginRegion="Triple A-region"/> + <RegExpr \
attribute="String" String="u?"""" insensitive="true" context="Triple \
Q-string" beginRegion="Triple Q-region"/> + <RegExpr attribute="String" \
String="u?'" insensitive="true" context="Single A-string"/> \
+ <RegExpr attribute="String" String="u?"" insensitive="true" \
context="Single Q-string"/> +
+ <RegExpr attribute="Raw String" String="(u?r|ru)'''" \
insensitive="true" context="Raw Triple A-string" beginRegion="Triple A-region"/> \
+ <RegExpr attribute="Raw String" String="(u?r|ru)"""" \
insensitive="true" context="Raw Triple Q-string" beginRegion="Triple Q-region"/> \
+ <RegExpr attribute="Raw String" String="(u?r|ru)'" \
insensitive="true" context="Raw A-string"/> + <RegExpr attribute="Raw String" \
String="(u?r|ru)"" insensitive="true" context="Raw Q-string"/> +
+ <StringDetect attribute="F-String" String="f'''" \
insensitive="true" context="Triple A-F-String" beginRegion="Triple A-region"/> \
+ <StringDetect attribute="F-String" String="f"""" \
insensitive="true" context="Triple Q-F-String" beginRegion="Triple Q-region"/> \
+ <StringDetect attribute="F-String" String="f'" \
insensitive="true" context="Single A-F-String"/> + <StringDetect \
attribute="F-String" String="f"" insensitive="true" context="Single \
Q-F-String"/> +
+ <RegExpr attribute="Raw F-String" String="(fr|rf)'''" \
insensitive="true" context="Raw Triple A-F-String" beginRegion="Triple A-region"/> \
+ <RegExpr attribute="Raw F-String" String="(fr|rf)"""" \
insensitive="true" context="Raw Triple Q-F-String" beginRegion="Triple Q-region"/> \
+ <RegExpr attribute="Raw F-String" String="(fr|rf)'" \
insensitive="true" context="Raw A-F-String"/> + <RegExpr attribute="Raw F-String" \
String="(fr|rf)"" insensitive="true" context="Raw Q-F-String"/> \
</context>
<context name="CommentVariants" attribute="Normal Text" lineEndContext="#stay">
<DetectSpaces/>
- <!-- ''' -->
- <StringDetect attribute="Comment" String="'''" firstNonSpace="true" \
context="Tripple A-comment" beginRegion="Tripple A-region"/>
- <StringDetect attribute="Comment" String="u'''" insensitive="true" \
firstNonSpace="true" context="Tripple A-comment" beginRegion="Tripple \
A-region"/>
- <!-- """ -->
- <StringDetect attribute="Comment" String=""""" \
firstNonSpace="true" context="Tripple Q-comment" beginRegion="Tripple \
Q-region"/>
- <StringDetect attribute="Comment" String="u"""" \
insensitive="true" firstNonSpace="true" context="Tripple Q-comment" \
beginRegion="Tripple Q-region"/>
- <!-- ' -->
- <DetectChar attribute="Comment" char="'" firstNonSpace="true" context="Single \
A-comment"/>
- <StringDetect attribute="Comment" String="u'" insensitive="true" \
firstNonSpace="true" context="Single A-comment"/>
- <!-- " -->
- <DetectChar attribute="Comment" char=""" firstNonSpace="true" \
context="Single Q-comment"/>
- <StringDetect attribute="Comment" String="u"" insensitive="true" \
firstNonSpace="true" context="Single Q-comment"/>
-
- <!-- ''' -->
- <StringDetect attribute="Comment" String="r'''" insensitive="true" \
firstNonSpace="true" context="Tripple A-comment" beginRegion="Tripple \
A-region"/>
- <StringDetect attribute="Comment" String="ur'''" insensitive="true" \
firstNonSpace="true" context="Tripple A-comment" beginRegion="Tripple \
A-region"/>
- <!-- """ -->
- <StringDetect attribute="Comment" String="r"""" \
insensitive="true" firstNonSpace="true" context="Tripple Q-comment" \
beginRegion="Tripple Q-region"/>
- <StringDetect attribute="Comment" String="ur"""" \
insensitive="true" firstNonSpace="true" context="Tripple Q-comment" \
beginRegion="Tripple Q-region"/>
- <!-- ' -->
- <StringDetect attribute="Comment" String="r'" insensitive="true" \
firstNonSpace="true" context="Single A-comment"/>
- <StringDetect attribute="Comment" String="ur'" insensitive="true" \
firstNonSpace="true" context="Single A-comment"/>
- <!-- " -->
- <StringDetect attribute="Comment" String="r"" insensitive="true" \
firstNonSpace="true" context="Single Q-comment"/>
- <StringDetect attribute="Comment" String="ur"" insensitive="true" \
firstNonSpace="true" context="Single Q-comment"/> +
+ <RegExpr attribute="Comment" String="u?'''" insensitive="true" \
firstNonSpace="true" context="Triple A-comment" beginRegion="Triple A-region"/> \
+ <RegExpr attribute="Comment" String="u?"""" insensitive="true" \
firstNonSpace="true" context="Triple Q-comment" beginRegion="Triple Q-region"/> \
+ <RegExpr attribute="Comment" String="u?'" insensitive="true" \
firstNonSpace="true" context="Single A-comment"/> + <RegExpr attribute="Comment" \
String="u?"" insensitive="true" firstNonSpace="true" context="Single \
Q-comment"/> +
+ <RegExpr attribute="Comment" String="(u?r|ru)'''" \
insensitive="true" firstNonSpace="true" context="Triple A-comment" \
beginRegion="Triple A-region"/> + <RegExpr attribute="Comment" \
String="(u?r|ru)"""" insensitive="true" firstNonSpace="true" \
context="Triple Q-comment" beginRegion="Triple Q-region"/> + <RegExpr \
attribute="Comment" String="(u?r|ru)'" insensitive="true" \
firstNonSpace="true" context="Single A-comment"/> + <RegExpr attribute="Comment" \
String="(u?r|ru)"" insensitive="true" firstNonSpace="true" \
context="Single Q-comment"/> </context>
<context name="Dictionary" attribute="Normal Text" lineEndContext="#stay" \
noIndentationBasedFolding="true"> @@ -461,14 +441,14 @@
<IncludeRules context="##Modelines" />
</context>
- <context name="Tripple A-comment" attribute="Comment" lineEndContext="#stay" \
noIndentationBasedFolding="true">
- <StringDetect attribute="Comment" String="'''" context="#pop" endRegion="Tripple \
A-region"/> + <context name="Triple A-comment" attribute="Comment" \
lineEndContext="#stay" noIndentationBasedFolding="true"> + <StringDetect \
attribute="Comment" String="'''" context="#pop" endRegion="Triple A-region"/> \
<IncludeRules context="##Alerts_indent" /> </context>
- <context name="Tripple Q-comment" attribute="Comment" lineEndContext="#stay" \
noIndentationBasedFolding="true"> + <context name="Triple Q-comment" \
attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true"> \
<HlCChar attribute="Comment" context="#stay"/>
- <StringDetect attribute="Comment" String=""""" context="#pop" \
endRegion="Tripple Q-region"/> + <StringDetect attribute="Comment" \
String=""""" context="#pop" endRegion="Triple Q-region"/> \
<IncludeRules context="##Alerts_indent" /> </context>
@@ -533,41 +513,85 @@
<RegExpr attribute="String Char" String="\\N\{[a-zA-Z0-9\- ]+\}" \
context="#stay"/> </context>
- <context name="Tripple A-string" attribute="String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> + <!-- f-literals -->
+ <context name="stringinterpolation" attribute="F-String" lineEndContext="#stay">
+ <Detect2Chars attribute="String Char" char="{" char1="{" context="#stay"/>
+ <DetectChar attribute="String Substitution" char="{" context="String \
Interpolation"/> + </context>
+ <context name="String Interpolation" attribute="String Substitution" \
lineEndContext="#stay"> + <DetectChar attribute="Error" char="\" context="#pop"/>
+ <RegExpr attribute="String Substitution" String="(![rs])?(:([^}]?[<>=^])?[ \
+-]?#?0?[0-9]*(\.[0-9]+)?[bcdeEfFgGnosxX%]?)?\}" context="#pop"/> + <IncludeRules \
context="Normal"/> <!-- TODO: create expression context instead --> + </context>
+
+
+ <!--
+ It follows a Binary tree of string kinds (not even touching byte literals).
+ The levels are:
+ 1. triple- vs. single-quoted
+ 2. apostrophe vs. quotation mark
+ 3. static vs. interpolated (f-literal)
+ 4. escaped vs. raw
+ Adding byte literals wouldn't make the current 2⁴ into 2⁵ contexts, as there \
are no byte f-literals + -->
+
+
+ <!-- Triple-quoted A-strings -->
+ <context name="Triple A-string" attribute="String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> <IncludeRules context="stringescape"/>
<IncludeRules context="stringformat"/>
- <StringDetect attribute="String" String="'''" context="#pop#CheckForString" \
endRegion="Tripple A-region"/> + <StringDetect attribute="String" String="'''" \
context="#pop#CheckForString" endRegion="Triple A-region"/> </context>
- <context name="Raw Tripple A-string" attribute="Raw String" \
lineEndContext="#stay" noIndentationBasedFolding="true"> + <context name="Raw \
Triple A-string" attribute="Raw String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> <HlCStringChar attribute="Raw String" \
context="#stay"/> <IncludeRules context="stringformat"/>
- <StringDetect attribute="String" String="'''" context="#pop#CheckForString" \
endRegion="Tripple A-region"/> + <StringDetect attribute="Raw String" String="'''" \
context="#pop#CheckForString" endRegion="Triple A-region"/> + </context>
+
+ <context name="Triple A-F-String" attribute="F-String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> + <IncludeRules context="stringescape"/>
+ <IncludeRules context="stringinterpolation"/>
+ <StringDetect attribute="F-String" String="'''" context="#pop#CheckForString" \
endRegion="Triple A-region"/> + </context>
+
+ <context name="Raw Triple A-F-String" attribute="Raw F-String" \
lineEndContext="#stay" noIndentationBasedFolding="true"> + <HlCStringChar \
attribute="Raw F-String" context="#stay"/> + <IncludeRules \
context="stringinterpolation"/> + <StringDetect attribute="Raw F-String" \
String="'''" context="#pop#CheckForString" endRegion="Triple A-region"/> </context>
- <context name="Tripple Q-string" attribute="String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> + <!-- Triple-quoted Q-strings -->
+ <context name="Triple Q-string" attribute="String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> <IncludeRules context="stringescape"/>
<IncludeRules context="stringformat"/>
- <StringDetect attribute="String" String=""""" \
context="#pop#CheckForString" endRegion="Tripple Q-region"/> + <StringDetect \
attribute="String" String=""""" context="#pop#CheckForString" \
endRegion="Triple Q-region"/> </context>
- <context name="Raw Tripple Q-string" attribute="Raw String" \
lineEndContext="#stay" noIndentationBasedFolding="true"> + <context name="Raw \
Triple Q-string" attribute="Raw String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> <HlCStringChar attribute="Raw String" \
context="#stay"/> <IncludeRules context="stringformat"/>
- <StringDetect attribute="String" String=""""" \
context="#pop#CheckForString" endRegion="Tripple Q-region"/> + <StringDetect \
attribute="Raw String" String=""""" context="#pop#CheckForString" \
endRegion="Triple Q-region"/> </context>
-
- <context name="Single A-string" attribute="String" lineEndContext="#stay">
+ <context name="Triple Q-F-String" attribute="F-String" lineEndContext="#stay" \
noIndentationBasedFolding="true"> <IncludeRules context="stringescape"/>
- <IncludeRules context="stringformat"/>
- <DetectChar attribute="String" char="'" context="#pop#CheckForString"/>
+ <IncludeRules context="stringinterpolation"/>
+ <StringDetect attribute="F-String" String=""""" \
context="#pop#CheckForString" endRegion="Triple Q-region"/> </context>
- <context name="Single Q-string" attribute="String" lineEndContext="#stay">
+ <context name="Raw Triple Q-F-String" attribute="Raw F-String" \
lineEndContext="#stay" noIndentationBasedFolding="true"> + <HlCStringChar \
attribute="Raw F-String" context="#stay"/> + <IncludeRules \
context="stringinterpolation"/> + <StringDetect attribute="Raw F-String" \
String=""""" context="#pop#CheckForString" endRegion="Triple \
Q-region"/> + </context>
+
+
+ <!-- Single-quoted A-strings -->
+ <context name="Single A-string" attribute="String" lineEndContext="#stay">
<IncludeRules context="stringescape"/>
<IncludeRules context="stringformat"/>
- <DetectChar attribute="String" char=""" context="#pop#CheckForString"/>
+ <DetectChar attribute="String" char="'" context="#pop#CheckForString"/>
</context>
<context name="Raw A-string" attribute="Raw String" lineEndContext="#stay">
@@ -576,11 +600,42 @@
<DetectChar attribute="Raw String" char="'" context="#pop#CheckForString"/>
</context>
+ <context name="Single A-F-String" attribute="F-String" lineEndContext="#stay">
+ <IncludeRules context="stringescape"/>
+ <IncludeRules context="stringinterpolation"/>
+ <DetectChar attribute="F-String" char="'" context="#pop#CheckForString"/>
+ </context>
+
+ <context name="Raw A-F-String" attribute="Raw F-String" lineEndContext="#stay">
+ <HlCStringChar attribute="Raw F-String" context="#stay"/>
+ <IncludeRules context="stringinterpolation"/>
+ <DetectChar attribute="Raw F-String" char="'" context="#pop#CheckForString"/>
+ </context>
+
+ <!-- Single-quoted Q-strings -->
+ <context name="Single Q-string" attribute="String" lineEndContext="#stay">
+ <IncludeRules context="stringescape"/>
+ <IncludeRules context="stringformat"/>
+ <DetectChar attribute="String" char=""" context="#pop#CheckForString"/>
+ </context>
+
<context name="Raw Q-string" attribute="Raw String" lineEndContext="#stay">
<HlCStringChar attribute="Raw String" context="#stay"/>
<IncludeRules context="stringformat"/>
<DetectChar attribute="Raw String" char=""" context="#pop#CheckForString"/>
</context>
+
+ <context name="Single Q-F-String" attribute="F-String" lineEndContext="#stay">
+ <IncludeRules context="stringescape"/>
+ <IncludeRules context="stringinterpolation"/>
+ <DetectChar attribute="F-String" char=""" context="#pop#CheckForString"/>
+ </context>
+
+ <context name="Raw Q-F-String" attribute="Raw F-String" lineEndContext="#stay">
+ <HlCStringChar attribute="Raw F-String" context="#stay"/>
+ <IncludeRules context="stringinterpolation"/>
+ <DetectChar attribute="Raw F-String" char=""" \
context="#pop#CheckForString"/> + </context>
</contexts>
<itemDatas>
@@ -588,7 +643,6 @@
<itemData name="Definition Keyword" defStyleNum="dsKeyword" \
spellChecking="false"/> <itemData name="Operator" defStyleNum="dsOperator" \
spellChecking="false"/> <itemData name="Operator Keyword" defStyleNum="dsKeyword" \
spellChecking="false"/>
- <itemData name="String Substitution" defStyleNum="dsSpecialChar" \
spellChecking="false"/> <itemData name="Flow Control Keyword" \
defStyleNum="dsControlFlow" spellChecking="false"/> <itemData name="Builtin \
Function" defStyleNum="dsBuiltIn" spellChecking="false"/> <itemData name="Special \
Variable" defStyleNum="dsVariable" spellChecking="false"/> @@ -596,7 +650,6 @@
<itemData name="Exceptions" defStyleNum="dsPreprocessor" spellChecking="false"/>
<itemData name="Overloaders" defStyleNum="dsFunction" spellChecking="false"/>
<itemData name="Import" defStyleNum="dsImport" spellChecking="false"/>
- <itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/>
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
<itemData name="Int" defStyleNum="dsDecVal" spellChecking="false"/>
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
@@ -605,7 +658,12 @@
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="Raw String" defStyleNum="dsVerbatimString"/>
+ <itemData name="F-String" defStyleNum="dsSpecialString"/>
+ <itemData name="Raw F-String" defStyleNum="dsVerbatimString"/>
+ <itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/>
+ <itemData name="String Substitution" defStyleNum="dsSpecialChar" \
spellChecking="false"/> <itemData name="Decorator" defStyleNum="dsAttribute" \
spellChecking="false"/> + <itemData name="Error" defStyleNum="dsError"/>
</itemDatas>
</highlighting>
<general>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic