Skip to content

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

@lsf37

Description

@lsf37

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions