src/Pure/System/getopts.scala
changeset 71383 8313dca6dee9
parent 67178 70576478bda9
child 71601 97ccf48c2f0c
equal deleted inserted replaced
71382:6316debd3a9f 71383:8313dca6dee9
    45     }
    45     }
    46 
    46 
    47   private def getopts(args: List[List[Char]]): List[List[Char]] =
    47   private def getopts(args: List[List[Char]]): List[List[Char]] =
    48     args match {
    48     args match {
    49       case List('-', '-') :: rest_args => rest_args
    49       case List('-', '-') :: rest_args => rest_args
    50       case ('-' :: opt :: rest_opts) :: rest_args if is_option0(opt) && !rest_opts.isEmpty =>
    50       case ('-' :: opt :: rest_opts) :: rest_args if is_option0(opt) && rest_opts.nonEmpty =>
    51         option(opt, Nil); getopts(('-' :: rest_opts) :: rest_args)
    51         option(opt, Nil); getopts(('-' :: rest_opts) :: rest_args)
    52       case List('-', opt) :: rest_args if is_option0(opt) =>
    52       case List('-', opt) :: rest_args if is_option0(opt) =>
    53         option(opt, Nil); getopts(rest_args)
    53         option(opt, Nil); getopts(rest_args)
    54       case ('-' :: opt :: opt_arg) :: rest_args if is_option1(opt) && !opt_arg.isEmpty =>
    54       case ('-' :: opt :: opt_arg) :: rest_args if is_option1(opt) && opt_arg.nonEmpty =>
    55         option(opt, opt_arg); getopts(rest_args)
    55         option(opt, opt_arg); getopts(rest_args)
    56       case List('-', opt) :: opt_arg :: rest_args if is_option1(opt) =>
    56       case List('-', opt) :: opt_arg :: rest_args if is_option1(opt) =>
    57         option(opt, opt_arg); getopts(rest_args)
    57         option(opt, opt_arg); getopts(rest_args)
    58       case List(List('-', opt)) if is_option1(opt) =>
    58       case List(List('-', opt)) if is_option1(opt) =>
    59         Output.error_message("Command-line option " + print_option(opt) + " requires an argument")
    59         Output.error_message("Command-line option " + print_option(opt) + " requires an argument")