Example #1
0
        public bool Match(string content, int offset, out TokenHandle handle)
        {
            handle = null;

            var match = Parser.Match(content, offset);

            if (match.Success == false)
            {
                return(false);
            }

            var capture = match.Captures[0];

            if (capture.Index != offset)
            {
                return(false);
            }

            if (Stop != null && Stop.Match(content, match.Groups[0].Index + match.Groups[0].Length) == false)
            {
                return(false);
            }

            if (match.Groups["value"].Success)
            {
                handle = new TokenHandle(match.Groups["value"].Value, offset + capture.Length);
            }
            else
            {
                handle = new TokenHandle(capture.Value, offset + capture.Length);
            }

            return(true);
        }
Example #2
0
        public bool Match(string content, int offset, out TokenHandle handle)
        {
            handle = null;

            var match = Parser.Match(content, offset);
            if (match.Success == false)
                return false;

            var capture = match.Captures[0];
            if (capture.Index != offset)
                return false;

            if (Stop != null && Stop.Match(content, match.Groups[0].Index + match.Groups[0].Length) == false)
                return false;
                
            if (match.Groups["value"].Success)
                handle = new TokenHandle(match.Groups["value"].Value, offset + capture.Length);
            else
                handle = new TokenHandle(capture.Value, offset + capture.Length);

            return true;
        }