This queue is for tickets about the Regexp-Grammars CPAN distribution.

Report information
The Basics
Id:
69249
Status:
open
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
XLAT [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: better/prettier error handling
Date: Sat, 2 Jul 2011 20:44:01 +0200
To: bug-regexp-grammars@rt.cpan.org
From: "Nicolas GEORGES (CPAN)" <xlat@cpan.org>
For exemple, when running the following:

Show quoted text
C:\perl510\geni\Regexp-Grammars-1.013\demo>perl demo_error.pl
1+2-5x5
Extra junk after expression at index 1: '+2-5x5'
Expected end of input, but found '+2-5x5' instead
Expected valid input, but found '+2-5x5' instead
Expected literal, but found '1+2-5x5' instead
Expected valid arithmetic expression, but found '1+2-5x5' instead

I would like to produce a message like :

Show quoted text
Extra junk after expression at index 5: 'x5'
or
Show quoted text
1+2-5x5
.....^__ Expected valid arithmetic expression

May be I miss something like <commit> that is available in Parse::RecDescent ?
In which case I could insert it at the right place in the grammar.

TIA,
Nicolas.
Subject: Re: [rt.cpan.org #69249] better/prettier error handling
Date: Mon, 4 Jul 2011 09:36:46 +1000
To: bug-Regexp-Grammars@rt.cpan.org
From: Damian Conway <damian@conway.org>
Hi Nicolas, You asked:
Show quoted text
> May be I miss something like <commit> that is available in Parse::RecDescent? > In which case I could insert it at the right place in the grammar.
That's exactly right. Regexp::Grammars doesn't provide a <commit>, because it doesn't need to: Perl itself does (in 5.10 and later, at least). You should get the behaviour you want by changing the lines: \A <Answer> to \A <Answer> (*COMMIT) You can read about (*COMMIT) in the perlre manpage. All the best, Damian


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.