uwol/proleap-vb6-parser

About the many issues fixed in Rubberduck's fork

retailcoder opened this issue · 1 comments

FYI - Rubberduck PR 4068 fixed an interesting edge case that I don't think this version of the grammar handles. Consider this legal VBA/VB6 code:

For x = 1 To 10
For Each c In Items
For y = 1 To 10
'....
Next y, c, x

A number of special-form VB6-specific syntaxes were also added; VB6 MSForms are now handled too, and so many other things now diverge rather significantly between this version and Rubberduck's.

Many, many commits were made to Rubberduck's grammar since 2016, so much that I'm struggling to figure out a way to contribute the grammar file back - the lexer grammar was separated from the parser grammar, for one; another thing is that the grammar now includes a Rubberduck-specific '@Annotation argument-capable comment syntax that I believe shouldn't be in a VBA/VB6 grammar outside of Rubberduck; precompiler rules were pulled into their own grammar, as Rubberduck only provides the parser with the "live" code (precompiler directives are literally interpreted to achieve that); more specialized expression grammars (e.g. Like syntax) have spawned, too.

Line numbers & labels, line continuations, superfluous parentheses at call sites, and various other things, are among the issues likely still present in this version, fixed in Rubberduck's current/latest grammar.

I would want to bring all (most?) these fixes into here, but it would very very very likely be a complete wreck of a breaking change for anyone using it. OTOH, the Rubberduck fork correctly parses quite a lot of things (including lots of edge cases) that the original grammar didn't... but re-implementing all these changes in this version would be rather daunting. Not sure how similar this version is to the original version we forked all the way back in 2014 (2015?).

What would you recommend? Is status-quo ok?

I also just noticed that this repo is under MIT and not GPLv3 like the original grammar we used back then... not sure what that entails, Rubberduck is GPLv3.

uwol commented

Hi Mathieu,

first of all, sorry for the delay! Great to see the the work you put into Rubberduck and the grammar.

I think grammar versions have diverged too much to merge automatically and simply copying commits from Rubberduck would break most of the Java ASG code in this repo. Merging from GPL to MIT would be a problem anyway.

However, in the past I already took a look from time to time at the Rubberduck grammar and re-implemented most relevant fixes manually. So, I suppose, the best approach would be to continue with this, hoping that things settle. At least VB6 does not change anymore :-)

Best regards and keep up the good work!
Ulrich