py3: make set of revset operators and quotes in bytes
authorYuya Nishihara <yuya@tcha.org>
Sun, 12 Mar 2017 17:13:54 -0700
changeset 31384 fac5cd3b8673
parent 31383 7556fe09cc48
child 31385 1c48a8278b2f
py3: make set of revset operators and quotes in bytes
mercurial/revsetlang.py
--- a/mercurial/revsetlang.py	Sun Mar 12 17:10:14 2017 -0700
+++ b/mercurial/revsetlang.py	Sun Mar 12 17:13:54 2017 -0700
@@ -45,6 +45,9 @@
 
 keywords = set(['and', 'or', 'not'])
 
+_quoteletters = set(['"', "'"])
+_simpleopletters = set(pycompat.iterbytestr("():=,-|&+!~^%"))
+
 # default set of valid characters for the initial letter of symbols
 _syminitletters = set(pycompat.iterbytestr(
     string.ascii_letters.encode('ascii') +
@@ -109,9 +112,9 @@
         elif c == '#' and program[pos:pos + 2] == '##': # look ahead carefully
             yield ('##', None, pos)
             pos += 1 # skip ahead
-        elif c in "():=,-|&+!~^%": # handle simple operators
+        elif c in _simpleopletters: # handle simple operators
             yield (c, None, pos)
-        elif (c in '"\'' or c == 'r' and
+        elif (c in _quoteletters or c == 'r' and
               program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings
             if c == 'r':
                 pos += 1