parameters: (self, tokens)
return_statement: return 0, [], []
docstring: Collects comma separated arguments from a list of tokens.
  
          The arguments must be enclosed in parenthesis.
  
          Returns a tuple (tokencount, args, positions) where
            tokencount is the number of tokens consumed,
            args is a list of arguments,
            and positions is a list of integers containing the starting index of each argument.
          Each argument is represented by a list of tokens.
  
          When collecting arguments, leading and trailing whitespace is removed from each argument.
  
          This function properly handles nested parenthesis and commas---these do not define new arguments.
docstring_summary: Collects comma separated arguments from a list of tokens.
docstring_tokens: Collects comma separated arguments from a list of tokens .
function: def _collect_args(self, tokens):
          """Collects comma separated arguments from a list of tokens.
  
          The arguments must be enclosed in parenthesis.
  
          Returns a tuple (tokencount, args, positions) where
            tokencount is the number of tokens consumed,
            args is a list of arguments,
            and positions is a list of integers containing the starting index of each argument.
          Each argument is represented by a list of tokens.
  
          When collecting arguments, leading and trailing whitespace is removed from each argument.
  
          This function properly handles nested parenthesis and commas---these do not define new arguments.
  
          """
          args = []
          positions = []
          current_arg = []
          nesting = 1
          tokenlen = len(tokens)
  
          # Search for the opening '('.
          i = 0
          while (i < tokenlen) and (tokens[i].type in self.t_WS):
              i += 1
  
          if (i < tokenlen) and (tokens[i].value == '('):
              positions.append(i+1)
          else:
              self._error(tokens[0].lineno, "Missing '(' in macro arguments")
              return 0, [], []
  
          i += 1
  
          while i < tokenlen:
              t = tokens[i]
              if t.value == '(':
                  current_arg.append(t)
                  nesting += 1
              elif t.value == ')':
                  nesting -= 1
                  if nesting == 0:
                      if current_arg:
                          args.append(self._tokenstrip(current_arg))
                          positions.append(i)
                      return i + 1, args, positions
                  current_arg.append(t)
              elif t.value == ',' and nesting == 1:
                  args.append(self._tokenstrip(current_arg))
                  positions.append(i+1)
                  current_arg = []
              else:
                  current_arg.append(t)
              i += 1
  
          # Missing end argument
          self._error(tokens[-1].lineno, "Missing ')' in macro arguments")
          return 0, [], []
function_tokens: def _collect_args ( self , tokens ) : args = [ ] positions = [ ] current_arg = [ ] nesting = 1 tokenlen = len ( tokens ) # Search for the opening '('. i = 0 while ( i < tokenlen ) and ( tokens [ i ] . type in self . t_WS ) : i += 1 if ( i < tokenlen ) and ( tokens [ i ] . value == '(' ) : positions . append ( i + 1 ) else : self . _error ( tokens [ 0 ] . lineno , "Missing '(' in macro arguments" ) return 0 , [ ] , [ ] i += 1 while i < tokenlen : t = tokens [ i ] if t . value == '(' : current_arg . append ( t ) nesting += 1 elif t . value == ')' : nesting -= 1 if nesting == 0 : if current_arg : args . append ( self . _tokenstrip ( current_arg ) ) positions . append ( i ) return i + 1 , args , positions current_arg . append ( t ) elif t . value == ',' and nesting == 1 : args . append ( self . _tokenstrip ( current_arg ) ) positions . append ( i + 1 ) current_arg = [ ] else : current_arg . append ( t ) i += 1 # Missing end argument self . _error ( tokens [ - 1 ] . lineno , "Missing ')' in macro arguments" ) return 0 , [ ] , [ ]