Exemplo n.º 1
0
 protected override IEnumerable<Terminal> ReadImpl(ITextScanner scanner, ITextContext context)
 {
     if (scanner.Peek() == -1)
     {
         return Empty;
     }
     var result = scanner.TryMatch(terminal, comparer);
     if (result.IsMatch)
     {
         return new[] { new Terminal(result.Text, context) };
     }
     return Empty;
 }
Exemplo n.º 2
0
        protected override IEnumerable <Terminal> ReadImpl(ITextScanner scanner, ITextContext context)
        {
            if (scanner.Peek() == -1)
            {
                return(Empty);
            }

            // ReSharper disable once ForCanBeConvertedToForeach
            for (var i = 0; i < valueRange.Length; i++)
            {
                var c      = valueRange[i];
                var result = scanner.TryMatch(c);
                if (result.IsMatch)
                {
                    return(new[] { new Terminal(result.Text, context) });
                }
            }
            return(Empty);
        }