Next Higher-Order Parsing 16 

結合Concatenation

        atom → "FUNC" "(" expression ")"
        sub atom {
          my $t1 = shift;
          my ($expr, $t2, $t3, $t4, $t5);
     
          if (   ($funcname, $t2) = lookfor("FUNC")->($t1)
              && (undef,     $t3) = lookfor("(")->($t2) 
              && ($expr,     $t4) = expression($t3)
              && (undef,     $t5) = lookfor(")")->($t4)) {
                my $val = ... $funcname ... $expr ...;
                return ($val, $t5);
          } else {
                return;  # failure
          }
        }
        conc(A, B, ...)

Next Copyright © 2007 M. J. Dominus