X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/6aef6c9d458e8df88f510e94c18f216232b6a786..e027fc9e75daadd7e22f12e6e1e374bcca998087:/blib2to3/pgen2/conv.py?ds=inline diff --git a/blib2to3/pgen2/conv.py b/blib2to3/pgen2/conv.py index dd70752..728b152 100644 --- a/blib2to3/pgen2/conv.py +++ b/blib2to3/pgen2/conv.py @@ -70,8 +70,7 @@ class Converter(grammar.Grammar): lineno += 1 mo = re.match(r"^#define\s+(\w+)\s+(\d+)$", line) if not mo and line.strip(): - print("%s(%s): can't parse %s" % (filename, lineno, - line.strip())) + print("%s(%s): can't parse %s" % (filename, lineno, line.strip())) else: symbol, number = mo.groups() number = int(number) @@ -118,39 +117,38 @@ class Converter(grammar.Grammar): lineno = 0 # Expect the two #include lines - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) assert line == '#include "pgenheaders.h"\n', (lineno, line) - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) assert line == '#include "grammar.h"\n', (lineno, line) # Parse the state definitions - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) allarcs = {} states = [] while line.startswith("static arc "): while line.startswith("static arc "): - mo = re.match(r"static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$", - line) + mo = re.match(r"static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$", line) assert mo, (lineno, line) n, m, k = list(map(int, mo.groups())) arcs = [] for _ in range(k): - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) mo = re.match(r"\s+{(\d+), (\d+)},$", line) assert mo, (lineno, line) i, j = list(map(int, mo.groups())) arcs.append((i, j)) - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) assert line == "};\n", (lineno, line) allarcs[(n, m)] = arcs - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) mo = re.match(r"static state states_(\d+)\[(\d+)\] = {$", line) assert mo, (lineno, line) s, t = list(map(int, mo.groups())) assert s == len(states), (lineno, line) state = [] for _ in range(t): - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) mo = re.match(r"\s+{(\d+), arcs_(\d+)_(\d+)},$", line) assert mo, (lineno, line) k, n, m = list(map(int, mo.groups())) @@ -158,9 +156,9 @@ class Converter(grammar.Grammar): assert k == len(arcs), (lineno, line) state.append(arcs) states.append(state) - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) assert line == "};\n", (lineno, line) - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) self.states = states # Parse the dfas @@ -169,9 +167,8 @@ class Converter(grammar.Grammar): assert mo, (lineno, line) ndfas = int(mo.group(1)) for i in range(ndfas): - lineno, line = lineno+1, next(f) - mo = re.match(r'\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$', - line) + lineno, line = lineno + 1, next(f) + mo = re.match(r'\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$', line) assert mo, (lineno, line) symbol = mo.group(2) number, x, y, z = list(map(int, mo.group(1, 3, 4, 5))) @@ -180,7 +177,7 @@ class Converter(grammar.Grammar): assert x == 0, (lineno, line) state = states[z] assert y == len(state), (lineno, line) - lineno, line = lineno+1, next(f) + lineno, line = lineno + 1, next(f) mo = re.match(r'\s+("(?:\\\d\d\d)*")},$', line) assert mo, (lineno, line) first = {} @@ -188,21 +185,21 @@ class Converter(grammar.Grammar): for i, c in enumerate(rawbitset): byte = ord(c) for j in range(8): - if byte & (1<