Ejemplo n.º 1
0
        /// <summary>
        /// Test the regular expression.
        /// </summary>
        /// <remarks>This is done on the entire input.
        /// This might cause problems with file-stream parsing.</remarks>
        public ParserMatch TryMatch(IScanner scan)
        {
            int offset = scan.Offset;

            string remains = scan.RemainingData();
            var result = test.Match(remains);

            if (result.Success && result.Index == 0)
            {
                scan.Seek(offset + result.Length);
                return scan.CreateMatch(this, offset, result.Length);
            }

            return scan.NoMatch;
        }
Ejemplo n.º 2
0
 public ParserMatch TryMatch(IScanner scan)
 {
     Console.WriteLine(scan.RemainingData());
     return src.TryMatch(scan);
 }