[DGD] parse_string() wierdness???

Keith Dunwoody keithdunwoody at yahoo.com
Fri Mar 21 05:36:52 CET 2003


Hi,

First things first: I'm using DGD 1.2.56 under Linux
kernel 2.4.19 (if that matters).

I'm trying to develop a parse_string() grammar.  I'm
expecting the grammar to be very large, so I'm putting
it into another file, which I load at runtime.  At the
top of my file, I defined whitespace as:

whitespace = /[ \r\n\b\t]+/

However, whenever I tried to parse a string which
contained a newline, the parse would fail.  I played
around with this for a while, and eventually found
that if I removed this line, but in my LPC code loaded
the grammar like:

grammar = read_file(NL_PARSE_FILE);
 
  if (grammar == nil) {
    error("Error reading grammar from file " +
NL_PARSE_FILE);
  }

  grammar = "whitespace = /[ \r\n\t\b]+/\n" + grammar;

it works!  It seems that the parse_string() doesn't
convert '\n' etc into newlines.  Is this the correct
behaviour?  It seems somewhat strange to me, since
this is different from just about every other regular
expression package I know of, but if this is the
correct behaviour, I'm willing to work around it.

Thanks,
-- Keith

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list