parser/parsing/parseSubExpression.py
def find_closing(tokens, opening):
	"""
    Function for parsing sub_expression that has a closing

    :param tokens: tokens of Expression object
    :param opening: opening character
    """
	if opening == "(":
		closing = ")"
	elif opening == "[":
		closing = "]"
	elif opening == "<":
		closing = ">"
	elif opening == "/":
		closing = "/"
	remain = 0
	sub_expression = opening
	for i in range(len(tokens)):
		if tokens[i].token == opening:
			remain += 1 # edge case like (a(b)c)
		elif tokens[i].token == closing:
			if remain == 0:
				sub_expression += tokens[i].token
				return i + 2, sub_expression
			remain -= 1
		sub_expression += tokens[i].token

    Function for parsing sub_expression that has a closing

    :param tokens: tokens of Expression object
    :param opening: opening character
    
Function for parsing sub_expression that has a closing
Function for parsing sub_expression that has a closing
def find_closing(tokens, opening):
	if opening == "(":
		closing = ")"
	elif opening == "[":
		closing = "]"
	elif opening == "<":
		closing = ">"
	elif opening == "/":
		closing = "/"
	remain = 0
	sub_expression = opening
	for i in range(len(tokens)):
		if tokens[i].token == opening:
			remain += 1 
		elif tokens[i].token == closing:
			if remain == 0:
				sub_expression += tokens[i].token
				return i + 2, sub_expression
			remain -= 1
		sub_expression += tokens[i].token
def find_closing ( tokens , opening ) : if opening == "(" : closing = ")" elif opening == "[" : closing = "]" elif opening == "<" : closing = ">" elif opening == "/" : closing = "/" remain = 0 sub_expression = opening for i in range ( len ( tokens ) ) : if tokens [ i ] . token == opening : remain += 1 elif tokens [ i ] . token == closing : if remain == 0 : sub_expression += tokens [ i ] . token return i + 2 , sub_expression remain -= 1 sub_expression += tokens [ i ] . token
Function for parsing sub_expression that has a closing
Function for parsing sub_expression that has a closing
"""
    Function for parsing sub_expression that has a closing

    :param tokens: tokens of Expression object
    :param opening: opening character
    """ # edge case like (a(b)c)
tokens
tokens of Expression object
tokens of Expression object
opening
None