forked from VimPlug/jedi
Further fixes for failing tests.
This commit is contained in:
@@ -125,15 +125,16 @@ def get_stack_at_position(grammar, source, module, pos):
|
|||||||
user_stmt = get_user_or_error_stmt(module, leaf.start_pos)
|
user_stmt = get_user_or_error_stmt(module, leaf.start_pos)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if user_stmt.type == 'error_leaf':
|
if user_stmt.type == 'error_leaf' or user_stmt.type == 'string':
|
||||||
# Error leafs cannot be parsed.
|
# Error leafs cannot be parsed, completion in strings is also
|
||||||
|
# impossible.
|
||||||
raise OnErrorLeaf(user_stmt)
|
raise OnErrorLeaf(user_stmt)
|
||||||
|
|
||||||
code = _get_code(source, user_stmt.start_pos, pos)
|
code = _get_code(source, user_stmt.start_pos, pos)
|
||||||
# Remove whitespace at the end. Necessary, because the tokenizer will parse
|
# Remove whitespace at the end. Necessary, because the tokenizer will parse
|
||||||
# an error token (there's no new line at the end in our case). This doesn't
|
# an error token (there's no new line at the end in our case). This doesn't
|
||||||
# alter any truth about the valid tokens at that position.
|
# alter any truth about the valid tokens at that position.
|
||||||
code = code.strip()
|
code = code.strip('\t ')
|
||||||
|
|
||||||
class EndMarkerReached(Exception):
|
class EndMarkerReached(Exception):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ def token_to_ilabel(grammar, type_, value):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
return grammar.tokens[type_]
|
return grammar.tokens[type_]
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class PgenParser(object):
|
class PgenParser(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user