code: def split_args_list(tokens, loc):
      
      req_args, def_args, star_arg, kwd_args, dubstar_arg = [], [], None, [], None
      pos = 0
      for arg in tokens:
          if len(arg) == 1:
              if arg[0] == "*":
                  # star sep (pos = 3)
                  if pos >= 3:
                      raise CoconutDeferredSyntaxError("star separator at invalid position in function definition", loc)
                  pos = 3
              else:
                  # pos arg (pos = 0)
                  if pos > 0:
                      raise CoconutDeferredSyntaxError("positional arguments must come first in function definition", loc)
                  req_args.append(arg[0])
          elif len(arg) == 2:
              if arg[0] == "*":
                  # star arg (pos = 2)
                  if pos >= 2:
                      raise CoconutDeferredSyntaxError("star argument at invalid position in function definition", loc)
                  pos = 2
                  star_arg = arg[1]
              elif arg[0] == "**":
                  # dub star arg (pos = 4)
                  if pos == 4:
                      raise CoconutDeferredSyntaxError("double star argument at invalid position in function definition", loc)
                  pos = 4
                  dubstar_arg = arg[1]
              else:
                  # def arg (pos = 1)
                  if pos <= 1:
                      pos = 1
                      def_args.append((arg[0], arg[1]))
                  # kwd arg (pos = 3)
                  elif pos <= 3:
                      pos = 3
                      kwd_args.append((arg[0], arg[1]))
                  else:
                      raise CoconutDeferredSyntaxError("invalid default argument in function definition", loc)
          else:
              raise CoconutInternalException("invalid function definition argument", arg)
      return req_args, def_args, star_arg, kwd_args, dubstar_arg
docs: Splits function definition arguments.