Done, and also received feedback already! Here's the bug report: https://rt.cpan.org/Ticket/Display.html?id=39323
And here's the solution I was seeking, based on demo/demo_errors.pl:
use strict;
use Data::Dumper;
use Parse::RecDescent;
# Simple Lisp S-expressions (as an example)
my $grammar = q#
start: expression(s?)
| { die join("\n", map { $_->[0] } @{ $thisparser->{errors} }
+)."\n" }
expression: /\w+/
| '(' expression(s?) ')'
{ $item[2] }
| <error>
#;
my $p = Parse::RecDescent->new($grammar);
# This will die if there is an error.
print Dumper($p->start('(foo (bar))'));
# Like so:
$p->start('(foo');
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|