Skip to content

Commit 0689d72

Browse files
committed
minor changes to general parser- still undone
1 parent b5b4121 commit 0689d72

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

python/pydocstring.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ def _whole_string(self):
7575
lines_it = self.env.lines_following_cursor()
7676
counter = 0
7777
while not valid:
78-
if counter == self.max_lines:
79-
raise InvalidSyntax(
80-
'The method either invalid or it is on > {} lines.'.format(str(self.max_lines)))
81-
last_row, line = next(lines_it)
78+
try:
79+
last_row, line = next(lines_it)
80+
except StopIteration as e:
81+
pass # TODO do something (is_valid?)
82+
8283
lines.append(line)
8384
data = ''.join(lines)
8485
valid, tree = self._is_valid(data)
@@ -87,6 +88,7 @@ def _whole_string(self):
8788
arguments = self._arguments(tree)
8889
func_indent = re.findall('^(\s*)', lines[0])[0]
8990

91+
# TODO: change, adding pass will go away
9092
def _is_valid(self, lines):
9193
func = ''.join([lines.lstrip(), '\n pass'])
9294
try:

python/vimenv.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ def lines_following_cursor(self):
9696
import vim
9797
lines = []
9898
buffer = vim.current.buffer
99-
cursor_row = vim.current.window.cursor[0]-1
99+
cursor_row = vim.current.window.cursor[0] - 1
100100
current_row = cursor_row
101101
while True:
102+
if current_row >= len(vim.current.buffer) - 1:
103+
raise StopIteration('Buffer is out of lines.')
102104
yield current_row, buffer[current_row]
103105
current_row += 1

0 commit comments

Comments
 (0)