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

Fully support DISPLAY statement #488

Merged
merged 11 commits into from
Aug 1, 2024

Conversation

Claes65
Copy link
Contributor

@Claes65 Claes65 commented Jun 26, 2024

No description provided.

@MarkusAmshove MarkusAmshove added the natparse🔎 Parser and project structure label Jun 27, 2024
@Claes65
Copy link
Contributor Author

Claes65 commented Jun 27, 2024

I welcome you to pull my branch and make the changes you want- I am sure it won’t take you more than 5 minutes, and then I can have my aha moments ;)

@MarkusAmshove
Copy link
Owner

I did the changes in your branch.

Previously, you had the OutputStatementNode class implement different statement interfaces (IWriteNode, IDisplayNode).

That would lead to the following confusion/bug:

If you write an analyzer for WRITE statements - lets pretend you want to do a "Don't use WRITE, use DISPLAY instead" diagnostic - then you will register the analyzer to analyze IWriteNodes.
The problem you'd have then, is that the statements that you get might not only be WRITE statements, but also DISPLAY statements, because OutputStatementNode implements both and is constructed for both.

With my change we have some empty classes and interfaces, which is strange and maybe not nice but accomplishes the distinction.
Now only WriteNode implements IWriteNode and only DisplayNode implements IDisplayNode. Their implementation is identical (empty classes in this case, because they both extend OutputStatementNode), but the distinction is important :-)

@MarkusAmshove MarkusAmshove self-requested a review June 29, 2024 07:51
@MarkusAmshove MarkusAmshove removed their request for review June 29, 2024 08:03
@Claes65
Copy link
Contributor Author

Claes65 commented Jul 2, 2024

@MarkusAmshove - looks great, so trick was to replace extends IStatementNode with IOutputStatementNode :)

I've now installed Java 21, and made a comparison. I get some new diagnostics: Need to support the DISPLAY options VERT and HORIZ. Should I implement this in consumeInputOutputOperand similar to TAB_SETTING etc? Or is there a better way? Really, we just don't want them to be seen as Identifiers, because they are reported as "Unknown reference".
edit: I have resolved this in latest commit, I hope.

Also I see a lot of Maps with Unterminated String literal, expecting closing [""]"

@Claes65
Copy link
Contributor Author

Claes65 commented Jul 25, 2024

@MarkusAmshove did you test this yet?

@MarkusAmshove
Copy link
Owner

I pushed the changes but didn't test anything further, because the PR is still flagged as WIP :)

@MarkusAmshove
Copy link
Owner

VERT AS works now :)

Copy link

sonarcloud bot commented Aug 1, 2024

@Claes65 Claes65 marked this pull request as ready for review August 1, 2024 11:36
@MarkusAmshove MarkusAmshove added this to the v0.14 milestone Aug 1, 2024
@MarkusAmshove MarkusAmshove merged commit 9debe20 into MarkusAmshove:main Aug 1, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
natparse🔎 Parser and project structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants