Closed PeterMTaylor closed 8 years ago
Oh Cool a parser bug. It seems that the code isn't correctly parsed by the current Grammar. These bugs aren't really commonplace.
Would you mind grabbing and pasting the function or sub that's around line 218? It seems that the parens aren't correctly handled there.
Sure. To respect the source cDataSetSkeleton.xlm (UserfulStuff) where the info comes from, Bruce McPherson (http://ramblings.mcpher.com) below is his function which Rubberduck spat the parse dummy! :relaxed:
Public Function URLEncode( _
StringVal As String, _
Optional SpaceAsPlus As Boolean = False, _
Optional UTF8Encode As Boolean = True _
) As String
Dim StringValCopy As String: StringValCopy = _
IIf(UTF8Encode, UTF16To8(StringVal), StringVal)
' Here is where the error is detected!!!
Dim StringLen As Long: StringLen = Len(StringValCopy)
If StringLen > 0 Then
ReDim Result(StringLen) As String
Dim i As Long, CharCode As Integer
Dim Char As String, Space As String
If SpaceAsPlus Then Space = "+" Else Space = "%20"
For i = 1 To StringLen
Char = Mid$(StringValCopy, i, 1)
CharCode = Asc(Char)
Select Case CharCode
Case 97 To 122, 65 To 90, 48 To 57, 45, 46, 95, 126
Result(i) = Char
Case 32
Result(i) = Space
Case 0 To 15
Result(i) = "%0" & Hex(CharCode)
Case Else
Result(i) = "%" & Hex(CharCode)
End Select
Next i
URLEncode = Join(Result, "")
End If
End Function
Possible duplicate: #861 "Instructions separator breaks parser in specific circumstances"
@PeterMTaylor I just pushed a commit to my fork that successfully handled the above function :smile:
This issue will automatically close when I merge my changes into this repo.
Cool. Thanks for that. Looking forward to re-test this myself when it is released.
G'Day, I found another tricky error from my end. I decided to test Rubberduck with a VBA code that I had obtained from a Bruce McPherson's website http://ramblings.mcpher.com/ cDataSetSkeleton.xlm Excel file to see how it reacts. The trouble is the parser completed reading the project which is fine however found a error message that is WAY WAY long for me to read and could not work out what the complaint is? Shame I could not scroll it side ways/hoping a multi-line breakdown/even stretching the dialogbox wider, WIDER and WIDER! to see what the issue is, here is the snap. Any suggestions as the meaning of this long message for me to do next or has other issues been raised like this that I may need to be aware of using this feature in future? Ta.