Пример #1
0
        private bool CheckRegionBoundary(char cc, int ii, int lineNumber, BoundaryChar boundaryChar, char openChar, char closeChar)
        {
            if (this.boundaryChars.HasFlag(boundaryChar))
            {
                if (cc == openChar)
                {
                    this.partialRegions.Push(new PartialRegion(boundaryChar, lineNumber, ii));
                    return(true);
                }

                if (cc == closeChar)
                {
                    if (partialRegions.Count > 0)
                    {
                        PartialRegion partialRegion = partialRegions.Pop();
                        // Uncomment if investigating a bug:  Debug.Assert(partialRegion.BoundaryChar == boundaryChar);
                        this.regions.Add(new Region(partialRegion, lineNumber, ii + 1));
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
 internal RegionParser(BoundaryChar boundaryChars)
 {
     this.Clear();
     this.boundaryChars = boundaryChars;
 }