src/newLexer.py
def process_op(self, operator):
		''' process operators into the postfix expression '''
		# if the stack is not empty, remove the top element
		if self.op_stack:
			prev_op = self.op_stack.pop()
			# if stack operator has lower precedence, add both to the stack
			if self.get_precedence(prev_op) < self.get_precedence(operator):
				self.op_stack.append(prev_op)
				self.op_stack.append(operator)
			# otherwise, append the stack operator to output and push op to stack
			else:
				self.postfix.append(prev_op)
				self.op_stack.append(operator)
		# otherwise, add operator to stack
		else:
			self.op_stack.append(operator)
 process operators into the postfix expression 
process operators into the postfix expression
process operators into the postfix expression
def process_op(self, operator):
		if self.op_stack:
			prev_op = self.op_stack.pop()
			if self.get_precedence(prev_op) < self.get_precedence(operator):
				self.op_stack.append(prev_op)
				self.op_stack.append(operator)
			else:
				self.postfix.append(prev_op)
				self.op_stack.append(operator)
		else:
			self.op_stack.append(operator)
def process_op ( self , operator ) : if self . op_stack : prev_op = self . op_stack . pop ( ) if self . get_precedence ( prev_op ) < self . get_precedence ( operator ) : self . op_stack . append ( prev_op ) self . op_stack . append ( operator ) else : self . postfix . append ( prev_op ) self . op_stack . append ( operator ) else : self . op_stack . append ( operator )
process operators into the postfix expression
process operators into the postfix expression
''' process operators into the postfix expression ''' # if the stack is not empty, remove the top element # if stack operator has lower precedence, add both to the stack # otherwise, append the stack operator to output and push op to stack # otherwise, add operator to stack
self
operator