Closed daFreeMan closed 9 years ago
Turns out Dim
is illegal outside a procedure scope, that code doesn't compile - RD assumes your code compiles... what happens if you replace Dim
with Private
?
this is a bug report, not a code review!
Turns out Dim is illegal outside a procedure scope, that code doesn't compile - RD assumes your code compiles... what happens if you replace Dim with Private?
Looks like it is... =;)-
Odd, the only compile error I got was here:
If InStr(1, Dest, "dev") > 0 Then
Action = MsgBox("About to OVER WRITE the Dev copy with this one." & vbCrLf & "Click 'Cancel' to prevent this and save manually", vbOKCancel, "OVER WRITE WARNING!!")
Else
Action = MsgBox("About to OVER WRITE the PRODUCTION copy with this one." & vbCrLf & "Click 'Cancel' to prevent this and save manually", vbOKCancel, "OVER WRITE WARNING!!")
End If
End If
If you can imagine, one IF
with two End If
s doesn't work well.
Running Office 2010, I don't get a compile error with that global Dim
. However, changing the Dim
to Private
unbreaks the parser.
Actually, Dim
at the module level seems to be totally legit @retailcoder.
Option Explicit
Dim PPTObj As New Collection
Running Office 2010, I don't get a compile error with that global Dim. However, changing the Dim to Private unbreaks the parser.
Houston, we have a problem.
Ok, I'm lost here.
@retailcoder - Try it in PowerPoint instead of Excel.
Wouldn't think it should matter, but...
Ok so I copied the code into a new module, and get this parser log:
2015-05-18 09:36:39.2320 ERROR Parser encountered a syntax error in VBAProject.Module1, line 87. Content: ' End If'
Rubberduck.Parsing.Symbols.SyntaxErrorException: extraneous input 'End If' expecting {END_SUB, NEWLINE} at Rubberduck.Parsing.Symbols.ExceptionErrorListener.SyntaxError(IRecognizer recognizer, IToken offendingSymbol, Int32 line, Int32 charPositionInLine, String msg, RecognitionException e) in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\Symbols\ExceptionErrorListener.cs:line 10 at Antlr4.Runtime.ProxyErrorListener`1.SyntaxError(IRecognizer recognizer, Symbol offendingSymbol, Int32 line, Int32 charPositionInLine, String msg, RecognitionException e) at Antlr4.Runtime.Parser.NotifyErrorListeners(IToken offendingToken, String msg, RecognitionException e) at Antlr4.Runtime.DefaultErrorStrategy.Sync(Parser recognizer) at Rubberduck.Parsing.Grammar.VBAParser.subStmt() in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 9249 at Rubberduck.Parsing.Grammar.VBAParser.moduleBodyElement() in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1287 at Rubberduck.Parsing.Grammar.VBAParser.moduleBody() in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1172 at Rubberduck.Parsing.Grammar.VBAParser.module() in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 409 at Rubberduck.Parsing.Grammar.VBAParser.startRule() in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 218 at Rubberduck.Parsing.VBA.RubberduckParser.Parse(String code, TokenStreamRewriter& outRewriter) in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\VBA\RubberduckParser.cs:line 82 at Rubberduck.Parsing.VBA.RubberduckParser.Parse(VBComponent component) in c:\Users\Mathieu\Source\Repos\Rubberduck\Rubberduck.Parsing\VBA\RubberduckParser.cs:line 101
Ok I played with your code a bit, and it all boils down to this extraneous End If
in the above parser log. Once I removed that extra End If
I could parse without problems:
Problem in chair, not in duck
-- Houston
:wink:
The following code, in a standard module in a PowerPoint presentation, seems to break the parser, yet produces no visible error messages. I don't have a debug version running, so I don't get a parse log.
And no, I don't recall why I declare
PPTObj As New Class1
- this is a bug report, not a code review!