コード例 #1
0
        private void ProcessTokenSpan(SnapshotSpan tokenSpan, TokenBuilder tokenBuilder, StatementBuilder statementBuilder)
        {
            var tokenTags = ProcessToken(tokenSpan);

            tokenBuilder.Position += tokenTags.Consumed;

            // Track preprocessors, but don't process them in our statements
            if (tokenTags.ClassifierTagSpan != null && tokenTags.ClassifierTagSpan.Tag.TokenType.IsPreprocessor())
            {
                var preprocessorTagSpan = new TagSpan <IGLSLTag>(tokenTags.ClassifierTagSpan.Span, tokenTags.ClassifierTagSpan.Tag);
                _statements.Append(preprocessorTagSpan);
            }
            else
            {
                var token = tokenSpan.GetText();
                statementBuilder.AppendTokenTags(tokenTags);

                // Process the statement once we encounter either a ';' or '{' character
                if ((tokenTags.ClassifierTagSpan != null && tokenTags.ClassifierTagSpan.Tag.TokenType == GLSLTokenTypes.Semicolon) || token == "{")
                {
                    var statement = statementBuilder.ProcessStatement(_bracketTagger, _functionTagger, _variableTagger);
                    _statements.Append(statement);
                }
            }
        }