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

Modify grammar to get comments into the parse tree #167

Closed
retailcoder opened this issue Feb 8, 2015 · 3 comments
Closed

Modify grammar to get comments into the parse tree #167

retailcoder opened this issue Feb 8, 2015 · 3 comments
Labels
antlr Issue is easier to resolve with knowledge of Antlr4 enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. status-declined This will not be implemented.

Comments

@retailcoder
Copy link
Member

Related: #163 (rename grammar rules to follow C# naming conventions); closing this issue should also close #166.

@retailcoder retailcoder added the enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. label Feb 8, 2015
@retailcoder retailcoder added this to the VBA Parser milestone Feb 8, 2015
@rubberduck203
Copy link
Member

I'll take a look at this. Theoretically, a comment node begins with a comment identifier (an apostrophe or REM) and ends on a newline, unless there is a line continuation.

@retailcoder
Copy link
Member Author

Yes. Grammar knows this... and skips them. I tried a parser that un-skipped
them and didn't get the expected comment nodes.
Trial-and-error is not a fun thing to do here - need a tool to run the
generated parser against some VBA code, before saying "ok that's the one"
and overwriting the files in Rubberduck.

@rubberduck203
Copy link
Member

Yup. Just spotted it. https://github.com/retailcoder/Rubberduck/blob/LexicalTokens/RetailCoder.VBE/VBA/Grammar/VisualBasic6.g4#L876

Comments on their own lines shouldn't be a problem, but I have a feeling that basically all of the other "statements" will need to be modified for situations like this.

If foo Then ` this comment tosses wrenches
    bar
End If

Do you have a VB6 file that you were working with to test the parser? I will probably create a new project to work with this.

@rubberduck203 rubberduck203 added the antlr Issue is easier to resolve with knowledge of Antlr4 label Feb 10, 2015
@retailcoder retailcoder added status-declined This will not be implemented. and removed help wanted labels Feb 10, 2016
retailcoder added a commit that referenced this issue Dec 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
antlr Issue is easier to resolve with knowledge of Antlr4 enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. status-declined This will not be implemented.
Projects
None yet
Development

No branches or pull requests

2 participants