Ejemplo n.º 1
0
 private bool TryGetTokenization(int line, out LineTokenization tokenization) {
     tokenization = _map[line];
     if (tokenization.Tokens != null) {
         return true;
     }
     tokenization = default(LineTokenization);
     return false;
 }
Ejemplo n.º 2
0
 internal LineTokenizationMap Clone() {
     lock (_lock) {
         LineTokenization[] map = null;
         if (_map != null) {
             map = new LineTokenization[_map.Length];
             Array.Copy(map, _map, map.Length);
         }
         return new LineTokenizationMap(map);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Looks for the first cached tokenization preceding the given line.
 /// Returns the line we have a tokenization for or minLine - 1 if there is none.
 /// </summary>
 private int IndexOfPreviousTokenization(int line, int minLine, out LineTokenization tokenization) {
     line--;
     while (line >= minLine) {
         if (_map[line].Tokens != null) {
             tokenization = _map[line];
             return line;
         }
         line--;
     }
     tokenization = default(LineTokenization);
     return minLine - 1;
 }
Ejemplo n.º 4
0
        internal bool TryGetTokenization(int line, out LineTokenization tokenization) {
            if (line < 0) {
                throw new ArgumentOutOfRangeException("line", "Must be 0 or greater");
            }
            Utilities.CheckNotNull(_map);

            if (_map[line].Tokens != null) {
                tokenization = _map[line];
                return true;
            } else {
                tokenization = default(LineTokenization);
                return false;
            }
        }
Ejemplo n.º 5
0
        internal bool TryGetTokenization(int line, out LineTokenization tokenization)
        {
            Debug.Assert(line >= 0);
            Debug.Assert(_map != null);

            if (_map[line].Tokens != null)
            {
                tokenization = _map[line];
                return(true);
            }
            else
            {
                tokenization = default(LineTokenization);
                return(false);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Looks for the first cached tokenization preceding the given line.
        /// Returns the line we have a tokenization for or minLine - 1 if there is none.
        /// </summary>
        internal int IndexOfPreviousTokenization(int line, int minLine, out LineTokenization tokenization) {
            if (line < 0) {
                throw new ArgumentOutOfRangeException("line", "Must be 0 or greater");
            }
            Utilities.CheckNotNull(_map);

            line--;
            while (line >= minLine) {
                if (_map[line].Tokens != null) {
                    tokenization = _map[line];
                    return line;
                }
                line--;
            }
            tokenization = default(LineTokenization);
            return minLine - 1;
        }
Ejemplo n.º 7
0
        internal bool TryGetTokenization(int line, out LineTokenization tokenization)
        {
            if (line < 0)
            {
                throw new ArgumentOutOfRangeException("line", "Must be 0 or greater");
            }

            tokenization = this[line];
            if (tokenization.Tokens != null)
            {
                return(true);
            }
            else
            {
                tokenization = default(LineTokenization);
                return(false);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Looks for the first cached tokenization preceding the given line.
        /// Returns the line we have a tokenization for or minLine - 1 if there is none.
        /// </summary>
        internal int IndexOfPreviousTokenization(int line, int minLine, out LineTokenization tokenization)
        {
            Debug.Assert(line >= 0);
            Debug.Assert(_map != null);

            line--;
            while (line >= minLine)
            {
                if (_map[line].Tokens != null)
                {
                    tokenization = _map[line];
                    return(line);
                }
                line--;
            }
            tokenization = default(LineTokenization);
            return(minLine - 1);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Looks for the first cached tokenization preceding the given line.
        /// Returns the line we have a tokenization for or minLine - 1 if there is none.
        /// </summary>
        internal int IndexOfPreviousTokenization(int line, int minLine, out LineTokenization tokenization)
        {
            if (line < 0)
            {
                throw new ArgumentOutOfRangeException("line", "Must be 0 or greater");
            }

            var map = Map;

            lock (map) {
                line--;
                while (line >= minLine)
                {
                    if (map[line].Tokens != null)
                    {
                        tokenization = map[line];
                        return(line);
                    }
                    line--;
                }
            }
            tokenization = default(LineTokenization);
            return(minLine - 1);
        }