Exemplo n.º 1
0
        /// <summary>
        ///     Specific rule implementation of the match. Which matches if all rules match.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns><c>true</c> if input is matched, <c>false</c> otherwise.</returns>
        protected internal override bool MatchImpl(ParserState state)
        {
            var oldState = state.Clone();

            if (Leafs.All(c => c.MatchImpl(state)))
            {
                return(true);
            }

            state.Assign(oldState);
            return(false);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Indicates if the current parser state matches the rule.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns></returns>
 public override bool Match(ParserState state)
 {
     ParserState oldState = state.Clone();
     foreach (Rule rule in this.Sons)
     {
         if (rule.Match(state))
         {
             return true;
         }
         state.Assign(oldState);
     }
     return false;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Indicates if the current parser state matches the rule.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns></returns>
 public override bool Match(ParserState state)
 {
     ParserState oldState = state.Clone();
     foreach (Rule rule in this.Sons)
     {
         if (rule.Match(state))
         {
             return true;
         }
         state.Assign(oldState);
     }
     return false;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Indicates if the current parser state matches the rule.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns></returns>
        public override bool Match(ParserState state)
        {
            ParserState oldState = state.Clone();

            foreach (Rule rule in this.Sons)
            {
                if (!rule.Match(state))
                {
                    state.Assign(oldState);
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Specific rule implementation of the match. Which returns true if any child matches.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns><c>true</c> if input is matched, <c>false</c> otherwise.</returns>
        protected internal override bool MatchImpl(ParserState state)
        {
            var oldState = state.Clone();

            foreach (var child in Leafs)
            {
                if (child.MatchImpl(state))
                {
                    return(true);
                }

                state.Assign(oldState);
            }

            return(false);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Indicates if the current parser state matches the rule.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns></returns>
 public override bool Match(ParserState state)
 {
     return(!this.FirstSon.Match(state.Clone()));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Indicates if the current parser state matches the rule.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns></returns>
 public override bool Match(ParserState state)
 {
     return !this.FirstSon.Match(state.Clone());
 }