[San-Diego-pm] Meeting Next Week

Christopher Hahn christopher.hahn at peregrine.com
Thu Nov 11 23:13:34 CST 2004


I am trying to use Parse::Recdescent on fairly simple data, but am getting
stuck on
capturing an escaped carriage return.

I am not able to make too many assumptions about the structure of the data,
or I would
probably just us a regexp.

Here is a sample snippet:
use strict;
use warnings;

$::RD_ERRORS = 1; # Make sure the parser dies when it encounters an error
$::RD_WARN   = 1; # Enable warnings. This will warn on unused rules &c.
$::RD_HINT   = 1; # Give out hints to help fix problems.

use Parse::RecDescent;

my $grammar = q{

  DiffOutput: <skip:''> StrVal(s) /\Z/

  StrVal: Words | EscCR | EscQt

  Words: /[\w\s\.\,]+/  { print "String!\n"; }
  EscCR: /\\\\n/        { print "Escaped CR!\n"; }
  EscQt: /\\\"/         { print "Escaped QT!\n"; }

my $parser = new Parse::RecDescent($grammar);

  print "\n\nActing on data line\n>>>$_<<<\n\n";
  defined $parser->DiffOutput($_) or print "\n\nBAD DATA!!\n";

This action may be \\ndefaulted to \"always print\" or \"never print\" in
the company record.

The results are:
C:\L10n\Automation>perl RecDescTest3.pl

Acting on data line
>>>This action may be \\ndefaulted to \"always print\" or \"never print\" in
the company record.<<<



In simplifying this example, I removed the printing of what was matched, but
string "This action may be "
is matched by the Words rule, and then it cruds out.

If anyone can give me the kick in the head that something this simple must
be, then please
heave ho.  No problem either way....I will fall back on a few assumptions
about the data and
a regexp.

I hope to see you at the meeting,


-----Original Message-----
From: Christopher Hahn 
Sent: Thursday, November 11, 2004 12:06 PM
To: Perl Mongers
Subject: RE: [San-Diego-pm] Meeting Next Week

BTW: is anyone on the list well acquainted with Parse::RecDescent grammars?

-----Original Message-----
From: Bob Kleemann [mailto:rkleeman at energoncube.net]
Sent: Thursday, November 11, 2004 11:24 AM
To: Perl Mongers
Subject: [San-Diego-pm] Meeting Next Week

Hey Folks,

Just a reminder that there's a meeting on Tuesday, 7PM at Callahan's.
I'll send out a reminder early next week.  Think about any Perl related
issues you may have and we can discuss them at the meeting.

Between now and then though we should discuss possibly moving the meeting
time.  Some members had mentioned conflicts with other meetings/activities,
so I'm asking everyone when might be a better time to meet?  Let me know
your thoughts.

Also, would anyone be up for skipping the normal meeting next month and
doing something more fun?  If you have ideas, please send them my way.
San-Diego-pm mailing list
San-Diego-pm at mail.pm.org

More information about the San-Diego-pm mailing list