FAQ
Hi,
I need to parse utf-8 data and want to use P::RD module. Is there option
to switch generated parser code to character data representation instead
of default byte representation?

I need the same behaviour as I get by using 'use utf8;' in my source
code. What is the best and clean solution?

--
best regards
Ing. Roman Vasicek

software developer
+----------------------------------------------------------------------------+
PetaMem s.r.o., Drahobejlova 27/1019, 190 00 Praha 9 - Liben, Czech republic
http://www.petamem.com/

Search Discussions

  • Roman Vasicek at May 21, 2002 at 4:31 pm
  • Your Friend at May 23, 2002 at 8:01 am

    On Tue, May 21, 2002 at 06:27:47PM +0200, Roman Vasicek wrote:
    I need to parse utf-8 data and want to use P::RD module. Is there option
    to switch generated parser code to character data representation instead
    of default byte representation?
    I've picked a copy of P::RD module, add 'use utf8;' to the code generation
    routine and use sed to replace all occurences of 'RecDescent' with
    'RecDescentUtf' to have new module.
    You used what? Sed?? :-))

    --
    best regards,

    Dipl.-Inf. Richard Jelinek

    - PetaMem s.r.o. - Drahobejlova 1019 - Prague - www.petamem.com -
    -= 1658523 Mind Units =-
  • Jonathan Mayer at Oct 29, 2002 at 1:25 am
    I'm seeing the following trace:
    srca |Trying rule: [srca] |
    srca |Trying production: [srcb] |
    srca |Trying subrule: [srcb] |
    srcb |Trying rule: [srcb] |
    Trouble is, srcb is not a production or subrule of srca.

    How do I even begin to debug this?

    Meantime: I'll try to reproduce this error with a subset of my (large)
    grammar.

    Thanks,
    Jonathan.
  • Jonathan Mayer at Oct 29, 2002 at 2:40 am

    On Mon, 28 Oct 2002, Jonathan Mayer wrote:
    Trouble is, srcb is not a production or subrule of srca.
    Never mind. I found the solution. The culprit was this line:

    mux: gpr "=" condition "?" srca : srcb
    ^
    that's the bugger there.
    Ought to be in quotes.

    My bad. Sorry for the distraction.

    Jonathan.
  • Jonathan Mayer at Nov 26, 2002 at 12:18 am
    I'm experimenting with adding <error> style error reporting to my
    Parse::RecDescent grammar.

    My first question is: is there some standard way to overload the
    handler that actually displays the error messages? Alternately, can I
    make P::RD not print the messages to stderr, but instead leave them in
    a buffer than I can poll?

    My second question is: without using <error>, is there some other way
    of finding out how deep P::RD was able to get into my text before it
    failed?

    Thanks bud,
    Jonathan.

    --
    Concrete is heavy; iron is hard -- but the grass will prevail. -- E. Abbey

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprecdescent @
categoriesperl
postedMay 17, '02 at 12:39p
activeNov 26, '02 at 12:18a
posts6
users3
websitemetacpan.org...

People

Translate

site design / logo © 2019 Grokbase