RE: Very odd parsing problem
[email protected] ("Orton, Yves") Wed, 17 Dec 2003 13:44:53 -0000
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <71B318898201D311845C0008C75DAD1C0896157E@defra1ex2> |
I cant say if this is the cause of your problem but you are making errors
and using error prone syntax in your method calls.
my $parser = new Parse::RecDescent ($grammar); # not wrong but better
written as
my $parser = Parse::RecDescent->new($grammar);
my $process = Process::new(); # Almost certainly wrong...
my $process = Process->new(); # Probably correct.
Also this syntax (with the &Dump) is not very current and slightly
errorprone( &Foo isnt the same as Foo()). just omit the & symbol.
print &Dump($parsetree), "\n"; # You dont n
But as I said I have no idea if this is the cause of your program. I just
know I would make the suggested changes before I looked elsewhere.
Yves
> -----Original Message-----
> From: Aaron Dalton [mailto:[email protected]]
> Sent: 17 December 2003 13:45
> To: [email protected]
> Subject: Very odd parsing problem
>
>
> I have created a grammar for processing basic rules for a pbem I am
> writing. I have also written an object for then processing
> the resulting
> parse tree. What is happening is this: If I simply parse the
> input and
> dump the tree, everything parses fine. The second I even "use" my
> processing object module (which happens to be called
> "Process") the parse
> fails. I did a TRACE and what seems to happen is the parser doesn't
> ignore the newlines in the 2nd instance. I am totally
> confused. Below is
> the snippet of my code in question. I can include copies of
> the grammar
> andthe TRACE if that would be helpful. Any ideas? Thanks so much for
> your help.
>
>
> #START CODE
> my $parser = new Parse::RecDescent ($grammar);
> my $parsetree = $parser->orderset($bodytxt);
>
> if (! defined $parsetree)
> {die "Grammar parse failed!\n";}
> else
> {
> use YAML;
> print &Dump($parsetree), "\n";
>
> #if I uncomment the below code, the parse fails
> #
> #use Process;
> #my $process = Process::new();
> #$process->processTree($parsetree);
> #print $process->{results}, "\n";
> }
> #END CODE
>
> --
> Aaron Dalton
> [email protected]
> http://aaron.finch.st
>
>