develooper Front page | perl.recdescent | Postings from January 2012

RE: How to build parser with autostubbing

Thread Previous | Thread Next
From:
Yuri Shtil
Date:
January 12, 2012 10:02
Subject:
RE: How to build parser with autostubbing
Message ID:
5F72830DCCB3CC4FBF80CC854C3999F18E9ED87B05@HQMAIL02.nvidia.com
Well, I found as much myself, tried all I could and it did not work.

-----Original Message-----
From: jtbraun@cpan.org [mailto:jtbraun@cpan.org] 
Sent: Thursday, January 12, 2012 9:53 AM
To: recdescent@perl.org
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=abc.
         #!/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 ...' arguments 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 parser 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 
> recipient(s) and may contain confidential information.  Any 
> unauthorized review, use, disclosure or distribution is prohibited.  
> If you are not the intended recipient, please contact the sender by 
> reply email and destroy all copies of the original message.
> ----------------------------------------------------------------------
> -------------
>


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About