本文整理汇总了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
{
示例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 '(':
示例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)
{