Next Higher-Order Parsing 27 

リストLists

      sub list_of {
        my ($item, $separator) = @_;
        $separator = lookfor("COMMA") unless defined $separator;
        conc($item, repeat($separator, $item), optional($separator));
      }
      $list = conc(lookfor("("),
                   list_of($EXPRESSION),
                   lookfor(")"));
      $block = conc(lookfor("{"),
                    list_of($STATEMENT, lookfor(";")),
                    lookfor("}"));

Next Copyright © 2007 M. J. Dominus