Skip to content

Commit c16e00a

Browse files
author
MattDMo
committed
Regexp scope change, start working on string_formatting
1 parent 62ab22a commit c16e00a

File tree

1 file changed

+113
-4
lines changed

1 file changed

+113
-4
lines changed

PythonImproved.tmLanguage

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@
15381538
<dict>
15391539
<key>match</key>
15401540
<string>(?x)
1541-
(?&lt;!\.)
1541+
(?&lt;!\.|@)
15421542
\b(
15431543
__import__ | abs | all | any | ascii | basestring | bin | bool |
15441544
bytearray | bytes | callable | chr | classmethod | cmp | compile |
@@ -2255,13 +2255,122 @@
22552255
<key>patterns</key>
22562256
<array>
22572257
<dict>
2258-
<key>comment</key>
2259-
<string>source.regexp.python is the default, this is the PI version</string>
22602258
<key>include</key>
2261-
<string>source.regex.python</string>
2259+
<string>source.regexp.python.improved</string>
22622260
</dict>
22632261
</array>
22642262
</dict>
2263+
<key>string_formatting</key>
2264+
<dict>
2265+
<key>captures</key>
2266+
<dict>
2267+
<key>11</key>
2268+
<dict>
2269+
<key>name</key>
2270+
<string>constant.numeric.integer.octal.python</string>
2271+
</dict>
2272+
<key>12</key>
2273+
<dict>
2274+
<key>name</key>
2275+
<string>constant.numeric.integer.hexadecimal.python</string>
2276+
</dict>
2277+
<key>13</key>
2278+
<dict>
2279+
<key>name</key>
2280+
<string>constant.numeric.integer.binary.python</string>
2281+
</dict>
2282+
<key>14</key>
2283+
<dict>
2284+
<key>name</key>
2285+
<string>attribute.name</string>
2286+
</dict>
2287+
<key>16</key>
2288+
<dict>
2289+
<key>name</key>
2290+
<string>attribute.identifier</string>
2291+
</dict>
2292+
<key>6</key>
2293+
<dict>
2294+
<key>name</key>
2295+
<string>identifier</string>
2296+
</dict>
2297+
<key>8</key>
2298+
<dict>
2299+
<key>name</key>
2300+
<string>constant.numeric.integer.decimal.python</string>
2301+
</dict>
2302+
</dict>
2303+
<key>comment</key>
2304+
<string>Attempt from @sprt to add support for new-style string formatting.</string>
2305+
<key>match</key>
2306+
<string>(?x)
2307+
(?&lt;![^\{]\{)
2308+
\{
2309+
(?&lt;fieldname&gt;
2310+
(
2311+
(?&lt;argname&gt;
2312+
(
2313+
(?&lt;identifier&gt;([\p{Alpha}_][\p{Alnum}_]*)) |
2314+
(?&lt;integer&gt;
2315+
([1-9]\d* | 0) |
2316+
(
2317+
0
2318+
(
2319+
(?i:
2320+
([o]?[0-7]+) |
2321+
([x][0-9a-f]+) |
2322+
([b][01]+)
2323+
)
2324+
)
2325+
)
2326+
)
2327+
)
2328+
)?
2329+
)
2330+
(
2331+
(?&lt;attributename&gt;
2332+
(\.\g&lt;identifier&gt;)
2333+
) |
2334+
\[
2335+
(
2336+
(?&lt;elementindex&gt;
2337+
(
2338+
(\g&lt;integer&gt;) |
2339+
(?&lt;indexstring&gt;[^\]\}\{]+)
2340+
)
2341+
)
2342+
)
2343+
\]
2344+
)*
2345+
)?
2346+
(
2347+
((?&lt;conversion&gt;(\![rsa])))
2348+
)?
2349+
(
2350+
(?&lt;formatspec&gt;
2351+
(
2352+
\:
2353+
(
2354+
(?&lt;fill&gt;.)?
2355+
(?&lt;align&gt;([&lt;&gt;=\^]))
2356+
)?
2357+
(?&lt;sign&gt;([\ +-]))?
2358+
\#?0?
2359+
(?&lt;width&gt;
2360+
(\g&lt;integer&gt;)
2361+
)?
2362+
,?
2363+
(?&lt;precision&gt;
2364+
\.
2365+
(\g&lt;integer&gt;)
2366+
)?
2367+
(?&lt;type&gt;([bcdEeFfGgnosXx%]))?
2368+
)?
2369+
)
2370+
)?
2371+
\}
2372+
(?!\}[^\}])</string>
2373+
</dict>
22652374
<key>string_quoted_double</key>
22662375
<dict>
22672376
<key>patterns</key>

0 commit comments

Comments
 (0)