forked from VimPlug/jedi
get the 'not' priorities right for precedences
This commit is contained in:
@@ -86,7 +86,8 @@ def _get_number(iterator, priority=PythonGrammar.LOWEST_PRIORITY):
|
|||||||
if isinstance(el, pr.Operator):
|
if isinstance(el, pr.Operator):
|
||||||
if el in PythonGrammar.FACTOR:
|
if el in PythonGrammar.FACTOR:
|
||||||
right = _get_number(iterator, PythonGrammar.FACTOR_PRIORITY)
|
right = _get_number(iterator, PythonGrammar.FACTOR_PRIORITY)
|
||||||
elif el in PythonGrammar.NOT_TEST and priority <= PythonGrammar.FACTOR_PRIORITY:
|
elif el in PythonGrammar.NOT_TEST \
|
||||||
|
and priority >= PythonGrammar.NOT_TEST_PRIORITY:
|
||||||
right = _get_number(iterator, PythonGrammar.NOT_TEST_PRIORITY)
|
right = _get_number(iterator, PythonGrammar.NOT_TEST_PRIORITY)
|
||||||
else:
|
else:
|
||||||
_syntax_error(el)
|
_syntax_error(el)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ def test_simple():
|
|||||||
|
|
||||||
def test_prefixed():
|
def test_prefixed():
|
||||||
assert parse_tree('--2') == (None, '-', (None, '-', 2))
|
assert parse_tree('--2') == (None, '-', (None, '-', 2))
|
||||||
assert parse_tree('1 and not - 2') == (1, 'and', (None, '-', 2))
|
assert parse_tree('1 and not - 2') == (1, 'and', (None, 'not', (None, '-', 2)))
|
||||||
|
|
||||||
|
|
||||||
def test_invalid():
|
def test_invalid():
|
||||||
|
|||||||
Reference in New Issue
Block a user