Problems parsing with Parse::RecDescent

Colin Kuskie ckuskie at dalsemi.com
Tue Jul 9 18:35:34 CDT 2002


On Tue, Jul 09, 2002 at 03:42:38PM -0700, Randal L. Schwartz wrote:
> >>>>> "Colin" == Colin Kuskie <ckuskie at dalsemi.com> writes:
> 
> Colin> I'm having problems trying to grok Parse::RecDescent.
> 
> I didn't see anything immediately obvious in your grammar,
> but I'd try turning on tracing, and also posting to the P::RD
> mailing list (see lists.perl.org).

$RD_TRACE redefines verbosity, and it also shows the problem.  I
kept playing with the grammar while waiting for the perl.org
autoresponder.

Here's the gist of it:

<skip: ...> tells the parser what characters to skip _before_ tokens,
not after them.

Just before the subckt subrule is tried, here's what in the "stack":

"\nXP2 VDD VOUT PBBAS IOUT
PCH4_D6W_1 \nXP2a VDD VOUT
PBBAS IOUT PCH4_D6W_1
M=1.0\nXP1 VDD IOUT N2 VDD
PCH4_D6W_1 M=1.0\nXP0 VDD N2
N2 VDD PCH4_D6W_1 M=1.0\nXQ4
IINP N2 IT2 AGND
NPN8P0_D6W_G1 M=5.0\nXQ3 IREF
IOUT IT2 AGND NPN8P0_D6W_G1
M=5.0\nXQ2 IT1 IT1 IREF AGND
NPN8P0_D6W_G1 M=5.0\nXQ1 IT1
IT1 IINP AGND NPN8P0_D6W_G1
M=5.0\n"

Note that leading "\n", which is the newline left over from the last
comment line.  The skip in the subckt production says to make "\n"
significant, and since it doesn't match /x/i, the subckt subrule
fails.

Now I just need to keep chopping away.  Even though I took Damian's
class last August when he has at OGI, I'm finding that it taught me how
to tweak the knobs and that I still don't understand how the beast in
the box works.  In other words, I don't know how to tell the parser
how to do it's job right :)

Colin
TIMTOWTDI



More information about the Pdx-pm-list mailing list