Skip to content

Commit 1eb3ebc

Browse files
authored
Merge pull request #96 from jcohen28/patch-1
Fix tokenize with number as first char
2 parents ee600ae + 825fb8d commit 1eb3ebc

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ next
77
----
88

99

10+
3.8 (2020-06-10)
11+
----------------
12+
13+
* No API changes
14+
15+
* Bug fixes
16+
17+
* Fix parsing of tokens that have a number as the first character
18+
19+
1020
3.7 (2019-10-04)
1121
----------------
1222

boolean/boolean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def tokenize(self, expr):
461461
while position < length:
462462
tok = expr[position]
463463

464-
sym = tok.isalpha() or tok == '_'
464+
sym = tok.isalnum() or tok == '_'
465465
if sym:
466466
position += 1
467467
while position < length:

boolean/test_boolean.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,8 @@ def test_parse(self):
10791079
self.assertEqual(algebra.parse('a&(a|~b)', simplify=True), (a & (a | ~b)).simplify())
10801080
self.assertEqual(algebra.parse('(a&b)|(b&((c|a)&(b|(c&a))))', simplify=True), ((a & b) | (b & ((c | a) & (b | (c & a))))).simplify())
10811081
self.assertEqual(algebra.parse('(a&b)|(b&((c|a)&(b|(c&a))))', simplify=True), algebra.parse('a&b | b&(c|a)&(b|c&a)', simplify=True))
1082+
self.assertEqual(algebra.parse('1abc'), algebra.Symbol('1abc'))
1083+
self.assertEqual(algebra.parse('_abc'), algebra.Symbol('_abc'))
10821084

10831085
def test_subs(self):
10841086
algebra = BooleanAlgebra()

0 commit comments

Comments
 (0)