/// <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); }
/// <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; }
/// <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); }
/// <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); }
/// <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())); }
/// <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()); }