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 bug #1022

Closed
sshikov opened this issue Feb 3, 2016 · 13 comments
Closed

Parser bug #1022

sshikov opened this issue Feb 3, 2016 · 13 comments
Assignees
Labels
bug Identifies work items for known bugs parse-tree-processing
Milestone

Comments

@sshikov
Copy link

sshikov commented Feb 3, 2016

When trying to open Code Explorer, I'm getting error message instead:

VBAProject.VBE(51,9): extraneous input 'For' expecting NEWLINE.

Here is line 51 (last one):

    Dim mn:  mn = 0
    For Each VBComp In VBProj.VBComponents
@Vogel612
Copy link
Member

Vogel612 commented Feb 3, 2016

Seems to be the same issue as #900 and #861 . I assume this has been fixed on the current next but it might be worthwhile to look into this.

Thanks for reporting :)

@sshikov
Copy link
Author

sshikov commented Feb 3, 2016

Yea, looks like its the same as #861. I have Open statements right before this.

Should I attach sample code here?

@Hosch250 Hosch250 added bug Identifies work items for known bugs parse-tree-processing labels Feb 4, 2016
@Hosch250 Hosch250 added this to the Version 2.0 milestone Feb 4, 2016
@retailcoder
Copy link
Member

The colon is tripping the parser here:

Dim mn:  mn = 0

This would fix it:

Dim mn
mn = 0

Annoying, I know. The good news is that it's fixed in the current parser, so next release will see a fix for this bug. Closing as a duplicate of #861.

@retailcoder retailcoder added the duplicate Thanks for the feedback! We're already tracking this report/request at the linked issue. label Feb 6, 2016
@sshikov
Copy link
Author

sshikov commented Feb 12, 2016

In my case, for 1.4.3.27555 version

    Dim mn As Integer
    mn = 0

    For Each VBComp In VBProj.VBComponents

Doesn't help. I have no colons now before line in error.

So, may be this is yet another issue.

@ThunderFrame
Copy link
Member

@sshikov 1.4.3 is not receiving updates or parser fixes. If you want to benefit from the latest fixes and features (and bugs), then you'll need to build from the GitHub source.

@sshikov
Copy link
Author

sshikov commented Feb 12, 2016

Does it matter in this case? I mean that proposed fix (to remove colon) doesn't help.

So, I'm not yet sure that fix for #861 is relevant in this case. Another bug may exists in 1.4.3.27555, and this issue is not duplicate for #861.

@retailcoder
Copy link
Member

@sshikov we've knocked down the last known grammar issue just yesterday, if you can post more sample code, would be great we could confirm it fixed for 2.0 :-)

@retailcoder
Copy link
Member

I mean, I have no repro on 1.4.3 with this code:

Sub DoSomething()
    Dim mn As Integer
    mn = 0

    For Each VBComp In VBProj.VBComponents
    Next
End Sub

Parses fine; the problem has to be elsewhere.

@sshikov
Copy link
Author

sshikov commented Feb 18, 2016

vbe.txt

Here is vba code with issue.

@ThunderFrame
Copy link
Member

@sshikov It looks like your code has non-ascii characters in your comments. I don't think 1.4 can handle that.

@retailcoder retailcoder removed the duplicate Thanks for the feedback! We're already tracking this report/request at the linked issue. label Feb 18, 2016
@retailcoder
Copy link
Member

@ThunderFrame the comments don't get to the parser, and IIRC the lexer rule for comments doesn't care whether they're ASCII characters or not.

Anyway, I can't get the module to parse with v1.4.3, even after getting the code to compile, adding an early-bound reference to the Scripting library, changing all one-line declaration+assignment into two-liners, and removing all comments.

It's complaining about extraneous input 'With', and if I remove it, it complains about the Do block, which makes no sense. I'm removing the [duplicate] label here, something else is going on.

I'm saving that workbook into my dropbox and will let the 2.0 parser have a shot at it tonight.

2.0 can't release if it can't parse this code - yet I'm confident we've already fixed whatever the problem is. I'll update tonight.

@retailcoder retailcoder self-assigned this Feb 18, 2016
@retailcoder retailcoder reopened this Feb 18, 2016
@retailcoder
Copy link
Member

Okay... so I pasted the module into my VBE, as-is.

The non-ASCII comments turned into gibberish like this:

' ïîñòðîåí ñïèñîê âñåõ ïðîöåäóð (â âèäå module-> dictionary), ïîïðîáóåì ïîñòðîèòü xref

But the parser didn't blow up, and everything works. In other words: I'm confirming that next release will handle your code without any issues! 😃

@sshikov
Copy link
Author

sshikov commented Feb 20, 2016

I can confirm that everything works fine when build from next branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs parse-tree-processing
Projects
None yet
Development

No branches or pull requests

5 participants