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 fails with runaway group error if the last non-empty code line ends with a line comment #28

Open
codemanyak opened this issue Apr 8, 2024 · 4 comments

Comments

@codemanyak
Copy link

If the parsed source file contains a line comment (provided of course that the used grammar specifies line comments) in the last non-empty code line then the parser fails with error.group_runaway, no matter whether the file ends with a newline or not. Even if hundreds of newlines follow, the parsing will fail.

With end-standing block comments, the behaviour is correct (if the end symbol is missing, i.e., the group is actually unterminated then the error duefully occurs, otherwise it does not).

In the appendix, there is a combination of a Java grammar and a Java file that pass the test in GOLDBuilder but fail in the engine with the error described above.
final_line_comment_failure.zip

codemanyak added a commit to codemanyak/goldengine that referenced this issue Apr 10, 2024
Files ending with line comments should not raise error.group_runaway
codemanyak added a commit to codemanyak/goldengine that referenced this issue Apr 10, 2024
Proposed bugfix ridencww#28 integrated into Structorizer
@codemanyak
Copy link
Author

A successfully tested bugfix proposal is available in pull request #29.

@ridencww
Copy link
Owner

Thank you for not only identifying an issue, but also supplying the fix. My time this week is limited, but early next week I will write a failing unit test, merge your PR, generate a new release, and upload it to Maven Central. I am glad to see others continue to use the Java engine and Devin's Builder, which is a good educational tool.

codemanyak added a commit to codemanyak/goldengine that referenced this issue Apr 15, 2024
Improved version of bugfix ridencww#28 (preserving the cut-off ultimate comment)
codemanyak added a commit to codemanyak/goldengine that referenced this issue Apr 15, 2024
@codemanyak
Copy link
Author

codemanyak commented Apr 18, 2024

Revised the proposed fix. The first version had suppressed the comment token and yielded the EOF, the new one does it the other way round, which seemed more sensible, in particular with respect to issue #18).

@ridencww
Copy link
Owner

A quick update. last week I pulled the project down, updated the build file, and created a failing unit test. I ran out of time due to work constraints, but am picking this up again this week and making the actual code change. Will alert you when I've committed everything to the develop branch so you can have a look at it.

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

2 participants