Exemplo 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.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());
        }
Exemplo 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.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());
        }
Exemplo n.º 3
0
        // For demo
        internal override void VisitChild()
        {
            var ctx = ParserContext as VisualBasic6Parser.SetStmtContext;
            var codeModelVisitor = new VB6CodeModelVisitor(RootModule, this, RootModule.VB6Lexer, RootModule.VB6Parser, RootModule.VB6CommonTokenStream);

            codeModelVisitor.Visit(ctx.implicitCallStmt_InStmt());
            codeModelVisitor.Visit(ctx.valueStmt());
        }
Exemplo n.º 4
0
        internal override void VisitChild()
        {
            var codeModelVisitor = new VB6CodeModelVisitor(RootModule, this, RootModule.VB6Lexer, RootModule.VB6Parser, RootModule.VB6CommonTokenStream);

            foreach (var item in ParserContext.children)
            {
                codeModelVisitor.Visit(item);
            }
            //codeModelVisitor.PostProcess();
        }
Exemplo n.º 5
0
        public VBBaseModule CreateModuleCodeModels(VisualBasic6Parser.ModuleContext context)
        {
            // Create & extract module level metadata
            _moduleCodeModel = CreateModule(_fileType, context);
            var moduleVisitor = new VB6ModuleVisitor(_moduleCodeModel, _vb6Lexer, _vb6Parser, _commonTokenStream);

            moduleVisitor.Visit(context);
            moduleVisitor.PostProcess();

            // Visit code blocks to create code object model for analysis & conversion.
            var codeModelVisitor = new VB6CodeModelVisitor(_moduleCodeModel, _moduleCodeModel, _vb6Lexer, _vb6Parser, _commonTokenStream);

            codeModelVisitor.Visit(context.moduleBody());
            codeModelVisitor.PostProcess();

            return(_moduleCodeModel);
        }