def __lvalue(self, assign_node): lvalue_node = ast.LValue() lvalue_node.path.append(self.current_token) self.__eat(token.ID, 'expecting ID') while self.current_token.tokentype == token.DOT: self.__advance() lvalue_node.path.append(self.current_token) self.__eat(token.ID, 'expecting ID') assign_node.lhs = lvalue_node
def __lvalue(self): lval_node = ast.LValue() lval_node.path.append(self.current_token) self.__eat(token.ID, "expecting an ID") while self.current_token.tokentype == token.DOT: self.__advance() lval_node.path.append(self.current_token) self.__eat(token.ID, "expecting an ID") return lval_node
def __lvalue(self): """<lvalue> ::= ID (DOT ID)*""" lvalue_node = ast.LValue() lvalue_node.path.append(self.current_token) self.__eat(token.ID, "expecting an identifier") while self.current_token.tokentype == token.DOT: self.__eat(token.DOT, 'expecting a "."') lvalue_node.path.append(self.current_token) self.__eat(token.ID, "expecting an identifier") return lvalue_node
def __lvalue(self): """<lvalue> ::= ID ( DOT ID )∗""" lvalueStmt = ast.LValue() lvalueStmt.path.append(self.current_token) self.__eat(token.ID, "expecting ID") while self.current_token.tokentype == token.DOT: self.__advance() lvalueStmt.path.append(self.current_token) self.__eat(token.ID, "expecting ID") return lvalueStmt
def __lvalue(self): """<lvalue> ::= ID ( DOT ID )*""" l_value_node = ast.LValue() l_value_node.path.append(self.current_token) self.__eat(token.ID, 'expecting "ID"') while (self.current_token.tokentype == token.DOT): self.__advance() l_value_node.path.append(self.current_token) self.__eat(token.ID, 'expecting "ID"') return l_value_node
def __lvalue(self): # print("lvalue: " + str(self.current_token)) lvalue_node = ast.LValue() lvalue_node.path.append(self.current_token) # add first lvalue self.__eat(token.ID, 'expected ID') while self.current_token.tokentype == token.DOT: self.__advance() # eat DOT (we already know from 1 line up) lvalue_node.path.append(self.current_token) # add following lvalues if they exist self.__eat(token.ID, 'expected ID') return lvalue_node
def __lvalue(self): """<lvalue> ::= ID ( DOT ID )*""" lvalue = ast.LValue() lvalue.path.append(self.current_token) self.__eat(token.ID, "expected ID") while self.__tokenIs(token.DOT): self.__advance() lvalue.path.append(self.current_token) self.__eat(token.ID, "expected 'ID'") return lvalue