Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] %cup should not include %eofclose [sf#61] #63

Closed
lsf37 opened this issue Feb 15, 2015 · 3 comments
Closed

[Bug] %cup should not include %eofclose [sf#61] #63

lsf37 opened this issue Feb 15, 2015 · 3 comments
Labels
bug Not working as intended

Comments

@lsf37
Copy link
Member

lsf37 commented Feb 15, 2015

Reported by ulibube on 2004-03-05 16:38 UTC
The fact that %cup includes %eofclose can cause
trouble, in particular when switching from JLex to
JFlex. When using the %cup directive in JLex, no code
is generated to automatically close the input stream at
EOF. Closing an input stream typically also closes all
associated FilterStreams, etc., so it can have
far-reaching consequences. In my case, my code
mysteriously broke and had NullPointerExceptions in
unexpected places when I switched from JLex, because I
didn't realize that the %cup directive in JFlex behaves
substantially different in this respect from %cup in JLex.

I don't really understand why JFlex's %cup contains
%eofclose in the first place. I have not seen any
particular requirement from CUP to do so.

A related problem with this is that there is no
%noeofclose directive to undo the implicit effect of
%cup. So if I want to use CUP without automatic stream
closing (which I find perfectly ok) I cannot use %cup.

@lsf37 lsf37 changed the title %cup should not include %eofclose [Bug] %cup should not include %eofclose [sf#61] Feb 15, 2015
@lsf37 lsf37 added this to the jlex incompatibility milestone Feb 15, 2015
@lsf37 lsf37 closed this as completed Feb 15, 2015
@lsf37
Copy link
Member Author

lsf37 commented Feb 15, 2015

Commented by lsf37 on 2004-03-08 08:20 UTC
Logged In: YES
user_id=93534

You are right, this is a problem. An additional problem is
that I can't just change the %cup behaviour now without
breaking existing programs.

This is what I plan to do: The 1.4pre versions of JFlex
have a command line switch --jlex which is there to go
fully compatible with JLex. In this mode, %cup will do
exactly what it does now in JLex. In the 'normal' mode
(without anything) it will stay as it is. Additionally,
I'll introduce something like %noneofclose (not sure yet
about the exact syntax, maybe %eofclose false or
something).

Would that solve your problem?

Cheers,
Gerwin

@lsf37
Copy link
Member Author

lsf37 commented Feb 15, 2015

Commented by ulibube on 2004-03-08 16:00 UTC
Logged In: YES
user_id=763551

Sounds good.

@lsf37
Copy link
Member Author

lsf37 commented Feb 15, 2015

Updated by lsf37 on 2004-04-12 12:26 UTC

  • status: open --> closed

@lsf37 lsf37 removed this from the jlex incompatibility milestone Feb 17, 2015
@regisd regisd added the bug Not working as intended label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants