SmartSQL/SmartSQL.Framework/TSqlFormatter/Tokenizers/TSqlStandardTokenizer.cs

(开头部分) 42KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
Poor Man's T-SQL Formatter - a small free Transact-SQL formatting 
library for .Net 2.0, written in C#. 
Copyright (C) 2011-2013 Tao Klerks

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

using TSqlFormatter.Interfaces;
using System;
using System.IO;
using System.Text;

namespace TSqlFormatter.Tokenizers
{
    public class TSqlStandardTokenizer : ISqlTokenizer
    {
        public Interfaces.ITokenList TokenizeSQL(string inputSQL)
        {
            TokenList tokenContainer = new TokenList();
            StringReader inputReader = new StringReader(inputSQL);
            SqlTokenizationType? currentTokenizationType;
            StringBuilder currentTokenValue = new StringBuilder();
            int commentNesting;

            currentTokenizationType = null;
            currentTokenValue.Length = 0;
            commentNesting = 0;

            int currentCharInt = inputReader.Read();
            while (currentCharInt >= 0)
            {
                char currentCharacter = (char)currentCharInt;
                if (currentTokenizationType == null)
                {
                    ProcessOrOpenToken(ref currentTokenizationType, currentTokenValue, currentCharacter, tokenContainer);
                }
                else
                {
                    switch (currentTokenizationType.Value)
                    {
                        case SqlTokenizationType.WhiteSpace:
                            if (IsWhitespace(currentCharacter))
                            {
                                currentTokenValue.Append(currentCharacter);
                            }
                            else
                            {
后面还有 856 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。