Oh, quick question. Will I need to barf the entire file into a single var or is there another way to do this?
Ex:
#!/path_to_perl
use Parse::RecDescent;
$::RD_ERRORS = 1; #Parser dies when it encounters an error
$::RD_WARN = 1; #Enable warnings - warn on unused rules &c.
$::RD_HINT = 1; # Give out hints to help fix problems.
my $grammar = <<'END_OF_GRAMMAR';
# What you said...
start : '(' section(s) ')'
section : '(' id entry(s) ')'
entry : '(' section | keypair ')'
keypair : '(' key value ')'
END_OF_GRAMMAR
my $text;
while (<BRD>)
{
my $new_line = $_;
chomp;
$text = "$text $new_line";
}
my $parser = Parse::RecDescent->new($grammar) or die "Ha Ha, something
+ is wrong with the syntax, good luck finding the issue!\n";
defined $parser->section($text) or die "It helps if there is a section
+ to find...";
I'm just writing, I havent tested anything yet, so I'm sure there are a few issues still in my understanding:)
Starting to read Why won't this basic Parse::RecDescent example work?