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

Parser balks at long tokens (regression) #734

Open
opeongo opened this issue Mar 22, 2023 · 7 comments
Open

Parser balks at long tokens (regression) #734

opeongo opened this issue Mar 22, 2023 · 7 comments

Comments

@opeongo
Copy link
Contributor

opeongo commented Mar 22, 2023

The javacc parser (or more specifically the JavaCharStream class) has changed since bsh-2.0b5 and it appears that it can no longer handle arbitrarily sized input tokens. Previously the JavaCharStream implementation had working code that would expand the internal buffer as required, thus supporting arbitrarily sized tokens found in the input stream. It appears that in the switch from JavaCC to ParserGeneratorCC this capability no longer works. There is code in the class to increase the size of the internal buffer, however here is an example of a long string assignment that the current parser cannot handle:
parser1.bsh.txt

@opeongo
Copy link
Contributor Author

opeongo commented Mar 22, 2023

I found a fix for this problem. If consists of commenting out two lines in the AbstractCharStream class. See my comments on the ParserGeneratorCC site about this.

These changes can be made to the template in the upstream ParserGeneratorCC project, or they can be made to the generated AbstractCharStream.java file that shows up in the targets/generated-sources/javacc/bsh folder . I just do not know how to make these changes so that they persist. Right now any changes will get clobbered if javacc is rerun.

@nickl-
Copy link
Member

nickl- commented Apr 1, 2023

I wonder if that wasn't a patch in the original javacc that beanshell was using. This is a difficult one, lets hope they fix it upstream.

@revusky
Copy link

revusky commented Apr 2, 2023

Nick, it's really pretty safe to say that none of these things will ever be "fixed upstream". Well, not unless you finally pick up the ball and move over to the actively developed/maintained branch of development, which is CongoCC.

And you should really do that sooner rather than later, because it's the same amount of work to do it now as later, and you get the benefits of the transition sooner. Are your collaborators aware of this branch?

@revusky

This comment was marked as off-topic.

@nickl-

This comment was marked as off-topic.

@revusky

This comment was marked as off-topic.

@nickl-

This comment was marked as off-topic.

opeongo pushed a commit that referenced this issue Jan 4, 2024
- patch generated sources to fix upstream bug
- add test
This patch is temporary until upstream updates to a correct version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants