Re: Line continuation characters

[email protected]
Newsgroups perl.recdescent
Message-ID <[email protected]>

Here's mine ... it's not as pretty tho!  (BTW, tried to send this from home
originally and never saw it show up on the list - sorry if it's a dup!).

Ken

--------------------------------

use Parse::RecDescent;
use Data::Dumper;

my @lines = << 'EOINST';
// COMMAND ARG1-VALUE,ARG2-VALUE, +
   ARG3-VALUE,ARG4-VALUE, +
   EVEN-MORE-ARGS
// ANOTHERCOMMAND
* and a comment
* or two
EOINST

my $parse = Parse::RecDescent->new(join '', <DATA>) or die "Bad Grammar!";

my $x = $parse->Instructions("@lines") or die "NOT parsable!!\n";
print Dumper($x);

__DATA__
{
    use Data::Dumper;
}
Instructions: line(s) EOF {$item[1]}
line: command {"command = " . Dumper($item{command}) . "\n"}
    | comment {"comment = " . Dumper($item{comment}) . "\n"}
    | <error>
command:
    '//' word /\+?/ word otherArgs(s)
    | '//' word /\+?/ word
    | '//' word
    | <error>
comment: '*' word(s)
otherArgs:  /\+?/ ',' /\+?/ word
word: /[a-z0-9\-]+/i
EOF: /$/ {1}

=====
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.