Exemplo n.º 1
0
        private static void ConvertAndMatch <TValue>(NonDeterministicNode <TValue> node, string pattern, bool success, string expectedCapture, TValue?expectedValue) where TValue : struct
        {
            var scanner = new AutomataMatcher <TValue>(node.ToDeterministic());

            using (var reader = new StringReader(pattern))
            {
                var matcher = scanner.Open(reader);

                Assert.That(matcher.TryMatchNext(out var match), Is.EqualTo(success));
                Assert.That(match.Capture, Is.EqualTo(expectedCapture));
                Assert.That(match.Value, Is.EqualTo(expectedValue));
            }
        }
Exemplo n.º 2
0
 public IMatcher <TValue> Compile()
 {
     return(new AutomataMatcher <TValue>(_start.ToDeterministic()));
 }