On Wed, Jun 25, 2003 at 06:46:03PM +0100, Orton, Yves wrote:
> > > $Parse::RecDescent::skip=qr/(?:\s*#.*\n|\s*[\\]\s*\n|\s*)*/;
> >
> > I tried the character class too, with no luck :(
>
> Of course. the double interpolation leaves it as
>
> /[\].../
>
> which is a bad regex.
. . .
> Well it is getting double interpreted. First in the qr// then later in the
> eval when that qr is strignified.
Yeah, and that causes nasty errors. I don't think there should be
double interpolation though.
> Well heres the \r? version commented:
>
> $Parse::RecDescent::skip=qr/
> \s* # match optional leading spaces
> (?: # followed by 0 or more of one
> of
> (?<![\\\\]) # not preceded by a
> backslash
> \# # a comment symbol
> .* # followed by 0 or more non
> newlines
> \n # followed by a newline
> | # or
> [\\\\] # backslash
> \r? # optional carriage return
> for win32 types
> \n # newline
> )* # zero or more times.
> /x;
Cool, time to work that into the grammar.
> End result, it never even got to backup_line to match the yellow against the
> yellow!
I think I've been looking at this for so long I'm actually seeing it any
more.
> Gah, Ill grant you that an alternate strategy may be better, but in this
> case you are misunderstanding the grammar you are parsing and thus are
> banging your head against an essentially non-existant wall. (Yeah i hate it
> when people say that to me too :-)
Well, it's producing the "right" error messages now. I think I'll just
quietly leave it alone for a while and put a big warning in there not to
touch it ;)
> Uhuh. In fact, my tendency is to use {1} as the autoaction and to explicitly
> provide the others. I find that usually matches my thinking better.
Two thirds of my rules all have the same action:
{ $options{$where}{$item [1]} = $item [3]; }
so it makes sense (to me at least) to use an autoaction.
> Especially as I tend to return things in what seems to be strange ways (try
> returning undef as a matched value in the tree, its frigging nightmare. my
> best solution was to create a special object and then use isa tests. Blech.
> There needs to be a way to return a false value from a code block in a rule
> but have the rule be considered to be a match.)
Ah, that sounds tricky all right.
> :-)
>
> Once you stop wanting to murder me for the above comments please let me know
> how it worked out.
So far so good; it's parsing correctly, planning the backups correctly,
now I need to add the report generation, write an accurate config file
(I'll probably find a couple more bugs in my grammar), and start
testing. Should be finished soon, says he foolishly.
> Also do you Perlmonks.org at all? Good resource site if you want to have
> more points of view.
A little, but I figured here was the best place to get P::RD advice.
Thanks again for your help,
--
John Tobin
[Parrot] will have reflection, introspection, and Deep Meditative
Capabilities.
Dan Sugalski, 2002/07/11, [EMAIL PROTECTED]