コード例 #1
0
 public TextLinesCursor(TextLinesCursor InCsr)
 {
     mLines     = InCsr.mLines;
     mLinesNode = InCsr.mLinesNode;
     mLineOx    = InCsr.mLineOx;
     mRltv      = InCsr.mRltv;
 }
コード例 #2
0
 public TextLinesWordCursor(
     WordCursor InWordCursor,
     TextLinesCursor InBeginLineCursor, TextLinesCursor InEndLineCursor)
     : base(InWordCursor)
 {
     mBeginLineCursor = InBeginLineCursor;
     mEndLineCursor   = InEndLineCursor;
 }
コード例 #3
0
        /// <summary>
        /// scan from the current cursor position, from line to line, until
        /// a char not equal any of the pattern chars is found.
        /// </summary>
        /// <param name="InCsr"></param>
        /// <param name="InNotEqualChars"></param>
        /// <returns></returns>
        public TextLinesScanResults ScanNotEqual(
            TextLinesCursor InCsr,
            ScanPatterns InNotEqualPatterns,
            ScannerEndOfLineConsider InEolConsider)
        {
            ScanPatternResults   res;
            TextLinesScanResults rv = new TextLinesScanResults();

            TextLinesCursor csr = Scanner_InitialCursorSetup(this, InCsr);

            while (true)
            {
                if ((csr.Position == RelativePosition.End) ||
                    (csr.Position == RelativePosition.None))
                {
                    csr.Position = RelativePosition.None;
                    rv.Pos       = csr;
                    rv.WhatFound = ScannerWhatFound.NotFound;
                    break;
                }

                int ex = csr.LinesNode.Value.LineData.Length - 1;
                res = Scanner.ScanNotEqual(
                    csr.LinesNode.Value.LineData, csr.LineOx, ex,
                    InNotEqualPatterns);

                // a char not equal to the pattern chars is found.
                if (res.FoundPos >= 0)
                {
                    csr.LineOx   = res.FoundPos;
                    rv.Pos       = csr;
                    rv.WhatFound = ScannerWhatFound.PatternChar;
                    break;
                }
                else if (InEolConsider == ScannerEndOfLineConsider.Found)
                {
                    csr.LineOx   = -1;
                    rv.Pos       = csr;
                    rv.WhatFound = ScannerWhatFound.HardLineBreak;
                    break;
                }
                else
                {
                    csr.LineAdvance(this);
                }
            }

            return(rv);
        }
コード例 #4
0
        private static TextLinesCursor Scanner_InitialCursorSetup(
            TextLines InLines, TextLinesCursor InCsr)
        {
            TextLinesCursor csr = new TextLinesCursor(InCsr);

            if (csr.Position == RelativePosition.Begin)
            {
                csr.LineAdvance(InLines);
            }
            else if (csr.EndOfLine == true)
            {
                csr.LineAdvance(InLines);
            }

            return(csr);
        }
コード例 #5
0
        /// <summary>
        /// Scan forward in TextLines until char equal any of the pattern chars.
        /// </summary>
        /// <param name="InCsr"></param>
        /// <param name="InPatternChars"></param>
        /// <param name="InEolConsider"></param>
        /// <returns></returns>
        public TextLinesScanResults ScanEqualAny(
            TextLinesCursor InCsr,
            char[] InPatternChars,
            ScannerEndOfLineConsider InEolConsider)
        {
            TextLinesScanResults rv = new TextLinesScanResults();

            Scanner.ScanCharResults res;

            TextLinesCursor csr = Scanner_InitialCursorSetup(this, InCsr);

            while (true)
            {
                if ((csr.Position == RelativePosition.End) ||
                    (csr.Position == RelativePosition.None))
                {
                    csr.Position = RelativePosition.None;
                    rv.Pos       = csr;
                    rv.WhatFound = ScannerWhatFound.NotFound;
                    break;
                }

                res = Scanner.ScanEqualAny(
                    csr.LineData, csr.LineOx, InPatternChars);

                // char is found.
                if (res.ResultPos >= 0)
                {
                    csr.LineOx   = res.ResultPos;
                    rv.Pos       = csr;
                    rv.WhatFound = ScannerWhatFound.PatternChar;
                    break;
                }

                else if (InEolConsider == ScannerEndOfLineConsider.Found)
                {
                    csr.LineOx   = -1;
                    rv.Pos       = csr;
                    rv.WhatFound = ScannerWhatFound.HardLineBreak;
                    break;
                }

                csr.LineAdvance(this);
            }

            return(rv);
        }
コード例 #6
0
 public TextLinesWordCursor(WordCursor InWordCursor)
     : base(InWordCursor)
 {
     mBeginLineCursor = null;
     mEndLineCursor   = null;
 }
コード例 #7
0
 public TextLinesWordCursor()
 {
     mBeginLineCursor = null;
     mEndLineCursor   = null;
 }