1
0
forked from VimPlug/jedi

removed the INDENT usages that were left in the parser code

This commit is contained in:
Dave Halter
2014-02-21 15:39:14 +01:00
parent fe02088dd7
commit 73057d4176
2 changed files with 5 additions and 18 deletions

View File

@@ -157,8 +157,6 @@ class Parser(object):
token_type, tok = self.next()
if brackets and tok == '\n':
token_type, tok = self.next()
if token_type == tokenize.INDENT:
continue # TODO REMOVE, after removing the indents.
i, token_type, tok = self._parse_dot_name(self._current)
if not i:
defunct = True
@@ -402,7 +400,7 @@ class Parser(object):
typ, tok, start_pos, end_pos = next(self._gen)
# dedents shouldn't change positions
self.start_pos = start_pos
if typ not in (tokenize.INDENT, tokenize.NEWLINE):
if typ not in (tokenize.NEWLINE,):
self.start_pos, self.end_pos = start_pos, end_pos
self._current = typ, tok
@@ -617,8 +615,7 @@ class Parser(object):
self._scope.add_statement(stmt)
self.freshscope = False
else:
if token_type not in [tokenize.COMMENT, tokenize.INDENT,
tokenize.NEWLINE]:
if token_type not in [tokenize.COMMENT, tokenize.NEWLINE]:
debug.warning('Token not used: %s %s %s', tok,
tokenize.tok_name[token_type], self.start_pos)
continue

View File

@@ -157,8 +157,6 @@ def generate_tokens(readline, line_offset=0):
numchars = '0123456789'
contstr = ''
contline = None
indents = [0]
while True: # loop over lines in stream
try:
line = readline()
@@ -208,14 +206,6 @@ def generate_tokens(readline, line_offset=0):
else:
yield TokenInfo(NEWLINE, line[pos:], (lnum, pos), (lnum, len(line)))
continue
if column > indents[-1]: # count indents or dedents
indents.append(column)
#print repr(line), lnum
#yield TokenInfo(INDENT, line[:pos], (lnum, 0), (lnum, pos))
while column < indents[-1]:
indents = indents[:-1]
else: # continued statement
continued = False
@@ -318,10 +308,10 @@ class NoErrorTokenizer(object):
if not self.first_stmt:
self.closed = True
raise common.MultiLevelStopIteration()
# ignore indents/comments
# ignore comments/ newlines
if self.is_fast_parser \
and self.previous[0] in (INDENT, None, NEWLINE) \
and c[0] not in (COMMENT, INDENT, NEWLINE):
and self.previous[0] in (None, NEWLINE) \
and c[0] not in (COMMENT, NEWLINE):
# print c, tok_name[c[0]]
tok = c[1]