コード例 #1
0
ファイル: RegularExpression.cs プロジェクト: i-e-b/Phantom2
        /// <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;
        }
コード例 #2
0
ファイル: PascalParser.cs プロジェクト: i-e-b/Phantom2
 public ParserMatch TryMatch(IScanner scan)
 {
     Console.WriteLine(scan.RemainingData());
     return src.TryMatch(scan);
 }