Esempio n. 1
0
 internal VBText(VB6CodeModelFactoryContext factoryContext, ITerminalNode token)
 {
     Token           = token;
     FactoryContext  = factoryContext;
     RootModule      = factoryContext.RootModule;
     ParentCodeBlock = factoryContext.ParentCodeBlock;
 }
Esempio n. 2
0
        public VBBaseCodeModel CreateCodeModel(ParserRuleContext context)
        {
            try
            {
                // Create code model based on context name
                // e.g: DeclareStmtContext will create VBDeclareStmt class
                var contextClassName   = context.GetType().Name;
                var codeModelClassName = "VB" + contextClassName.Replace("Context", string.Empty);

                var cxt  = new VB6CodeModelFactoryContext(_rootModule, _parentCodeBlock, context, _parentCodeBlock.Scope);
                var args = new object[] { cxt };
                var t    = Type.GetType($"VB6ActiveXDllConverter.CodeModels.{codeModelClassName}", true);
                var obj  = (VBBaseCodeModel)t.Assembly.CreateInstance($"VB6ActiveXDllConverter.CodeModels.{codeModelClassName}", true, BindingFlags.Instance | BindingFlags.NonPublic, null, args, null, null);

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

                return(obj);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio 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;
            }
        }
Esempio n. 4
0
        /*
         * lockStmt
         * : LOCK WS valueStmt (WS? COMMA WS? valueStmt (WS TO WS valueStmt)?)?
         */

        internal VBLockStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
        /*
         * enumerationStmt_Constant
         * : ambiguousIdentifier (WS? EQ WS? valueStmt)? NEWLINE +
         *
         * Note:
         * - Enum member value is optional, can be 32-bit number (VB6 Long) or constant: valueStmt can be a long literal or identifier
         *
         */

        internal VBEnumerationStmt_Constant(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
 internal VBBaseSingleLineStatement(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
 {
 }
Esempio n. 7
0
        /*
         * ifElseBlockStmt
         * : ELSE NEWLINE + (block NEWLINE +)?
         *
         */

        internal VBIfElseBlockStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
            Scope = new VBScope(factoryContext.Scope, this, VBProgramScope.Block);
        }
Esempio n. 8
0
        /*
         * inputStmt
         * : INPUT WS valueStmt (WS? COMMA WS? valueStmt) +
         *
         */

        internal VBInputStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 9
0
        /*
         * declareStmt
         * : (visibility WS)? DECLARE WS (FUNCTION typeHint? | SUB) WS ambiguousIdentifier typeHint? WS LIB WS STRINGLITERAL (WS ALIAS WS STRINGLITERAL)? (WS? argList)? (WS asTypeClause)?
         */

        internal VBDeclareStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 10
0
 internal VBVariableSubStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
 {
 }
Esempio n. 11
0
        /*
         * resumeStmt
         * : RESUME (WS (NEXT | ambiguousIdentifier))?
         */

        internal VBResumeStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 12
0
        /*
         * arg
         * : (OPTIONAL WS)? ((BYVAL | BYREF) WS)? (PARAMARRAY WS)? ambiguousIdentifier typeHint? (WS? LPAREN WS? RPAREN)? (WS asTypeClause)? (WS? argDefaultValue)?
         *
         * argDefaultValue
         * : EQ WS? valueStmt
         *
         * Refer MSDN: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa243374(v=vs.60)
         * Default value: Any constant or constant expression. Valid for Optional parameters only. If the type is an Object, an explicit default value can only be Nothing.
         * Similar to const, can be fixed value, arithmetic, logical expression or mixed of anyone.
         *
         */

        internal VBArg(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 13
0
        /*
         * saveSettingStmt
         * : SAVESETTING WS valueStmt WS? COMMA WS? valueStmt WS? COMMA WS? valueStmt WS? COMMA WS? valueStmt
         */

        internal VBSaveSettingStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 14
0
        /*
         * iCS_S_MemberCall
         * : WS? DOT (iCS_S_VariableOrProcedureCall | iCS_S_ProcedureOrArrayCall)
         *
         */

        internal VBICS_S_MemberCall(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 15
0
        /*
         * macroConstStmt
         * : MACRO_CONST WS ambiguousIdentifier WS? EQ WS? valueStmt
         *
         * Note:
         * - This is a custom rule added to grammar file, since the original open source file do not support this.
         * - Refer: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa262669(v=vs.60)
         * - Syntax is similar to Const, but one constant declaration per line.
         * - Expression can only be litral, other conditional compiler constant, or any combination that includes any or all arithmetic or logical operators except Is.
         * - Private by default
         *
         */

        internal VBMacroConstStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 16
0
 internal VBBaseBlockSubStatement(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
 {
 }
Esempio n. 17
0
        /*
         * certainIdentifier
         * : IDENTIFIER (ambiguousKeyword | IDENTIFIER)*
         * | ambiguousKeyword (ambiguousKeyword | IDENTIFIER) +
         *
         */

        internal VBCertainIdentifier(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 18
0
        /*
         * valueStmt
         * | valueStmt WS? MINUS WS? valueStmt                               # vsMinus
         */

        internal VBVsMinus(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 19
0
        /*
         * argDefaultValue
         * : EQ WS? valueStmt
         *
         */

        internal VBArgDefaultValue(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 20
0
        /*
         * typeStmt_Element
         * : ambiguousIdentifier (WS? LPAREN (WS? subscripts)? WS? RPAREN)? (WS asTypeClause)? NEWLINE +
         *
         * Note:
         * - Similar to variable declaration, except no visibility & type hint.
         * - Must contain either subscripts or asTypeClause. VB6 compile error if both are missing.
         *
         */

        internal VBTypeStmt_Element(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 21
0
        /*
         * valueStmt
         * | valueStmt WS? EQV WS? valueStmt                                 # vsEqv
         */

        internal VBVsEqv(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 22
0
        /*
         * propertySetStmt
         * : (visibility WS)? (STATIC WS)? PROPERTY_SET WS ambiguousIdentifier (WS? argList)? NEWLINE + (block NEWLINE +)? END_PROPERTY
         *
         */

        internal VBPropertySetStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
            Scope = new VBScope(factoryContext.Scope, this, VBProgramScope.Procedure);
        }
Esempio n. 23
0
 internal VBBaseValueStatement(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
 {
 }
Esempio n. 24
0
        /*
         * asTypeClause
         * : AS WS (NEW WS)? type (WS fieldLength)?
         *
         * fieldLength
         * : MULT WS? (INTEGERLITERAL | ambiguousIdentifier)
         *
         */

        internal VBAsTypeClause(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 25
0
        /*
         * rmdirStmt
         * : RMDIR WS valueStmt
         */

        internal VBRmdirStmt(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 26
0
        /*
         * literal
         * : COLORLITERAL
         * | DATELITERAL
         * | DOUBLELITERAL
         * | FILENUMBER
         * | INTEGERLITERAL
         * | OCTALLITERAL
         * | STRINGLITERAL
         * | TRUE
         * | FALSE
         * | NOTHING
         * | NULL
         *
         */

        internal VBLiteral(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 27
0
        /*
         * implicitCallStmt_InBlock
         * : iCS_B_ProcedureCall
         * | iCS_B_MemberProcedureCall
         *
         * iCS_B_ProcedureCall
         * : certainIdentifier (WS argsCall)?
         *
         */

        internal VBICS_B_ProcedureCall(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 28
0
        /*
         * publicPrivateGlobalVisibility
         * : PRIVATE
         * | PUBLIC
         * | GLOBAL
         *
         */

        internal VBPublicPrivateGlobalVisibility(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 29
0
        /*
         * sC_Cond
         * : ELSE # caseCondElse
         * | sC_CondExpr (WS? COMMA WS? sC_CondExpr)* #caseCondExpr
         *
         */

        internal VBCaseCondExpr(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
        {
        }
Esempio n. 30
0
 internal VBOutputList_Expression(VB6CodeModelFactoryContext factoryContext) : base(factoryContext)
 {
 }