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

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

Comments

Projects
None yet
1 participant
@lsf37
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 from %cup should not include %eofclose to [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 Feb 15, 2015

@lsf37

This comment has been minimized.

Show comment
Hide comment
@lsf37

lsf37 Feb 15, 2015

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@lsf37

lsf37 Feb 15, 2015

Member

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

Sounds good.

Member

lsf37 commented Feb 15, 2015

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

Sounds good.

@lsf37

This comment has been minimized.

Show comment
Hide comment
@lsf37

lsf37 Feb 15, 2015

Member

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

  • status: open --> closed
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment