On 2/14/07, Joel C. Salomon <[EMAIL PROTECTED]> wrote:
> For this case anyway, where I know that the Rune read was a
> single-byte character, is it safe to use Bungetc, and will that allow
> me to back-up more than once?  I need (I think) three bytes of
> back-up.

I've tried it, and (on a small test case) nothing broke; 'long' is
recognized as the keyword rather than the identifier 'ong'.  I just
would like some reasurrance from someone who knows the bio code
better.

I've gone through the code again; the only places I have multiple
back-up are places where I know that the characters to be unread are
single-byte UTF sequences, so I use Bungetc.  Other back-ups are
single Rune of unknown UTF length, to be reread as part of the next
token, so I can (and must!) use Bungetrune.

What started as a simple design is now hopelessly tangled.  Next time I use lex.

Also, after Beof is read, does Bunget* have any meaning?

Apparently, yes: to unget the last (pre-Beof) character read.  A few
rides through an infinite loop cleared that up.

--Joel

Reply via email to