gelex Q
Thomas Beale <thomas-JBqMug/[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
In our gelex/geyacc archetype parser I have a state during which text in
a sub-syntax is consumed. The lexer is in that state when the EOF is
reached. The problem is that when EOF is reached, two things need to be
done:
* set last_token to a meaningful value, and put the text scanned so far
into last_string
* call terminate, which I think sets last_token to 0
But I can't do these both in the same fragment of code.
I tried doing it like this:
<ss><<EOF>> {
-- unread_character(text.item(1)) -- would this work?
last_token := xxxx
last_string := ....
set_start_condition(INITIAL)
}
....various other rules....
<<EOF>> terminate
the problem is that I don't think the final EOF is being reached, and so
the token reading is not terminating properly. I also tried putting a
unread_character(text.item(1)) line (commented above).
The symptom I get is that although the parser does in fact work
properly, it is sending a newline (which I think is probably the last
newline in the parsed file) to the console (i.e. to stdout). I don't
know why that is happening, but in any case, I would like to know the
right way to terminate when you still have work to do by the time you
hit EOF. I had a previous scheme of adding a final line pattern to the
input text and catching that, but it seems clumsy, and forces a copy of
the complete input text.
any ideas?
- thomas beale
--
___________________________________________________________________________________
CTO Ocean Informatics (http://www.OceanInformatics.biz)
Research Fellow, University College London (http://www.chime.ucl.ac.uk)
Chair Architectural Review Board, openEHR (http://www.openEHR.org)
------------------------ Yahoo! Groups Sponsor --------------------~-->
Everything you need is one click away. Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: gobo-eiffel-unsubscribe-B11MqFFcr06IwRZHo2/[email protected]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/gobo-eiffel/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/