Ejemplo n.º 1
0
        internal override void VisitChild()
        {
            // Note: Instead of loop through all child node, need to parse selectively.
            var codeModelVisitor = new VB6CodeModelVisitor(RootModule, this, RootModule.VB6Lexer, RootModule.VB6Parser, RootModule.VB6CommonTokenStream);
            var ctx = ParserContext as VisualBasic6Parser.PropertyGetStmtContext;

            codeModelVisitor.Visit(ctx.visibility());
            PropVisibility = codeModelVisitor.FirstModel as VBVisibility; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.STATIC());
            PropStatic = codeModelVisitor.FirstModel as VBText; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.ambiguousIdentifier());
            PropName = codeModelVisitor.FirstModel as VBAmbiguousIdentifier; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.typeHint());
            PropTypeHint = codeModelVisitor.FirstModel as VBTypeHint; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.argList());
            PropArgList = codeModelVisitor.FirstModel as VBArgList; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.asTypeClause());
            PropAsType = codeModelVisitor.FirstModel as VBAsTypeClause; codeModelVisitor.FirstModel = null;

            // Parse code block inside prop
            codeModelVisitor.Visit(ctx.block());
        }
Ejemplo n.º 2
0
        internal override void VisitChild()
        {
            // Note: Instead of loop through all child node, need to parse selectively.
            var codeModelVisitor = new VB6CodeModelVisitor(RootModule, this, RootModule.VB6Lexer, RootModule.VB6Parser, RootModule.VB6CommonTokenStream);
            var ctx = ParserContext as VisualBasic6Parser.PropertySetStmtContext;

            codeModelVisitor.Visit(ctx.visibility());
            PropVisibility = codeModelVisitor.FirstModel as VBVisibility; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.STATIC());
            PropStatic = codeModelVisitor.FirstModel as VBText; codeModelVisitor.FirstModel = null;

            codeModelVisitor.Visit(ctx.ambiguousIdentifier());
            PropName = codeModelVisitor.FirstModel as VBAmbiguousIdentifier; codeModelVisitor.FirstModel = null;

            // Parse the individual param instead of the entire list. Need to know which arg is for property param and which one for Let param.
            int i         = 0;
            var allParams = ctx.argList().arg();

            for (i = 0; i < allParams.Length - 1; i++)
            {
                // All args here is property params shared by Get/Let
                codeModelVisitor.Visit(allParams[i]);
                PropArgs.Add(codeModelVisitor.FirstModel as VBArg);
                codeModelVisitor.FirstModel = null;
            }

            // The last one is Let arg (RHS)
            codeModelVisitor.Visit(allParams[i]);
            PropSetArg = codeModelVisitor.FirstModel as VBArg;
            codeModelVisitor.FirstModel = null;

            // Parse code block inside prop
            codeModelVisitor.Visit(ctx.block());
        }
Ejemplo n.º 3
0
        public VBText CreateCodeModel(ITerminalNode node)
        {
            try
            {
                var cxt = new VB6CodeModelFactoryContext(_rootModule, _parentCodeBlock, null, _parentCodeBlock.Scope);
                var obj = new VBText(cxt, node);

                obj.BeforeVisitChild();
                _parentCodeBlock.AddCodeModel(obj);
                obj.AfterVisitChild();

                return(obj);
            }
            catch (Exception ex)
            {
                throw;
            }
        }