示例#1
0
        private void PrepareNext()
        {
            m_elementIndex++;

            if (m_elementIndex == m_node.GetNumberOfContextElements(m_contextIndex))
            {
                // In case where the first element is also the last
                m_endOfContext = true;
            }
        }
示例#2
0
        private void PrepareNext()
        {
            m_elementIndex++;

            // if element index reaches the end of context
            if (m_elementIndex == m_node.GetNumberOfContextElements(m_contextIndex))
            {
                m_contextIndex++;
                // Find the next non-empty context
                while (m_contextIndex < m_node.M_NumberOfContexts &&
                       m_node.GetNumberOfContextElements(m_contextIndex) == 0)
                {
                    m_contextIndex++;
                }
                m_elementIndex = 0;
            }
        }
        public override int VisitAssignmentOpetators(RASTElement currentNode)
        {
            RASTComposite current = currentNode as RASTComposite;

            // Visit assignment opetator left context
            if (current.GetNumberOfContextElements(ContextType.CT_EXPR_ASSIGNMENT_OPETATORS_LEFT) > 0)
            {
                foreach (RASTElement element in current.GetContextChildren(ContextType.CT_EXPR_ASSIGNMENT_OPETATORS_LEFT))
                {
                    scopeSystem.AddSymbol(element.M_Label, "Local Variable");
                }
            }

            base.VisitAssignmentOpetators(currentNode);

            return(0);
        }
        public override int VisitDefineFunction(RASTElement currentNode)
        {
            RASTComposite current = currentNode as RASTComposite;

            scopeSystem.EnterEnviroment(currentNode.M_Label);

            // Visit function's definition params context
            if (current.GetNumberOfContextElements(ContextType.CT_EXPR_DEFINE_FUNCTION_PARAMS) > 0)
            {
                foreach (RASTElement element in current.GetContextChildren(ContextType.CT_EXPR_DEFINE_FUNCTION_PARAMS))
                {
                    scopeSystem.AddSymbol(element.M_Label, "Formal Parameter");
                }
            }

            base.VisitDefineFunction(currentNode);

            scopeSystem.LeaveEnviroment();

            return(0);
        }