(self, tokenlist)
Store the tokens for this node inside the node.

        This post-parsing pass stores tokens on AST nodes directly so that the
        AST can be the source of truth for tokens and it preserves whitespace
        and comments even after the AST has been transformed.

        Args:
            tokenlist: The entire list of tokens for the parsed program.
Store the tokens for this node inside the node.
Store the tokens for this node inside the node .
def store_token_groups(self, tokenlist):
        """Store the tokens for this node inside the node.

        This post-parsing pass stores tokens on AST nodes directly so that the
        AST can be the source of truth for tokens and it preserves whitespace
        and comments even after the AST has been transformed.

        Args:
            tokenlist: The entire list of tokens for the parsed program.
        """
        pos = self.start_pos

        # Each token group is either a tuple (fieldname, tokens) or a simple
        # list a tokens (literal values). fieldname is:
        # - a string, the name of the field that follows these tokens
        # - a tuple of two elements: the name and the index in a field with a
        #   list value
        # - a tuple of three elements: 'exp_block_pairs', the index of the
        #   pair, the index of the pair member (0,1)
        self._token_groups = []

        for fieldname in self._fields:
            fieldvalue = getattr(self, fieldname)
            pos = self._add_token_group(fieldname, fieldvalue, tokenlist, pos)
        self._token_groups.append(tokenlist[pos:self.end_pos])
def store_token_groups ( self , tokenlist ) : pos = self . start_pos # Each token group is either a tuple (fieldname, tokens) or a simple # list a tokens (literal values). fieldname is: # - a string, the name of the field that follows these tokens # - a tuple of two elements: the name and the index in a field with a #   list value # - a tuple of three elements: 'exp_block_pairs', the index of the #   pair, the index of the pair member (0,1) self . _token_groups = [ ] for fieldname in self . _fields : fieldvalue = getattr ( self , fieldname ) pos = self . _add_token_group ( fieldname , fieldvalue , tokenlist , pos ) self . _token_groups . append ( tokenlist [ pos : self . end_pos ] )