RE: How to build parser with autostubbing

[email protected] (Yuri Shtil) Thu, 12 Jan 2012 10:01:58 -0800
Newsgroups perl.recdescent
Message-ID <[email protected]>
Well, I found as much myself, tried all I could and it did not work.

-----Original Message-----
From: [email protected] [mailto:[email protected]]=20
Sent: Thursday, January 12, 2012 9:53 AM
To: [email protected]
Subject: Re: How to build parser with autostubbing

Consult the section on '-s' at http://perldoc.perl.org/perlrun.html:

    -s

    enables rudimentary switch parsing for switches on the command line
    after the program name but before any filename arguments (or before
    an argument of --). Any switch found there is removed from @ARGV and
    sets the corresponding variable in the Perl program. The following
    program prints "1" if the program is invoked with a -xyz switch, and
    "abc" if it is invoked with -xyz=3Dabc.
         #!/usr/bin/perl -s
         if ($xyz) { print "$xyz\n" }

    Do note that a switch like --help creates the variable ${-help} ,
    which is not compliant with use strict "refs" . Also, when using
    this option on a script with warnings enabled you may get a lot of
    spurious "used only once" warnings.


So this is probably what you want:

	perl -MParse::RecDescent -s -RD_AUTOSTUB - grammar NewMakepp::Grammar

Untested, you may need to move -s, '-RD_AUTOSTUB  and the '- grammar ...' a=
rguments around to make it work.

On 1/12/2012 9:39 AM, Yuri Shtil wrote:
> The documentation is a little unclear
>
> I use perl -MParse::RecDescent - grammar NewMakepp::Grammar to create a p=
arser module.
>
> What do I do in order to generate stubs for undefined rules?
> How do I pass RD_AUTOSTUB?
>
> ----------------------------------------------------------------------
> ------------- This email message is for the sole use of the intended=20
> recipient(s) and may contain confidential information.  Any=20
> unauthorized review, use, disclosure or distribution is prohibited. =20
> If you are not the intended recipient, please contact the sender by=20
> reply email and destroy all copies of the original message.
> ----------------------------------------------------------------------
> -------------
>