/// <summary> /// Defines trueness of the specified predicate towards /// specified token /// </summary> /// <param name="tokens"> stack with specified token on top </param> /// <param name="pr"></param> /// <returns></returns> public static bool Check(Stack <IToken> tokens, IPredicateOf1 <IToken> pr) { return(tokens.Count != 0 && pr.Execute(tokens.Peek())); }
/// <summary> /// Defines trueness of the specified predicate towards /// char in specified position /// </summary> /// <param name="pos"></param> /// <param name="pr"></param> /// <returns></returns> public static bool Check(Position pos, IPredicateOf1 <char> pr) { return(!pos.IsEnd && !pos.IsBegin && pr.Execute(pos.Current)); }