parameters: (self,macro,args)
return_statement: return rep
docstring: Given a Macro and list of arguments (each a token list).
  
          This method returns an expanded version of a macro.
          The return value is a token sequence representing the replacement macro tokens
docstring_summary: Given a Macro and list of arguments (each a token list).
docstring_tokens: Given a Macro and list of arguments ( each a token list ) .
function: def _macro_expand_args(self,macro,args):
          """Given a Macro and list of arguments (each a token list).
  
          This method returns an expanded version of a macro.
          The return value is a token sequence representing the replacement macro tokens
  
          """
          # Make a copy of the macro token sequence
          rep = [copy.copy(_x) for _x in macro.value]
  
          # Make string expansion patches.  These do not alter the length of the replacement sequence
          str_expansion = {}
          for argnum, i in macro.str_patch:
              if argnum not in str_expansion:
                  str_expansion[argnum] = '"{}"'.format("".join([x.value for x in args[argnum]])).replace("\\","\\\\")
              rep[i] = copy.copy(rep[i])
              rep[i].value = str_expansion[argnum]
  
          # Make the variadic macro comma patch.  If the variadic macro argument is empty, we get rid
          comma_patch = False
          if macro.variadic and not args[-1]:
              for i in macro.var_comma_patch:
                  rep[i] = None
                  comma_patch = True
  
          # Make all other patches.   The order of these matters.  It is assumed that the patch list
          # has been sorted in reverse order of patch location since replacements will cause the
          # size of the replacement sequence to expand from the patch point.
  
          expanded = {}
          for ptype, argnum, i in macro.patch:
              # Concatenation. Argument is left unexpanded
              if ptype == 'c':
                  rep[i:i+1] = args[argnum]
              # Normal expansion. Argument is macro expanded first
              elif ptype == 'e':
                  if argnum not in expanded:
                      expanded[argnum] = self._expand_macros(args[argnum])
                  rep[i:i+1] = expanded[argnum]
  
          # Get rid of removed comma if necessary
          if comma_patch:
              rep = [_i for _i in rep if _i]
  
          if self.macro_callback:
              self.macro_callback(macro.name, [expanded[i] for i in range(len(expanded))])
          return rep
function_tokens: def _macro_expand_args ( self , macro , args ) : # Make a copy of the macro token sequence rep = [ copy . copy ( _x ) for _x in macro . value ] # Make string expansion patches.  These do not alter the length of the replacement sequence str_expansion = { } for argnum , i in macro . str_patch : if argnum not in str_expansion : str_expansion [ argnum ] = '"{}"' . format ( "" . join ( [ x . value for x in args [ argnum ] ] ) ) . replace ( "\\" , "\\\\" ) rep [ i ] = copy . copy ( rep [ i ] ) rep [ i ] . value = str_expansion [ argnum ] # Make the variadic macro comma patch.  If the variadic macro argument is empty, we get rid comma_patch = False if macro . variadic and not args [ - 1 ] : for i in macro . var_comma_patch : rep [ i ] = None comma_patch = True # Make all other patches.   The order of these matters.  It is assumed that the patch list # has been sorted in reverse order of patch location since replacements will cause the # size of the replacement sequence to expand from the patch point. expanded = { } for ptype , argnum , i in macro . patch : # Concatenation. Argument is left unexpanded if ptype == 'c' : rep [ i : i + 1 ] = args [ argnum ] # Normal expansion. Argument is macro expanded first elif ptype == 'e' : if argnum not in expanded : expanded [ argnum ] = self . _expand_macros ( args [ argnum ] ) rep [ i : i + 1 ] = expanded [ argnum ] # Get rid of removed comma if necessary if comma_patch : rep = [ _i for _i in rep if _i ] if self . macro_callback : self . macro_callback ( macro . name , [ expanded [ i ] for i in range ( len ( expanded ) ) ] ) return rep