Esempio n. 1
0
        private bool performParseAction(ParseAction <SYMBOL_ENUM, TREE_NODE> action, ActionRecoveryEnum findAction)
        {
            bool change = false;

            bool shift_action = action.Shift;

            ReductionAction <SYMBOL_ENUM, TREE_NODE>[] reduction_actions = action.Reductions;

            if (action.Fork && action.UseHorizon)
            {
                if (!selectActionOnHorizon(ref shift_action, ref reduction_actions))
                {
                    // we were supposed to find resolution in horizon, but we failed (there is simply error in input)
                    // so return false -- no action performed
                    return(false);
                }
            }

            // shift has to go first because it does not remove anything from (forked) stack
            if (shift_action)
            {
                makeShift(findAction);
                change = true;
            }

            if (makeReductions(findAction, reduction_actions))
            {
                change = true;
            }

            return(change);
        }
Esempio n. 2
0
        public bool Equals(ParseAction <SYMBOL_ENUM, TREE_NODE> other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Shift.Equals(other.Shift) && Reductions.SequenceEqual(other.Reductions));
        }