예제 #1
0
        bool TransitionMatches(char c, StateTransition transition)
        {
            bool ret = false;

            if (current_state == transition.Previous)
            {
                ret = Regex.IsMatch(c.ToString(), transition.Pattern);
            }

            return(ret);
        }
예제 #2
0
        int StateChange(StateTransition transition)
        {
            int ret = 0;

            if (transition.Next.Acceptance)
            {
                // send token to analizar sintáctico
            }
            ret           = transition.Next.Return;
            current_state = transition.Next;

            return(ret);
        }
예제 #3
0
        public void Add(
            State before,
            string pattern,
            State after,
            Action CustomAction = null
            )
        {
            StateTransition transition = new StateTransition()
            {
                Previous   = before,
                Pattern    = pattern,
                Next       = after,
                CustomWork = CustomAction
            };

            Add(transition);
        }