public Start(IReadOnlyList <IOrType <IToken, ISetUp> > allTokens, ElementMatchingContext context, int currentIndex) { AllTokens = allTokens ?? throw new ArgumentNullException(nameof(allTokens)); Context = context ?? throw new ArgumentNullException(nameof(context)); StartIndex = currentIndex; EndIndex = currentIndex; }
public Matched(IReadOnlyList <IOrType <IToken, ISetUp> > allTokens, ElementMatchingContext context, T value, int startIndex, int endIndex) { AllTokens = allTokens ?? throw new ArgumentNullException(nameof(allTokens)); Context = context ?? throw new ArgumentNullException(nameof(context)); Value = value; EndIndex = endIndex; StartIndex = startIndex; }
// TODO this should not take tokens // and we should protect the tokens from being accessed on non-matched entries // I want to encode tokens and matchedness in the type // this is going to be a few types and interfaces with this static class that creates the real private inner classes public static ITokenMatching <T> MakeNotMatch(ElementMatchingContext context) { return(new NotMatched(context)); }
public static IMatchedTokenMatching <T> MakeMatch(IReadOnlyList <IToken> tokens, ElementMatchingContext context, T value) { return(new Matched(tokens, context, value)); }
public static IMatchedTokenMatching <T> MakeStart(IReadOnlyList <IToken> tokens, ElementMatchingContext context) { return(new Matched(tokens, context, default)); }
public NotMatched(ElementMatchingContext context) { Context = context ?? throw new ArgumentNullException(nameof(context)); }
public Matched(IReadOnlyList <IToken> tokens, ElementMatchingContext context, T value) { Tokens = tokens ?? throw new ArgumentNullException(nameof(tokens)); Context = context ?? throw new ArgumentNullException(nameof(context)); Value = value; }
public static IMatchedTokenMatching MakeStart(IReadOnlyList <IOrType <IToken, ISetUp> > tokens, ElementMatchingContext context, int currentIndex) { return(new Start(tokens, context, currentIndex)); }