Exemple #1
0
        public virtual DelimiterResult GetIndex(string source, string delimiter, int minIndex, int tabSize)
        {
            minIndex = TabbifyIndex(source, minIndex, tabSize);

            int result = source.Length >= minIndex?source.IndexOf(delimiter, minIndex) : -1;

            return(DelimiterResult.Create(result));
        }
Exemple #2
0
        public override DelimiterResult GetIndex(string source, string delimiter, int minIndex, int tabSize)
        {
            minIndex = TabbifyIndex(source, minIndex, tabSize);

            if (source.Length < minIndex)
            {
                return(DelimiterResult.Create(-1));
            }

            var match = Regex.Match(source.Substring(minIndex), delimiter);

            if (!match.Success)
            {
                return(DelimiterResult.Create(-1));
            }

            return(new DelimiterResult
            {
                CompareIndex = minIndex + GetGroupIndex(match, "compare", "x"),
                InsertIndex = minIndex + GetGroupIndex(match, "insert", "compare", "x")
            });
        }