« first day (163 days earlier)      last day (3017 days later) » 

3:29 PM
ah, it works!
        [TestMethod]
        public void TestMultipleDeclarations()
        {
            var parser = new Parser();
            const string code = "Dim foo, bar As String\n";

            var result = parser.Parse("ParserTests", "Rubberduck.Parser", code);

            var declaration = result.ChildNodes.FirstOrDefault() as DeclarationNode;
            Assert.IsNotNull(declaration);

            var identifiers = declaration.ChildNodes.Select(node => node as IdentifierNode).ToList();
            Assert.AreEqual(2, identifiers.Count);
 
4:00 PM
hmm.. Dim foo() As Integer works, Dim foo(1 To 10) As Integer works, but not Dim foo(1 To 10, 1 To 5) As Integer.
 
4:25 PM
ah, it's the comma messing it up
 
 
1 hour later…
5:39 PM
all right, all tests pass. I'm not picking up a constant's value, but I do pick up its identifier.. regardless of how it's declared
 
=) Back to it I see. Busy today, but I'll be back to it tomorrow.
 
:)
 
I'm going to put the toolWindow refactor aside for a few days and work on the config stuff.
 
no problem. I'll be pushing my branch when I get the parser to put local variables inside a ProcedureNode
right now it's picking up DeclarationNode and ProcedureNode, but procedures don't "contain" anything at this point.
 
Yeah man. I'm still kinda over that bug. I'm hoping that getting something else done will unwind my mind.
It works as it is, so... eh. I'll figure it out eventually.
 
6:31 PM
@RubberDuck is it normal that the TestExplorer is visible by default? when there was only the TaskList that was dockable, then it was the TaskList window that was visible by default.. it seems the last defined dockable window appears visible by default?
 
7:04 PM
Something could be making the toolWindow visible when it gets created. Wanna submit an issue and assign it to me?
 
sure
 
Cool. That way I don't forget to look. Thanks.
 
done :) #41 is all yours!
 
 
2 hours later…
9:25 PM
gosh, this is harder than I expected
at least I'm progressing; ProcedureNode has Parameters now
and each Parameter has an IdentifierNode under it
we can know if a parameter IsImplicitByRef
and, like all IdentifierNodes, whether IsTypeSpecified, so we can tell when TypeName is "Variant" whether it's Variant by default.
oh great. StackOverflowException.
 
9:45 PM
No bueno.
 
there there, fixed
:)
 
10:14 PM
It works!!
well... problem with picking up all parameters.. and I'm not sure why some procedures come up as ProcedureNode and some others as CodeBlockNode... but it "works" :)
        [TestMethod]
        public void TestProcedureNodeTakesParameters()
        {
            var parser = new Parser();
            const string code = "Public Sub Foo(ByVal a As Integer, ByRef b As Integer)\n\rEnd Sub\n\r";

            var result = parser.Parse("ParserTests", "Rubberduck.Parser", code);

            var procedure = (ProcedureNode)result.ChildNodes.First();
            var parameters = procedure.Parameters.ToList();
            Assert.AreEqual(2, parameters.Count);
            Assert.AreEqual("a", parameters[0].Identifier.Name);
^^ fails at last assertion
 
11:18 PM
ugh. there can never be a comma in a signature except to separate parameters, right?
 
I don't think you can declare an array as a parameter, can you?
sub myBlowup( arr(1,3) as string)
 
you can, but you have to pass is ByRef and has to be As Variant and without dimensions specified
 
That's what I thought. VBA on mac is terribad though, so I cant really check it without wanting to poke my eyes out
 
this works as expected in Expresso, but only gives me 1 capture at runtime:
(?:(?:(?:\s?(?<optional>Optional)\s)?(?<by>ByRef|ByVal|ParamArray)?\s))?(?:(?<id‌​entifier>(?:[a-zA-Z][a-zA-Z0-9_]*)|(?:[[a-zA-Z0-9_]*]))(?<specifier>[%&@!#$])?(‌​?<array>((?<size>(?:(?:[0-9]+)\,?\s?)*|(?:[0-9]+\sTo\s[0-9]+\,?\s?)+)))?(?<as>\‌​sAs(?:\s(?<reference>(?:(?:(?<library>[a-zA-Z][a-zA-Z0-9_]*))\.)?(?<identifier>(?‌​:[a-zA-Z][a-zA-Z0-9_]*)|(?:[[a-zA-Z0-9_]*]))))?)(?:\,\s)?)+
so I'm giving up the regex multiple capture approach and will just split parameters on comma
(?:(?:(?:\s?(?<optional>Optional)\s)?(?<by>ByRef|ByVal|ParamArray)?\s))?(?:(?<i‌​dentifier>(?:[a-zA-Z][a-zA-Z0-9_]*)|(?:\[[a-zA-Z0-9_]*\]))(?<specifier>[%&@!#$])?‌​(?<array>\((?<size>(?:(?:[0-9]+)\,?\s?)*|(?:[0-9]+\sTo\s[0-9]+\,?\s?)+)\))?(?<as>‌​\sAs(?:\s(?<reference>(?:(?:(?<library>[a-zA-Z][a-zA-Z0-9_]*))\.)?(?<identifier>(‌​?:[a-zA-Z][a-zA-Z0-9_]*)|(?:\[[a-zA-Z0-9_]*\]))))?)(?:\,\s)?)+
actually.. ^^ this is what I have in Expresso
head hurts
ah, there
and test passes :)
        [TestMethod]
        public void ProcedureNodeHasChildren()
        {
            var parser = new Parser();
            const string code = "Public Sub Foo()\n\r    Dim bar As String\n\rEnd Sub\n\r";

            var result = parser.Parse("ParserTests", "Rubberduck.Parser", code);

            var procedure = result.ChildNodes.First();
            Assert.IsTrue(procedure.ChildNodes.OfType<VariableDeclarationNode>().Count() == 1);
        }
ooh this is starting to get exciting :)
 
11:54 PM
See that @RubberDuck? :)
 

« first day (163 days earlier)      last day (3017 days later) »