Exemplo n.º 1
0
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            SpaceSeparatedListFormatter.ProcessInterChildRegion(previousChild, nextChild);
        }
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            if (nextChild is SqlModuleOption)
            {
                if (!foundTokenWith)
                {
                    DecrementIndentLevel();
                }
                for (int i = previousChild.Position.endTokenNumber; i < nextChild.Position.startTokenNumber; i++)
                {
                    if (!foundTokenWith && TokenManager.TokenList[i].TokenId == FormatterTokens.TOKEN_WITH)
                    {
                        IncrementIndentLevel();
                        foundTokenWith = true;
                    }
                    SimpleProcessToken(i, FormatterUtilities.NormalizeNewLinesEnsureOneNewLineMinimum);
                }
            }
            else if (previousChild is SqlObjectIdentifier)
            {
                NewLineSeparatedListFormatter.ProcessInterChildRegion(previousChild, nextChild);
            }
            else
            {
                base.ProcessInterChildRegion(previousChild, nextChild);
            }
        }
Exemplo n.º 3
0
        public override ASTNodeFormatter Create(FormatterVisitor visitor, SqlCodeObject codeObject)
        {
            Validate.IsNotNull(nameof(visitor), visitor);
            Validate.IsNotNull(nameof(codeObject), codeObject);

            return(DoCreate(visitor, codeObject as T));
        }
Exemplo n.º 4
0
        private void AddRowValue(ArrayList row, Column column, SqlCodeObject value)
        {
            if (column.IsIdentity && column.ParentTable.IsIdentityInsertForbidden || column.IsRowVersion)
            {
                throw new SqlUpdateColumnForbiddenException(column.Name);
            }
            switch (value)
            {
            case SqlLiteralExpression literal:
            {
                row[column.Order] = Helper.GetValueFromString(column, literal);
                break;
            }

            case SqlBuiltinScalarFunctionCallExpression function:
            {
                var select = new SelectDataBuilder(  ).Build(function, new RawData(_Command));
                row[column.Order] = select.Select(new RawTableJoinRow());
                break;
            }

            case SqlScalarVariableRefExpression variableRef:
            {
                var select = new SelectDataFromVariables(variableRef, _Command);
                row[column.Order] = select.Select(new RawTableJoinRow());
                break;
            }

            default:
                throw new NotImplementedException($"Value of type {value.GetType(  )} is not supported");
            }
            ValidateDataSize(column, row[column.Order]);
        }
Exemplo n.º 5
0
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            // first, figure out how big to make the pad
            int padLength = 1;

            if (ColumnSpacingDefinitions != null && nextColumn < ColumnSpacingDefinitions.Count)
            {
                if (previousChild.GetType() == ColumnSpacingDefinitions[nextColumn].PreviousType &&
                    (ColumnSpacingDefinitions[nextColumn].NextType == null || nextChild.GetType() == ColumnSpacingDefinitions[nextColumn].NextType))
                {
                    string text         = previousChild.TokenManager.GetText(previousChild.Position.startTokenNumber, previousChild.Position.endTokenNumber);
                    int    stringLength = text.Length;
                    padLength = ColumnSpacingDefinitions[nextColumn].PaddedLength - stringLength;

                    Debug.Assert(padLength > 0, "unexpected value for Pad Length");
                    padLength = Math.Max(padLength, 1);

                    ++nextColumn;
                }
            }
            // next, normalize the tokens
            int start = previousChild.Position.endTokenNumber;
            int end   = nextChild.Position.startTokenNumber;

            for (int i = start; i < end; i++)
            {
                SimpleProcessToken(i, (string original, FormatContext context) => { return(FormatterUtilities.NormalizeNewLinesOrCondenseToNSpaces(original, context, padLength)); });
            }
        }
Exemplo n.º 6
0
        private void ParseTokens(SqlCodeObject codeObject)
        {
            var nonEmptyTokens = codeObject.Tokens
                                 .Where(token => Tokens.LEX_WHITE != (Tokens)token.Id)
                                 .ToList();

            ParseTokens(nonEmptyTokens);
        }
Exemplo n.º 7
0
 internal override void ProcessChild(SqlCodeObject child)
 {
     Validate.IsNotNull(nameof(child), child);
     base.ProcessChild(child);
     if (child is SqlForBrowseClause)
     {
         DecrementIndentLevel();
     }
 }
Exemplo n.º 8
0
        internal virtual void ProcessInterChildRegion(SqlCodeObject lastChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(lastChild), lastChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            int lastChildEnd   = lastChild.Position.endTokenNumber;
            int nextChildStart = nextChild.Position.startTokenNumber;

            ProcessTokenRange(lastChildEnd, nextChildStart);
        }
Exemplo n.º 9
0
 /// <summary>
 /// processes any section in a query, since the basic behavior is constant
 /// </summary>
 protected int ProcessQuerySection(int nextToken, SqlCodeObject queryObject)
 {
     if (queryObject != null)
     {
         ProcessAndNormalizeWhitespaceRange(nextToken, queryObject.Position.startTokenNumber,
                                            FormatterUtilities.NormalizeNewLinesEnsureOneNewLineMinimum);
         ProcessChild(queryObject);
         nextToken = queryObject.Position.endTokenNumber;
     }
     return(nextToken);
 }
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            if (previousChild is SqlTopSpecification)
            {
                NewLineSeparatedListFormatter.ProcessInterChildRegion(previousChild, nextChild);
            }
            else
            {
                base.ProcessInterChildRegion(previousChild, nextChild);
            }
        }
Exemplo n.º 11
0
        public override void Format()
        {
            LexLocation loc = CodeObject.Position;

            SqlCodeObject firstChild = CodeObject.Children.FirstOrDefault();

            if (firstChild != null)
            {
                //
                // format the text from the start of the object to the start of its first child
                //
                LexLocation firstChildStart = firstChild.Position;
                ProcessPrefixRegion(loc.startTokenNumber, firstChildStart.startTokenNumber);

                ProcessChild(firstChild);

                // keep track of the next token to process
                int nextToken = firstChildStart.endTokenNumber;

                // process the columns if available
                nextToken = ProcessColumns(nextToken);

                // process options if available
                nextToken = ProcessOptions(nextToken);

                // process the region containing the AS token
                nextToken = ProcessAsToken(nextToken, indentAfterAs: true);

                // process the query with clause if present
                nextToken = ProcessQueryWithClause(nextToken);

                // process the query expression
                nextToken = ProcessQueryExpression(nextToken);

                DecrementIndentLevel();

                // format text from end of last child to end of object.
                SqlCodeObject lastChild = CodeObject.Children.LastOrDefault();
                Debug.Assert(lastChild != null, "last child is null.  Need to write code to deal with this case");
                ProcessSuffixRegion(lastChild.Position.endTokenNumber, loc.endTokenNumber);
            }
            else
            {
                // no children
                Visitor.Context.ProcessTokenRange(loc.startTokenNumber, loc.endTokenNumber);
            }
        }
Exemplo n.º 12
0
        public override void Format()
        {
            LexLocation loc = GetLexLocationForNode(CodeObject);

            SqlCodeObject firstChild = CodeObject.Children.FirstOrDefault();

            if (firstChild != null)
            {
                //
                // format the text from the start of the object to the start of it's first child
                //
                LexLocation firstChildStart = GetLexLocationForNode(firstChild);
                ProcessPrefixRegion(loc.startTokenNumber, firstChildStart.startTokenNumber);

                //LexLocation lastChildLexLocation = null;
                SqlCodeObject previousChild = null;
                foreach (SqlCodeObject child in CodeObject.Children)
                {
                    //
                    // format text between the last child's end & current child's start
                    //
                    if (previousChild != null)
                    {
                        //ProcessInterChildRegion(lastChildLexLocation.endTokenNumber, childLexLocation.startTokenNumber);
                        ProcessInterChildRegion(previousChild, child);
                    }

                    //
                    //  format text of the the current child
                    //
                    ProcessChild(child);
                    previousChild = child;
                }

                //
                // format text from end of last child to end of object.
                //
                Debug.Assert(previousChild != null, "last child is null.  Need to write code to deal with this case");
                ProcessSuffixRegion(previousChild.Position.endTokenNumber, loc.endTokenNumber);
            }
            else
            {
                // no children
                ProcessTokenRange(loc.startTokenNumber, loc.endTokenNumber);
            }
        }
 public NewLineSeparatedListFormatter(FormatterVisitor visitor, SqlCodeObject codeObject, bool incrementIndentLevelOnPrefixRegion)
     : base(visitor, codeObject, incrementIndentLevelOnPrefixRegion)
 {
 }
Exemplo n.º 14
0
 public abstract ASTNodeFormatter Create(FormatterVisitor visitor, SqlCodeObject codeObject);
Exemplo n.º 15
0
 private void Process(SqlCodeObject sqlCodeObject, string indent)
 {
     Console.WriteLine($"{indent}{sqlCodeObject.GetType().Name} = '{sqlCodeObject.Sql}'");
     Process(sqlCodeObject.Children, indent + "  ");
 }
Exemplo n.º 16
0
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            /* Due to the current behavior of the T-SQL Parser, the FOR clause needs to be treated separately */
            if (nextChild is SqlForBrowseClause || nextChild is SqlForXmlClause)
            {
                #region Find the "FOR" token
                int       forTokenIndex = previousChild.Position.endTokenNumber;
                TokenData td            = TokenManager.TokenList[forTokenIndex];
                while (td.TokenId != FormatterTokens.TOKEN_FOR && forTokenIndex < CodeObject.Position.endTokenNumber)
                {
                    Debug.Assert(
                        TokenManager.IsTokenComment(td.TokenId) ||
                        TokenManager.IsTokenWhitespace(td.TokenId)
                        , string.Format(CultureInfo.CurrentCulture, "Unexpected token \"{0}\" before the FOR token.", Visitor.Context.GetTokenRangeAsOriginalString(forTokenIndex, forTokenIndex + 1))
                        );
                    ++forTokenIndex;
                    td = TokenManager.TokenList[forTokenIndex];
                }
                Debug.Assert(forTokenIndex < CodeObject.Position.endTokenNumber, "No FOR token.");
                #endregion // Find the "FOR" token


                #region Process the tokens before the "FOR" token
                for (int i = previousChild.Position.endTokenNumber; i < forTokenIndex; i++)
                {
                    Debug.Assert(
                        TokenManager.IsTokenComment(TokenManager.TokenList[i].TokenId) ||
                        TokenManager.IsTokenWhitespace(TokenManager.TokenList[i].TokenId)
                        , string.Format(CultureInfo.CurrentCulture, "Unexpected token \"{0}\" before the FOR token.", Visitor.Context.GetTokenRangeAsOriginalString(i, i + 1))
                        );
                    SimpleProcessToken(i, FormatterUtilities.NormalizeNewLinesEnsureOneNewLineMinimum);
                }
                #endregion // Process the tokens before the "FOR" token

                #region Process the "FOR" token
                if (previousChild.Position.endTokenNumber >= forTokenIndex ||
                    !TokenManager.IsTokenWhitespace(TokenManager.TokenList[forTokenIndex - 1].TokenId))
                {
                    td = TokenManager.TokenList[forTokenIndex];
                    AddIndentedNewLineReplacement(td.StartIndex);
                }
                Visitor.Context.ProcessTokenRange(forTokenIndex, forTokenIndex + 1);
                IncrementIndentLevel();

                int nextToken = forTokenIndex + 1;
                Debug.Assert(nextToken < CodeObject.Position.endTokenNumber, "View Definition ends unexpectedly after the FOR token.");
                // Ensure a whitespace after the "FOR" token
                if (!TokenManager.IsTokenWhitespace(TokenManager.TokenList[nextToken].TokenId))
                {
                    td = TokenManager.TokenList[forTokenIndex];
                    AddIndentedNewLineReplacement(td.StartIndex);
                }
                #endregion // Process the "FOR" token

                #region Process tokens after the FOR token
                for (int i = nextToken; i < nextChild.Position.startTokenNumber; i++)
                {
                    SimpleProcessToken(i, FormatterUtilities.NormalizeNewLinesOrCondenseToOneSpace);
                }
                #endregion // Process tokens after the FOR token
            }
            else
            {
                base.ProcessInterChildRegion(previousChild, nextChild);
            }
        }
Exemplo n.º 17
0
 public SqlBatchFormatter(FormatterVisitor visitor, SqlCodeObject codeObject)
     : base(visitor, codeObject, false)
 {
 }
Exemplo n.º 18
0
 internal override void ProcessChild(SqlCodeObject child)
 {
     Validate.IsNotNull(nameof(child), child);
     SpaceSeparatedListFormatter.ProcessChild(child);
 }
Exemplo n.º 19
0
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            // find the potition of the operator token:
            // operatorTokenNumber
            #region FindOperator

            // look for the expression type based on the operator and determine its type and position
            int  binaryOperatorTokenID = FormatterTokens.LAST_TOKEN;
            bool foundOperator         = false;
            int  operatorTokenNumber   = nextChild.Position.startTokenNumber;
            for (int i = previousChild.Position.endTokenNumber; !foundOperator && i < nextChild.Position.startTokenNumber; i++)
            {
                TokenData td = GetTokenData(i);
                if (td.TokenId == FormatterTokens.TOKEN_UNION ||
                    td.TokenId == FormatterTokens.TOKEN_INTERSECT ||
                    td.TokenId == FormatterTokens.TOKEN_EXCEPT)
                {
                    foundOperator         = true;
                    binaryOperatorTokenID = td.TokenId;
                    operatorTokenNumber   = i;
                }
            }

            // check that we actually found one
            Debug.Assert(foundOperator);
            // if we found the operator, it means we also know its position number.
            Debug.Assert(operatorTokenNumber >= previousChild.Position.endTokenNumber);
            Debug.Assert(operatorTokenNumber < nextChild.Position.startTokenNumber);
            // and we know its type
            Debug.Assert(
                binaryOperatorTokenID == FormatterTokens.TOKEN_UNION ||
                binaryOperatorTokenID == FormatterTokens.TOKEN_INTERSECT ||
                binaryOperatorTokenID == FormatterTokens.TOKEN_EXCEPT);
            #endregion

            // process the tokens before the operator:
            // [lastChild.Position.endTokenNumber, operatorTokenNumber)
            #region BeforeOperator

            // If the first token is not a whitespace and it, we need to insert a newline in front
            TokenData endTokenData = GetTokenData(previousChild.Position.endTokenNumber);
            if (!IsTokenWhitespace(endTokenData))
            {
                AddIndentedNewLineReplacement(endTokenData.StartIndex);
            }

            for (int i = previousChild.Position.endTokenNumber; i < operatorTokenNumber - 1; i++)
            {
                SimpleProcessToken(i, FormatterUtilities.NormalizeNewLinesEnsureOneNewLineMinimum);
            }

            if (CodeObject.Left is SqlQuerySpecification)
            {
                DecrementIndentLevel();
            }

            if (operatorTokenNumber - 1 >= previousChild.Position.endTokenNumber)
            {
                SimpleProcessToken(operatorTokenNumber - 1, FormatterUtilities.NormalizeNewLinesEnsureOneNewLineMinimum);
                if (!IsTokenWhitespace(PreviousTokenData(operatorTokenNumber)))
                {
                    TokenData td = GetTokenData(operatorTokenNumber);
                    AddIndentedNewLineReplacement(td.StartIndex);
                }
            }

            #endregion // BeforeOperator

            // process the operator:
            // [operatorTokenNumber, firstTokenAfterOperator)
            #region Operator

            // since the operator might contain more than one token, we will keep track of its end
            int firstTokenAfterOperator = operatorTokenNumber + 1;

            // find where the operator ends
            if (binaryOperatorTokenID == FormatterTokens.TOKEN_UNION)
            {
                // the union operator may or may not be followed by the "ALL" modifier, so it might span over a number of tokens
                bool foundModifier       = false;
                int  modifierTokenNumber = nextChild.Position.startTokenNumber;

                for (int i = operatorTokenNumber; !foundModifier && i < nextChild.Position.startTokenNumber; i++)
                {
                    if (GetTokenData(i).TokenId == FormatterTokens.TOKEN_ALL)
                    {
                        foundModifier       = true;
                        modifierTokenNumber = i;
                    }
                }

                if (foundModifier)
                {
                    // leave everythong between "UNION" and "ALL" just as it was, but format the keywords
                    firstTokenAfterOperator = modifierTokenNumber + 1;
                }
            }
            else
            {
                // only format the operator
                firstTokenAfterOperator = operatorTokenNumber + 1;
            }

            ProcessTokenRange(operatorTokenNumber, firstTokenAfterOperator);

            #endregion // Operator

            // process tokens after the operator:
            // [firstTokenAfterOperator, nextChild.Position.startTokenNumber)
            #region AfterOperator

            if (CodeObject.Right is SqlQuerySpecification)
            {
                IncrementIndentLevel();
            }

            // if the first token is not a whitespace, we need to insert a newline in front
            if (!TokenManager.IsTokenWhitespace(TokenManager.TokenList[firstTokenAfterOperator].TokenId))
            {
                TokenData td = GetTokenData(firstTokenAfterOperator);
                AddIndentedNewLineReplacement(td.StartIndex);
            }

            for (int i = firstTokenAfterOperator; i < nextChild.Position.startTokenNumber; i++)
            {
                SimpleProcessToken(i, FormatterUtilities.NormalizeNewLinesEnsureOneNewLineMinimum);
            }

            #endregion // AfterOperator
        }
Exemplo n.º 20
0
 private static bool IsPartialQuery(SqlCodeObject sqlQuery)
 {
     return(sqlQuery is SqlViewDefinition ||
            sqlQuery is SqlCommonTableExpression ||
            sqlQuery is SqlScalarSubQueryExpression);
 }
Exemplo n.º 21
0
 internal PaddedSpaceSeparatedListFormatter(FormatterVisitor visitor, SqlCodeObject codeObject, List <ColumnSpacingFormatDefinition> spacingDefinitions, bool incrementIndentLevelOnPrefixRegion)
     : base(visitor, codeObject, incrementIndentLevelOnPrefixRegion)
 {
     ColumnSpacingDefinitions = spacingDefinitions;
 }
 internal override void ProcessChild(SqlCodeObject child)
 {
     CommaSeparatedListFormatter.ProcessChild(child);
 }
Exemplo n.º 23
0
        public void ExecuteStatement(MemoryDbCommand command, SqlCodeObject child)
        {
            switch (child)
            {
            case SqlCreateTableStatement createTable:
                new CreateTable(createTable).AddToDatabase(this, (MemoryDbConnection)(command.Connection));
                break;

            case SqlInsertStatement insertStatement:
                new ExecuteNonQueryStatement(this, command).Execute(Tables, insertStatement);
                break;

            case SqlUpdateStatement updateStatement:
                new ExecuteUpdateStatement(this, command).Execute(Tables, updateStatement);
                break;

            case SqlNullStatement nullStatement:
                new ExecuteNullStatement(this, command).Execute(Tables, nullStatement);
                break;

            case SqlIfElseStatement ifElseStatement:
                new ExecuteNonQueryStatement(this, command).Execute(Tables, ifElseStatement);
                break;

            case SqlDeleteStatement deleteStatement:
                new ExecuteNonQueryStatement(this, command).Execute(Tables, deleteStatement);
                break;

            case SqlSelectStatement selectStatement:
                new ExecuteQueryStatement(this, command).Execute(Tables, selectStatement, command.DataReader);
                break;

            case SqlCompoundStatement compoundStatement:
                foreach (var compoundChild in compoundStatement.Children)
                {
                    ExecuteStatement(command, compoundChild);
                }
                break;

            case SqlVariableDeclareStatement variableDeclaration:
                AddVariable(command, variableDeclaration);
                break;

            case SqlSetAssignmentStatement assignment:
                SetVariable(command, assignment);
                break;

            case SqlCreateProcedureStatement createProcedure:
            {
                new ExecuteProcedure(this, command).Execute(createProcedure);
                break;
            }

            case SqlAlterProcedureStatement alterProcedure:
            {
                new ExecuteProcedure(this, command).Execute(alterProcedure);
                break;
            }

            case SqlDropProcedureStatement dropProcedure:
            {
                new ExecuteProcedure(this, command).Execute(dropProcedure);
                break;
            }

            case SqlExecuteModuleStatement executeModule:
            {
                new ExecuteProcedure(this, command).Execute(executeModule);
                break;
            }

            case SqlCreateIndexStatement createIndex:
            case SqlDropExistingIndexOption dropIndex:
            {
                // We will never implement this and function without it
                break;
            }

            case SqlCreateViewStatement createView:
            {
                new ExecuteView(this, command).Execute(createView);
                break;
            }

            case SqlDropViewStatement dropView:
            {
                new ExecuteView(this, command).Execute(dropView);
                break;
            }

            case SqlAlterViewStatement alterView:
            {
                new ExecuteView(this, command).Execute(alterView);
                break;
            }

            case SqlCreateUserDefinedDataTypeStatement createUserDefinedDataType:
            {
                AddUserDefinedDataType(createUserDefinedDataType);
                break;
            }

            default:
                throw new NotImplementedException($"Statements of type {child.GetType(  )} are not implemented yet");
            }
        }
        internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
        {
            Validate.IsNotNull(nameof(previousChild), previousChild);
            Validate.IsNotNull(nameof(nextChild), nextChild);

            if (previousChild is SqlObjectIdentifier && nextChild is SqlTableDefinition)
            {
                //
                // We want to make sure that the open-paren is on a new line and followed by a new-line & correctly indented.
                //

                // find the open paren token
                int openParenToken = -1;
                for (int i = previousChild.Position.endTokenNumber; i < nextChild.Position.startTokenNumber; i++)
                {
                    TokenData currentToken = TokenManager.TokenList[i];
                    if (currentToken.TokenId == 40)
                    {
                        openParenToken = i;
                        break;
                    }
                }



                // normalize whitespace between last token & open paren.  Each whitespace token should be condensed down to a single space character
                for (int i = previousChild.Position.endTokenNumber; i < openParenToken - 1; i++)
                {
                    SimpleProcessToken(i, FormatterUtilities.NormalizeToOneSpace);
                }

                // If there is a whitespace before the open parenthisis, normalize it to a new line
                TokenData td = TokenManager.TokenList[openParenToken - 1];

                if (TokenManager.IsTokenWhitespace(td.TokenId))
                {
                    if (previousChild.Position.endTokenNumber < openParenToken)
                    {
                        SimpleProcessToken(openParenToken - 1, FormatterUtilities.NormalizeNewLinesInWhitespace);
                    }
                }
                else
                {
                    if (previousChild.Position.endTokenNumber < openParenToken)
                    {
                        SimpleProcessToken(openParenToken - 1, FormatterUtilities.NormalizeToOneSpace);
                    }
                    TokenData tok = TokenManager.TokenList[openParenToken];
                    AddIndentedNewLineReplacement(tok.StartIndex);
                }

                // append open-paren token
                ProcessTokenRange(openParenToken, openParenToken + 1);

                // process tokens between open paren & first child start
                IncrementIndentLevel();
                for (int i = openParenToken + 1; i < nextChild.Position.startTokenNumber; i++)
                {
                    SimpleProcessToken(i, FormatterUtilities.NormalizeNewLinesInWhitespace);
                }

                // ensure we have at least one new line
                if (openParenToken + 1 >= nextChild.Position.startTokenNumber || !TokenManager.IsTokenWhitespace(TokenManager.TokenList[nextChild.Position.startTokenNumber - 1].TokenId))
                {
                    TokenData tok = TokenManager.TokenList[nextChild.Position.startTokenNumber];
                    AddIndentedNewLineReplacement(tok.StartIndex);
                }
                DecrementIndentLevel();
            }
            else
            {
                ProcessTokenRange(previousChild.Position.endTokenNumber, nextChild.Position.startTokenNumber);
            }
        }
Exemplo n.º 25
0
 internal virtual void ProcessChild(SqlCodeObject child)
 {
     Validate.IsNotNull(nameof(child), child);
     child.Accept(Visitor);
 }
 internal static LexLocation GetLexLocationForNode(SqlCodeObject obj)
 {
     return(obj.Position);
 }