Example #1
0
 public CAssignmentStatement()
 {
     SetNodeType(GRAMMAR_NODE_TYPE.NODE_TYPE_ASSIGN);
     m_pExpression   = new CExpression();
     m_pComplexDDExp = new CExpression();
     m_pArrayExp     = new CExpression();
     m_pOMExp        = new COMServiceExpression();
     m_pVariable     = new CToken();
 }
Example #2
0
        //	Create as much of the parse tree as possible.
        public override int CreateParseSubTree(ref CLexicalAnalyzer plexAnal, ref CSymbolTable pSymbolTable)
        {
            CToken pToken = null;
            //try
            {
                CExpParser expParser;
                //Munch a <Var>
                if ((CLexicalAnalyzer.LEX_FAIL == plexAnal.GetNextToken(ref pToken, ref pSymbolTable)) || pToken == null)
                {
                    //throw (C_UM_ERROR_INTERNALERR);
                }
                if (pToken.IsArrayVar())
                {
                    plexAnal.UnGetToken();
                    expParser        = new CExpParser();
                    m_pArrayExp      = expParser.ParseExpression(ref plexAnal, ref pSymbolTable, STMT_EXPR_TYPE.EXPR_LVALUE);
                    m_bLvalueIsArray = true;
                    m_pVariable      = null;
                    m_pOMExp         = null;
                    m_pComplexDDExp  = null;//Added By Anil August 23 2005
                }
                //Added By Anil August 4 2005 --starts here
                //For Handlin the DD variable and Expressions
                else if (pToken.IsDDItem())
                {
                    plexAnal.UnGetToken();
                    expParser            = new CExpParser();
                    m_pComplexDDExp      = expParser.ParseExpression(ref plexAnal, ref pSymbolTable, STMT_EXPR_TYPE.EXPR_LVALUE);
                    m_bLvalueIsComplexDD = true;
                    m_pArrayExp          = null;
                    m_pVariable          = null;
                    m_pOMExp             = null;
                }
                //Added By Anil August 4 2005 --Ends here
                else if (pToken.IsVariable())
                {
                    m_pVariable     = pToken;
                    m_pArrayExp     = null;
                    m_pOMExp        = null;
                    m_pComplexDDExp = null;//Anil August 23 2005

                    //DELETE_PTR(pToken);
                    //todo walter
                }
                else if (pToken.IsOMToken())
                {
                    //do something...
                    plexAnal.UnGetToken();
                    m_pOMExp = new COMServiceExpression();
                    m_pOMExp.CreateParseSubTree(ref plexAnal, ref pSymbolTable);
                    m_pVariable     = null;
                    m_pArrayExp     = null;
                    m_pComplexDDExp = null;//Anil August 23 2005
                }
                else
                {
                    //throw (C_AP_ERROR_LVALUE);
                }

                //DELETE_PTR(pToken);  //todo walter
                pToken = null;
                //Munch a <=> or <*=>
                if ((CLexicalAnalyzer.LEX_FAIL == plexAnal.GetNextToken(ref pToken, ref pSymbolTable)) ||
                    pToken == null ||
                    !pToken.IsAssignOp())
                {
                    //throw (C_AP_ERROR_MISSINGEQ);
                }
                m_AssignType = pToken.GetSubType();

                //Munch & Parse the expression.
                //we got to give the expression string to the expression parser.
                expParser = new CExpParser();
                //try
                {
                    m_pExpression = expParser.ParseExpression(ref plexAnal, ref pSymbolTable, STMT_EXPR_TYPE.EXPR_ASSIGN);

                    if (m_pExpression == null)
                    {
                        //throw (C_AP_ERROR_MISSINGEXP);
                    }
                }

                /*
                 *              catch (CRIDEError* perr)
                 *              {
                 *                      pvecErrors.push_back(perr);
                 *                      plexAnal.SynchronizeTo(EXPRESSION, pSymbolTable);
                 *              }
                 */
                if ((CLexicalAnalyzer.LEX_FAIL == plexAnal.GetNextToken(ref pToken, ref pSymbolTable)) ||
                    pToken == null || (RUL_TOKEN_SUBTYPE.RUL_SEMICOLON != pToken.GetSubType()))
                {
                    //throw (C_AP_ERROR_MISSINGSC);
                }
                return(1);
            }

            /*
             *          catch (CRIDEError* perr)
             *          {
             *                  pvecErrors.push_back(perr);
             *                  plexAnal.SynchronizeTo(EXPRESSION, pSymbolTable);
             *          }
             *          catch (...)
             *          {
             *                  throw (C_UM_ERROR_UNKNOWNERROR);
             *          }
             *          return PARSE_FAIL;
             */
        }
Example #3
0
 public virtual int visitOMExpression(COMServiceExpression pExpression, CSymbolTable pSymbolTable,
                                      ref INTER_VARIANT pvar, RUL_TOKEN_SUBTYPE AssignType = RUL_TOKEN_SUBTYPE.RUL_ASSIGN) //Anil August 26 2005 to Fix a[exp1] += exp2
 {
     return(0);
 }