equal
deleted
inserted
replaced
43 "end": (0, None, None, None, None), |
43 "end": (0, None, None, None, None), |
44 } |
44 } |
45 |
45 |
46 keywords = set(['and', 'or', 'not']) |
46 keywords = set(['and', 'or', 'not']) |
47 |
47 |
|
48 _quoteletters = set(['"', "'"]) |
|
49 _simpleopletters = set(pycompat.iterbytestr("():=,-|&+!~^%")) |
|
50 |
48 # default set of valid characters for the initial letter of symbols |
51 # default set of valid characters for the initial letter of symbols |
49 _syminitletters = set(pycompat.iterbytestr( |
52 _syminitletters = set(pycompat.iterbytestr( |
50 string.ascii_letters.encode('ascii') + |
53 string.ascii_letters.encode('ascii') + |
51 string.digits.encode('ascii') + |
54 string.digits.encode('ascii') + |
52 '._@')) | set(map(pycompat.bytechr, xrange(128, 256))) |
55 '._@')) | set(map(pycompat.bytechr, xrange(128, 256))) |
107 yield ('..', None, pos) |
110 yield ('..', None, pos) |
108 pos += 1 # skip ahead |
111 pos += 1 # skip ahead |
109 elif c == '#' and program[pos:pos + 2] == '##': # look ahead carefully |
112 elif c == '#' and program[pos:pos + 2] == '##': # look ahead carefully |
110 yield ('##', None, pos) |
113 yield ('##', None, pos) |
111 pos += 1 # skip ahead |
114 pos += 1 # skip ahead |
112 elif c in "():=,-|&+!~^%": # handle simple operators |
115 elif c in _simpleopletters: # handle simple operators |
113 yield (c, None, pos) |
116 yield (c, None, pos) |
114 elif (c in '"\'' or c == 'r' and |
117 elif (c in _quoteletters or c == 'r' and |
115 program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings |
118 program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings |
116 if c == 'r': |
119 if c == 'r': |
117 pos += 1 |
120 pos += 1 |
118 c = program[pos:pos + 1] |
121 c = program[pos:pos + 1] |
119 decode = lambda x: x |
122 decode = lambda x: x |