Skip to content

Commit 2780782

Browse files
committed
Add '%b' as a valid percent-format (PEP 461).
Issue #125.
1 parent fb56c6a commit 2780782

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

grammars/MagicPython.cson

+1-1
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ repository:
925925
[-+#0 ]*
926926
(\\d+|\\*)? (\\.(\\d+|\\*))?
927927
([hlL])?
928-
[diouxXeEfFgGcrsa%]
928+
[diouxXeEfFgGcrsab%]
929929
)
930930
931931
'''

grammars/MagicPython.tmLanguage

+1-1
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@
14191419
[-+#0 ]*
14201420
(\d+|\*)? (\.(\d+|\*))?
14211421
([hlL])?
1422-
[diouxXeEfFgGcrsa%]
1422+
[diouxXeEfFgGcrsab%]
14231423
)
14241424
</string>
14251425
<key>captures</key>

grammars/src/MagicPython.syntax.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ repository:
777777
[-+#0 ]*
778778
(\d+|\*)? (\.(\d+|\*))?
779779
([hlL])?
780-
[diouxXeEfFgGcrsa%]
780+
[diouxXeEfFgGcrsab%]
781781
)
782782
captures:
783783
'1': {name: constant.character.format.placeholder.other.python}

test/strings/format16.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
a = b'%b' % b'foo'
2+
3+
4+
5+
a : source.python
6+
: source.python
7+
= : keyword.operator.assignment.python, source.python
8+
: source.python
9+
b : source.python, storage.type.string.python, string.quoted.binary.single.python
10+
' : punctuation.definition.string.begin.python, source.python, string.quoted.binary.single.python
11+
%b : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.binary.single.python
12+
' : punctuation.definition.string.end.python, source.python, string.quoted.binary.single.python
13+
: source.python
14+
% : keyword.operator.arithmetic.python, source.python
15+
: source.python
16+
b : source.python, storage.type.string.python, string.quoted.binary.single.python
17+
' : punctuation.definition.string.begin.python, source.python, string.quoted.binary.single.python
18+
foo : source.python, string.quoted.binary.single.python
19+
' : punctuation.definition.string.end.python, source.python, string.quoted.binary.single.python

0 commit comments

Comments
 (0)