Lexer bug? (was Re: [Prothon-user] Re: Prothon bug)

Joe Knapka <[email protected]> 01 May 2004 21:50:54 -0600
Newsgroups gmane.comp.lang.prothon.devel
Message-ID <[email protected]>
"Mark Hahn" <[email protected]> writes:

> Joe Knapka wrote:
> 
> > I was under the impression Prothon strings were to be totally
> > generic counted strings, not null-terminated C strings.
> 
> Yes, Prothon strings should be able to hold nulls as Python strings do.  The
> String object has a length field.  It also always has a null after the
> string data for internal convenience and debugging.
> 
> >>>> "\000abc".len()
> > 0
> 
> That is definitely a bug.

The bug appears to be in prothon.y and parser_routines.c. When we
consume a quoted string in the input stream, we expand escape
sequences (possibly inserting nulls), then strcpy() the result
(sometimes, anyway). We also take the strlen() of the string value in
str_to_obj() in parser_routines.c.  We need to pass the string length
up out of the lexer somehow, but I don't know bison well enough to fix
this. In my current copy of prothon.y, the evil stuff is about line
996 or so, and line 1377 in parser_routines.c.

-- Joe

-- 
Resist the feed.
--
If you really want to get my attention, send mail to
jknapka .at. kneuro .dot. net.