public IResult Parse(IContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (!context.AtEnd && Min <= context.Current && context.Current <= Max) { var next = context.Advance(1); var location = Location.From(context, next); var node = Leaf.From(location, NodeSymbols.CharacterLiteral, ((char)context.Current).ToString(CultureInfo.InvariantCulture)); return(Result.Success(location, next, node)); } return(Result.Fail(context)); }
public IResult Parse(IContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (context.StartsWith(Characters)) { var next = context.Advance(Characters.Length); var location = Location.From(context, next); var node = Leaf.From(location, NodeSymbols.StringLiteral, Characters); return(Result.Success(location, next, node)); } return(Result.Fail(context)); }