Check it after removing nesting

master
Salvo 'LtWorf' Tomaselli 2020-06-18 17:01:52 +07:00
parent e5f7b1745c
commit 0df6a263e5
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 3 additions and 3 deletions

@ -273,17 +273,17 @@ class Unary(Node):
def parse_tokens(expression: List[Union[list, str]]) -> Node: def parse_tokens(expression: List[Union[list, str]]) -> Node:
'''Generates the tree from the tokenized expression '''Generates the tree from the tokenized expression
If no expression is specified then it will create an empty node''' If no expression is specified then it will create an empty node'''
if len(expression) == 0:
raise ParserException('Failed to parse empty expression')
# If the list contains only a list, it will consider the lower level list. # If the list contains only a list, it will consider the lower level list.
# This will allow things like ((((((a))))) to work # This will allow things like ((((((a))))) to work
while len(expression) == 1 and isinstance(expression[0], list): while len(expression) == 1 and isinstance(expression[0], list):
expression = expression[0] expression = expression[0]
if len(expression) == 0:
raise ParserException('Failed to parse empty expression')
# The list contains only 1 string. Means it is the name of a relation # The list contains only 1 string. Means it is the name of a relation
if len(expression) == 1: if len(expression) == 1:
if not rtypes.is_valid_relation_name(expression[0]): if not rtypes.is_valid_relation_name(expression[0]):
raise ParserException( raise ParserException(
u"'%s' is not a valid relation name" % expression[0]) u"'%s' is not a valid relation name" % expression[0])