Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 134f0a3e6cf3182d61d0f4bdeef756b7 > files > 11

perl-Parse-RecDescent-1.967.9-3.mga4.noarch.rpm

#! /usr/bin/perl -w

package Foo;
use base Parse::RecDescent;

sub print_cat {
	print "Found ", @_[1..$#_], "\n";
}

package main;


$parse = new Parse::RecDescent(<<'EOG');
	input	 :	"cat"
				{ $thisparser->print_cat($item[1]); }
		 |	"dog"
				{ $thisparser->print_cat($item[1]); }
EOG

$parse = bless $parse, "Foo";

$parse->input("cat");
$parse->input("doggone");