def parse_assign_variable(self, tokens):
        """
        Example:
            tokens
                dharma.String:      'let ',
                dharma.ElementXRef: 'GrammarNS:<VarName>',
                dharma.String:      '= new ',
                dharma.ValueXRef:   'GrammarNS:<ValueName>'
        """
        for i, token in enumerate(tokens):
            if isinstance(token, ElementXRef):
                variable = token.value
                break
        else:
            logging.error("%s: Variable assignment syntax error", self.id())
            sys.exit(-1)
        if variable != self.current_obj.ident:
            logging.error("%s: Variable name mismatch", self.id())
            sys.exit(-1)
        if not isinstance(self.current_obj, DharmaVariable):
            logging.error("%s: Inconsistent object for variable assignment", self.id())
            sys.exit(-1)
        prefix, suffix = tokens[:i], tokens[i + 1:]  # pylint: disable=undefined-loop-variable
        self.current_obj.append((prefix, suffix))
def parse_assign_variable ( self , tokens ) : for i , token in enumerate ( tokens ) : if isinstance ( token , ElementXRef ) : variable = token . value break else : logging . error ( "%s: Variable assignment syntax error" , self . id ( ) ) sys . exit ( - 1 ) if variable != self . current_obj . ident : logging . error ( "%s: Variable name mismatch" , self . id ( ) ) sys . exit ( - 1 ) if not isinstance ( self . current_obj , DharmaVariable ) : logging . error ( "%s: Inconsistent object for variable assignment" , self . id ( ) ) sys . exit ( - 1 ) prefix , suffix = tokens [ : i ] , tokens [ i + 1 : ] self . current_obj . append ( ( prefix , suffix ) )
Example:
            tokens
                dharma.String:      'let ',
                dharma.ElementXRef: 'GrammarNS:<VarName>',
                dharma.String:      '= new ',
                dharma.ValueXRef:   'GrammarNS:<ValueName>'