Exemplo n.º 1
0
        /// <summary>
        /// Implementation of<c>GetLineTokens</c>(). Don't use this method directly!
        /// </summary>
        IEnumerable <ScanTokenInfo> GetLineTokens(ScanLexer lex, ScanState scanState)
        {
            ScanTokenInfo info = lex.GetToken(scanState);

            scanState = info.State;
            while (!info.IsEndOfLine)
            {
                yield return(info);

                info      = lex.GetToken(scanState);
                scanState = info.State;
            }
        }
Exemplo n.º 2
0
        public bool ScanTokenAndProvideInfoAboutIt(TokenInfo tokenInfo, ref int state)
        {
            if (_lexer == null)
            {
                return(false);
            }

            ScanTokenInfo info = _lexer.GetToken((ScanState)state);

            if (info == null)
            {
                return(false);
            }

            state = (int)info.State;

            _lastColor   = (TokenColor)info.Color;
            _colorizeEnd = info.ColorizeEnd;

            tokenInfo.Color   = _lastColor;
            tokenInfo.Type    = (TokenType)info.Type;
            tokenInfo.Trigger = (TokenTriggers)info.Triggers;

            if (info.Token == null)
            {
                return(false);
            }

            tokenInfo.StartIndex = info.Token.Location.Column - 1;
            tokenInfo.EndIndex   = info.Token.Location.EndColumn - 2;

            return(!info.IsEndOfLine);
        }