HandleBrace() public method

public HandleBrace ( ) : void
return void
Example #1
0
        private void AppendToken(bool leadingSpace, bool trailingSpace)
        {
            if (leadingSpace)
            {
                _tb.AppendSpace();
            }

            if (_tokens.CurrentToken.TokenType == RTokenType.Comment &&
                _tokens.Position > 0 &&
                _tokens.IsLineBreakAfter(_textProvider, _tokens.Position - 1))
            {
                _tb.SoftIndent();
            }

            string text = _textProvider.GetText(_tokens.CurrentToken);

            if (text.IndexOfAny(CharExtensions.LineBreakChars) >= 0)
            {
                _tb.AppendPreformattedText(text);
            }
            else
            {
                _tb.AppendText(text);
            }

            if (_tokens.CurrentToken.TokenType == RTokenType.Comment)
            {
                // make sure there is a line break between comment
                // and the next token
                _tb.SoftLineBreak();
            }
            else
            {
                _braceHandler.HandleBrace();
            }

            _tokens.MoveToNextToken();

            if (trailingSpace)
            {
                _tb.AppendSpace();
            }
        }