Open SSlinky opened 5 months ago
Thanks! I’ve been trying to follow Microsoft’s lead as much as possible, mainly to ensure that their documentation is valid. This presents a difficult situation though. It seems the only negative integer that is acceptible is ‘-1’. I’ve reported this bug to Microsoft, and they have been quite helpful in clarifying these discrepancies.
The only valid negative integer in an On Error statement. They're perfectly valid elsewhere, like in my example above. When used in an expression, though, you'll see the IDE throw in a space for you. For example. Debug.Print 1-4
will automatically adjust to Debug.Print 1 - 4
.
Parser should interpret
On Error GoTo -1
as valid VBA. I shortcut fixed the problem by simply allowing a negative sign in front of INTEGERLITERAL. Unsure if this has breaking ripple effects and you may wish to update the rule to allow -1 or lineNumberLabel. My use case prefers a more tolerant parser though.Example ripple effect, the literalExpression would normally be split into a MINUS and INTEGERLITERAL. The result is essentially the same in this case.