last day (1420 days later) » 

2:31 PM
set x = new Ext
x.examplecall
ParentModule: vbeProcedure
Name: Name
StarLine: 21
EndLine: 29
CountOfLines: 8
ParentModule: vbeProcedure
Name: ParentModule
you have a bug here:
startLine = Me.ParentModule.ProcStartLine(Me.Name, vbext_pk_Proc)
you're assuming the startLine is for a procedure, it blows up when the name is that of a property ;)
 
Ohhhh
 
looks like a job for On Error Resume Next ... {test them all, one of 'em is going to work} ... On Error GoTo 0
 
I didn't test on properties at all. I should have.
 
I didn't have your OraConfig module, so I passed it the vbeProcedure class
and boom!
looks like I'm starting to have some reviewing material here...
 
^^TS
 
2:50 PM
ah-ha!
set x = new Ext
x.examplecall
ParentModule: vbeProcedure
Name: Name
StarLine: 21
EndLine: 29
CountOfLines: 8
---------------------
ParentModule: vbeProcedure
Name: ParentModule
StarLine: 38
EndLine: 46
CountOfLines: 8
---------------------
ParentModule: vbeProcedure
Name: startLine
StarLine: 55
EndLine: 72
CountOfLines: 17
---------------------
ParentModule: vbeProcedure
Name: EndLine
StarLine: 72
EndLine: 80
CountOfLines: 8
---------------------
ParentModule: vbeProcedure
Name: CountOfLines
StarLine: 80
it's counting an empty line before a member's signature.. weird.
...or not: that's where the IDE puts the procedure separator line
it'd be nice to have a .Signature member on vbeProcedure
 
.Signature @Mat'sMug? Sry. On a call.
 
Yeah, instead of .Lines, to have a .Signature and a .Body property
 
3:09 PM
Dim prj As VBProject
Set prj = ActiveWorkbook.VBProject
worked
no need to reference MS Access
 
Ok. I'll just need to make a note in the documentation.
Different call when using Excel. Fun fun.
 
just have exampleCall take a VBProject argument, and poof you've decoupled your code from the Access object model
(takes notes for review)
 
3:24 PM
Public Property Get Signature() As String
    Dim code() As String
    code = Split(Me.ParentModule.Lines(Me.startLine, Me.CountOfLines), vbNewLine)

    Dim i As Long
    For i = 0 To UBound(code)
        If code(i) <> vbNullString And Left(Trim(code(i)), 1) <> "'" Then
            Signature = code(i)
            Exit Property
        End If
    Next

End Property
 
^^TS
Genius @Mat'sMug
 
but I'm sure it's just a technicality, this should work in VB6 too
 
The docs are all from VB6.
 
4:18 PM
ugh. stupid vb:
2
Public Property Get MemberType() As MemberType
^^ doesn't work
@ckuhn203
set x = new Ext
x.examplecall
ParentModule: vbeProcedure
Name: Name
StarLine: 35
EndLine: 43
CountOfLines: 8
Accessibility: Public
Member Type: Property (Get)
Signature: Property Get Name() As String
Body:
    If isNameSet Then
        Name = mName
    Else
        RaiseObjectNotIntializedError
    End If
I'm having so much fun with your code!
@ckuhn203 I can now use it to inspect code that have Public Function's or property getters that return a Variant!
(just by parsing the member's signature)
 
Hmmm I can up the ante on that. The property type can be parsed from the signature you've created.
That's really cool @Mat'sMug. I'm excited to go back to work on it.
 
@ckuhn203 I'm returning an enum type, not a string - so the "Property (Get)" is a string representation of the result :)
now I just need to clean it up (and perhaps make those methods instead of properties):
Public Property Get ModuleMemberType() As MemberType
    Dim result As MemberType
    Dim code() As String
    code = Split(Trim(Signature), " ")

    Dim modifier As String
    modifier = code(0)

    Dim mType As String, mPropType As String
    If modifier = "Property" Or modifier = "Function" Or modifier = "Sub" Then
        mType = modifier
        mPropType = code(1)
    Else
        mType = code(1)
        mPropType = code(2)
    End If

    Select Case mType
        Case "Property"

            If mPropType = "Get" Then
the idea is to avoid magic strings in the code that would consume that API
'access modifier "Public" intentionally not specified
Property Get Accessibility() As MemberAccessibility
    Dim code() As String
    code() = Split(Trim(Signature), " ")

    Dim modifier As String
    modifier = code(0)

    If modifier = "Property" Or modifier = "Function" Or modifier = "Sub" Then modifier = "Public"

    Select Case modifier
        Case "Public"
            Accessibility = ma_Public
        Case "Private"
            Accessibility = ma_Private
        Case "Friend"
            Accessibility = ma_Friend
@ckuhn203 perhaps we should create a new chatroom to discuss that code...
46 messages moved from The 2nd Monitor
 
4:43 PM
@Mat'sMug you're some kind of genius man.
 
lol nah
@rolfl is some kind of genius, I don't even get to his heels! (don't tell him that)
2
 
Well, I've never seen such wizardry in VBA brother. It's smart.
 
VBE is the wizardry - the rest is nothing but string parsing :)
@ckuhn203 thanks anyway, I'll take it!
 
I might take a look at tying the ModuleMemberType back to the built in constants when I have a chance.
I'm excited.
 
my next step is to count the number of nested If blocks... but I should stop here and start reviewing I guess!
 
4:49 PM
Lol. We'll implement and improve it later. I think you get full partner status on this one.
 
I like meta-programming. Step one: create a IfBlock class :)
 
Step 1b: create an error handler class.
Once the groundwork's laid, an analysis layer could be built that dumbs a text file out.
 
ideally all language structures would have a corresponding class.. FTW!
hi @rolfl!
 
hehehe
 
:)
 
4:57 PM
Yes.
 
@rolfl is this what's called a "lexer"?
 
lexer, parsing, and tokenizing all fall in to one 'box' for me.
 
Any interest in starting a project @Mat'sMug?
 
@ckuhn203 this is definitely an interesting project.. but I think it would be better to do it in C# :)
make a COM-visible library that grabs the file instead of just what the VBE library lets us see - i.e. be able to pick up procedure attributes, too
 
You're wrong, by the way.... about the genius thing , and I look at that VBA code and don't follow it.
But, there are lots of things I am OK with not understanding...
And, I am out of here... I was just curious about the 46 messages moved.
 
5:01 PM
allright then!
 
You're probably right, but I don't know if you want to get involved in that kind of project with someone who's just starting to learn C#
 
that would be a huge learning opportunity!
I came to C# from VBA, too :)
 
No doubt it would be.
Oh man, this has potential.
 
yup
 
Public Subs with no handlers, Implicitly public declarations....
It wouldn't be too hard to find atrocious if blocks.
Hell, I already know how to find variable declarations that aren't dim'ed.
Option Explicit.
Sorry, word vomiting so it's on paper somewhere.
 
5:06 PM
there's an option to force the IDE to include Option Explicit in every module
hold on...
 
I already do, but to analyize code for improvements.
Let's just say a lot of people I work with don't turn that on.
So, I know the benefit of having it on.
 
hey @Malachi!
with tiny little tweaks the tool could also analyze !
once we're able to detect dead/unreachable code, job's done :)
 
hey.
 
thank God VB6 is single-threaded!
 
5:38 PM
wait what are you guys doing here?
 
Or rather, improving the Extensibility Library so we can.
@Mat'sMug did you ever think you'd utter those words?
 
sounds like fun I think
 
I'm having a blast. I think he talked me into trying my hand at a c# com add-in.
 
Not a COM add-in, just a COM-visible dll ;)
2
Hmm the VBA interfacing is going to be fun.. the modules aren't files unless they're exported...
@ckuhn203 nope
 
5:56 PM
Nope what @Mat'sMug?
 
(hover the message, it's linking to the replied-to post ;)
 
6:47 PM
That's cool. Thanks.
 
review is coming along pretty well :)
 
Cool. I think I'm going to go take a look at that access post finally.
 
7:29 PM
There's a LET in there?.... what was I smoking?
 
the documentation!
 
8:02 PM
Unused variable declarations. Adding that to the list.
 

  last day (1420 days later) »