Exemplo n.º 1
0
 protected IList<CharPos> Extract(IBraceScanner extractor, string input, int start, int state, bool reset=true)
 {
     if ( reset ) extractor.Reset(0);
       ITextChars chars = new StringChars(input, start);
       IList<CharPos> list = new List<CharPos>();
       CharPos cp = CharPos.Empty;
       while ( !chars.EndOfLine ) {
     if ( extractor.Extract(chars, ref cp) )
       list.Add(cp);
       }
       return list;
 }
Exemplo n.º 2
0
        protected IList<CharPos> ExtractWithLines(IBraceScanner extractor, string input, int start, int state)
        {
            extractor.Reset(0);

              input = input.Substring(start);

              String[] lines = input.Split('\r', '\n');
              List<CharPos> result = new List<CharPos>();
              foreach ( String line in lines ) {
            ITextChars chars = new StringChars(line);
            CharPos cp = CharPos.Empty;
            while ( !chars.EndOfLine ) {
              if ( extractor.Extract(chars, ref cp) )
            result.Add(cp);
            }
              }
              return result;
        }
Exemplo n.º 3
0
        protected IList <CharPos> Extract(IBraceScanner extractor, string input, int start, int state, bool reset = true)
        {
            if (reset)
            {
                extractor.Reset(0);
            }
            ITextChars      chars = new StringChars(input, start);
            IList <CharPos> list  = new List <CharPos>();
            CharPos         cp    = CharPos.Empty;

            while (!chars.AtEnd)
            {
                if (extractor.Extract(chars, ref cp))
                {
                    list.Add(cp);
                }
            }
            return(list);
        }
Exemplo n.º 4
0
        private void ExtractBraces(IBraceStacker pairs, int startOffset, int endOffset, int state)
        {
            braceScanner.Reset(state);
            int lineNum = Snapshot.GetLineNumberFromPosition(startOffset);

            while (lineNum < Snapshot.LineCount)
            {
                var line       = Snapshot.GetLineFromLineNumber(lineNum++);
                var lineOffset = startOffset > 0 ? startOffset - line.Start : 0;
                if (line.Length != 0)
                {
                    ExtractFromLine(pairs, line, lineOffset);
                }
                startOffset             = 0;
                this.LastParsedPosition = line.End;
                if (line.End >= endOffset)
                {
                    break;
                }
            }
        }
Exemplo n.º 5
0
        protected IList <CharPos> ExtractWithLines(IBraceScanner extractor, string input, int start, int state)
        {
            extractor.Reset(0);

            input = input.Substring(start);

            String[]       lines  = input.Split('\r', '\n');
            List <CharPos> result = new List <CharPos>();

            foreach (String line in lines)
            {
                ITextChars chars = new StringChars(line);
                CharPos    cp    = CharPos.Empty;
                while (!chars.AtEnd)
                {
                    if (extractor.Extract(chars, ref cp))
                    {
                        result.Add(cp);
                    }
                }
            }
            return(result);
        }