Re: Line continuation characters
[email protected] (Ken LaCrosse)
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
And here's mine, although it's not near as pretty as
Damian's :-).
Ken (usually at Cardinal, but dreamt about a way to
make this work and had to do it from home)
-----------------------------------
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}
----------------------------------------
=====
-------------------------
Ken LaCrosse
[email protected]
[email protected]
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com