Esempio 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;
 }
Esempio 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;
        }
Esempio 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);
        }
Esempio n. 4
0
        public TextBufferBraces(ITextSnapshot snapshot, ILanguage language, RainbowColoringMode coloringMode)
        {
            this.Snapshot = snapshot;
              this.LastParsedPosition = -1;
              this.language = language;
              this.coloringMode = coloringMode;
              this.braceList = new SortedList<char, char>();
              this.braces = new List<BracePos>();
              this.braceErrors = new List<CharPos>();

              if ( this.language != null ) {
            this.braceScanner = this.language.GetService<IBraceScanner>();

            this.braceList.Clear();
            this.BraceChars = this.braceScanner.BraceList;
            for ( int i = 0; i < BraceChars.Length; i += 2 ) {
              this.braceList.Add(BraceChars[i], BraceChars[i + 1]);
            }
              }
        }
Esempio n. 5
0
        public TextBufferBraces(ITextSnapshot snapshot, ILanguage language)
        {
            this.Snapshot           = snapshot;
            this.LastParsedPosition = -1;
            this.language           = language;
            this.braceList          = new SortedList <char, char>();
            this.braces             = new List <BracePos>();
            this.braceErrors        = new List <CharPos>();

            if (this.language != null)
            {
                this.braceScanner = this.language.GetService <IBraceScanner>();

                this.braceList.Clear();
                this.BraceChars = this.braceScanner.BraceList;
                for (int i = 0; i < BraceChars.Length; i += 2)
                {
                    this.braceList.Add(BraceChars[i], BraceChars[i + 1]);
                }
            }
        }
Esempio n. 6
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);
        }