예제 #1
0
        private void DebugWrite(GrammarNode node)
        {
            Console.Write(cntNode + ".");

            for (int i = 0; i < level; ++i)
            {
                Console.Write("  ");
            }

            if (node != null)
            {
                Console.WriteLine(node.GetType().ToString());
            }
            else
            {
                Console.WriteLine("NULL value");
            }
            ++cntNode;
        }
예제 #2
0
        public bool CallAction(GrammarNode obj, CallActionType type)
        {
            Type              objType  = obj.GetType();
            List <Type>       objTypes = GetTypes(objType);
            List <MethodInfo> list;

            switch (type)
            {
            case CallActionType.PreActionType:
                list = _MethodsPreAction;
                break;

            case CallActionType.PostActionType:
                list = _MethodsPostAction;
                break;

            default:
                list = _MethodsAction;
                break;
            }

            foreach (Type t in objTypes)
            {
                MethodInfo mi = list.Find(s => s.GetParameters()[0].ParameterType == t);
                if (mi != null)
                {
                    object[] paramArray = { obj };
                    return((bool)mi.Invoke(this, paramArray));
                }
            }

            if (type == CallActionType.ActionType)
            {
                Debug.Assert(false, string.Format("Not suitable Action defined for {0}", objType));
            }
            return(true);
        }
예제 #3
0
 public virtual bool PreAction(GrammarNode child)
 {
     _HTML += string.Format("<DIV CLASS=\"{0}\">", child.GetType().Name);
     return(true);
 }