当前位置: 首页>>代码示例>>C#>>正文


C# Block.ResetOneLineBlock方法代码示例

本文整理汇总了C#中Block.ResetOneLineBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Block.ResetOneLineBlock方法的具体用法?C# Block.ResetOneLineBlock怎么用?C# Block.ResetOneLineBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


在下文中一共展示了Block.ResetOneLineBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Step


//.........这里部分代码省略.........
                        _wordBuilder.Clear();
                    }

                    continue;
                }

                if (!Char.IsWhiteSpace(currentChar) && currentChar != '[' && currentChar != '/')
                {
                    if (_block.Bracket == '{')
                    {
                        // The current line potentially contains a statement. If the statement
                        // is not completed in this line, it the next line is a continuation.
                        _block.Continuation = true;
                    }
                }

                if (Char.IsLetterOrDigit(currentChar))
                {
                    _wordBuilder.Append(currentChar);
                }
                else
                {
                    if (_wordBuilder.Length > 0)
                    {
                        _block.LastWord = _wordBuilder.ToString();
                        _wordBuilder.Clear();
                    }
                }

                // ----- Push/pop the blocks.
                switch (currentChar)
                {
                    case '{':
                        _block.ResetOneLineBlock();
                        _blocks.Push(_block);
                        _block.StartLine = doc.LineNumber;
                        if (_block.LastWord == "switch")
                        {
                            _block.Indent(settings.IndentString + settings.IndentString);
                            /* oldBlock refers to the previous line, not the previous block
                             * The block we want is not available anymore because it was never pushed.
                             * } else if (oldBlock.OneLineBlock) {
                            // Inside a one-line-block is another statement
                            // with a full block: indent the inner full block
                            // by one additional level
                            block.Indent(settings, settings.IndentString + settings.IndentString);
                            block.OuterIndent += settings.IndentString;
                            // Indent current line if it starts with the '{' character
                            if (i == 0) {
                              oldBlock.InnerIndent += settings.IndentString;
                            }*/
                        }
                        else
                        {
                            if (i == line.Length - 1)
                            {
                                // Example:
                                //
                                //   if (condition) {
                                //                  ^
                                //                 HERE
                                //
                                _block.Indent(settings.IndentString);
                            }
                            else
                            {
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:67,代码来源:CSharpIndentationReformatter.cs

示例2: Step


//.........这里部分代码省略.........
                            inChar = !inChar;
                        }
                        break;
                    case '\\':
                        if ((inString && !verbatim) || inChar)
                            escape = true; // skip next character
                        break;
                }
                #endregion

                if (lineComment || blockComment || inString || inChar) {
                    if (wordBuilder.Length > 0)
                        block.LastWord = wordBuilder.ToString();
                    wordBuilder.Length = 0;
                    continue;
                }

                if (!Char.IsWhiteSpace(c) && c != '[' && c != '/') {
                    if (block.Bracket == '{')
                        block.Continuation = true;
                }

                if (Char.IsLetterOrDigit(c)) {
                    wordBuilder.Append(c);
                } else {
                    if (wordBuilder.Length > 0)
                        block.LastWord = wordBuilder.ToString();
                    wordBuilder.Length = 0;
                }

                #region Push/Pop the blocks
                switch (c) {
                    case '{':
                        block.ResetOneLineBlock();
                        blocks.Push(block);
                        block.StartLine = doc.LineNumber;
                        if (block.LastWord == "switch") {
                            block.Indent(set.IndentString + set.IndentString);
                            /* oldBlock refers to the previous line, not the previous block
                             * The block we want is not available anymore because it was never pushed.
                             * } else if (oldBlock.OneLineBlock) {
                            // Inside a one-line-block is another statement
                            // with a full block: indent the inner full block
                            // by one additional level
                            block.Indent(set, set.IndentString + set.IndentString);
                            block.OuterIndent += set.IndentString;
                            // Indent current line if it starts with the '{' character
                            if (i == 0) {
                                oldBlock.InnerIndent += set.IndentString;
                            }*/
                        } else {
                            block.Indent(set);
                        }
                        block.Bracket = '{';
                        break;
                    case '}':
                        while (block.Bracket != '{') {
                            if (blocks.Count == 0) break;
                            block = blocks.Pop();
                        }
                        if (blocks.Count == 0) break;
                        block = blocks.Pop();
                        block.Continuation = false;
                        block.ResetOneLineBlock();
                        break;
                    case '(':
开发者ID:Amichai,项目名称:PhysicsPad,代码行数:67,代码来源:IndentationReformatter.cs

示例3: Step


//.........这里部分代码省略.........
                         {
                             switch (c4)
                             {
                                 case '(':
                                     goto IL_671;
                                 case ')':
                                     if (_blocks.Count == 0)
                                     {
                                         goto IL_873;
                                     }
                                     if (_block.Bracket == '(')
                                     {
                                         _block = _blocks.Pop();
                                         if (IsSingleStatementKeyword(_block.LastWord))
                                         {
                                             _block.Continuation = false;
                                         }
                                     }
                                     goto IL_873;
                                 case '*':
                                 case '+':
                                     goto IL_873;
                                 case ',':
                                     break;
                                 default:
                                     switch (c4)
                                     {
                                         case ':':
                                             if (_block.LastWord == "case" ||
                                                 text.StartsWith("case ", StringComparison.Ordinal) ||
                                                 text.StartsWith(_block.LastWord + ":", StringComparison.Ordinal))
                                             {
                                                 _block.Continuation = false;
                                                 _block.ResetOneLineBlock();
                                             }
                                             goto IL_873;
                                         case ';':
                                             break;
                                         default:
                                             goto IL_873;
                                     }
                                     break;
                             }
                             _block.Continuation = false;
                             _block.ResetOneLineBlock();
                         }
                         else
                         {
                             switch (c4)
                             {
                                 case '[':
                                     goto IL_671;
                                 case '\\':
                                     break;
                                 case ']':
                                     if (_blocks.Count != 0)
                                     {
                                         if (_block.Bracket == '[')
                                         {
                                             _block = _blocks.Pop();
                                         }
                                     }
                                     break;
                                 default:
                                     switch (c4)
                                     {
开发者ID:mookiejones,项目名称:miEditor,代码行数:67,代码来源:IndentationClass.cs


注:本文中的Block.ResetOneLineBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。