some cleanup

This commit is contained in:
adam j hartz 2015-03-24 20:55:07 -04:00
parent 3b1527048c
commit aa343facfd
3 changed files with 0 additions and 6 deletions

View file

@ -103,7 +103,6 @@ class CtxAwareTransformer(NodeTransformer):
maxcol = None# if self.mode == 'eval' else node.col_offset
spline = subproc_toks(line, mincol=mincol, maxcol=maxcol,
returnline=False, lexer=self.parser.lexer)
print('spline',spline)
try:
newnode = self.parser.parse(spline, mode=self.mode)
newnode = newnode.body

View file

@ -315,16 +315,13 @@ class Lexer(object):
def input(self, s):
"""Calls the lexer on the string s."""
print("input\n", repr(s))
s = re.sub(r'#.*?\n', '', s)
print("mod\n",repr(s))
self.token_stream = preprocess_tokens(tok(s))
def token(self):
"""Retrieves the next token."""
try:
self.last = next(self.token_stream)
print(self.last)
return self.last
except StopIteration:
return None

View file

@ -48,7 +48,6 @@ def subproc_toks(line, mincol=-1, maxcol=None, lexer=None, returnline=False):
for tok in lexer:
pos = tok.lexpos
if pos >= maxcol:
print('too big',pos,maxcol)
break
if len(toks) > 0 and toks[-1].type == 'SEMI':
toks.clear()
@ -72,7 +71,6 @@ def subproc_toks(line, mincol=-1, maxcol=None, lexer=None, returnline=False):
if len(toks) == 0:
return # handle comment lines
beg, end = toks[0].lexpos, (toks[-1].lexpos + end_offset)
print(repr(line), toks, beg, end)
rtn = '$[' + line[beg:end] + ']'
if returnline:
rtn = line[:beg] + rtn + line[end:]