本文整理汇总了C#中Scope.IndentNonRoot方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.IndentNonRoot方法的具体用法?C# Scope.IndentNonRoot怎么用?C# Scope.IndentNonRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.IndentNonRoot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static BracesToken Parse(Token parent, Scope scope)
{
var startPos = scope.File.Position;
scope.File.MoveNext();
var indentScope = scope.IndentNonRoot();
indentScope.Hint |= ScopeHint.SuppressFunctionDefinition;
var retToken = new BracesToken(parent, scope, new Span(startPos, startPos));
retToken._openToken = new BraceToken(retToken, scope, new Span(startPos, scope.File.Position), retToken, true);
retToken._tokens.Add(retToken._openToken);
var closeToken = null as Token;
var done = false;
while (!scope.File.EndOfFile && !done)
{
var token = scope.File.ParseToken(retToken, indentScope);
if (token == null) break;
if (token.GetType() == typeof(OperatorToken) && (token as OperatorToken).Text == "}")
{
retToken._closeToken = new BraceToken(retToken, scope, token.Span, retToken, false);
retToken._tokens.Add(retToken._closeToken);
done = true;
}
else
{
retToken._tokens.Add(token);
}
}
retToken.Span = new Span(startPos, scope.File.Position);
return retToken;
}
示例2: Parse
public static ArrayBracesToken Parse(Token parent, Scope scope)
{
var startPos = scope.File.Position;
scope.File.MoveNext();
var ret = new ArrayBracesToken(parent, scope, new Span(startPos, startPos));
ret._openToken = new ArrayBraceToken(ret, scope, new Span(startPos, scope.File.Position), ret, true);
ret._tokens.Add(ret._openToken);
var closeToken = null as Token;
var scopeIndent = scope.IndentNonRoot();
scopeIndent.Hint |= ScopeHint.SuppressFunctionDefinition | ScopeHint.SuppressVarDecl;
var done = false;
while (!scope.File.EndOfFile && !done)
{
var token = scope.File.ParseToken(ret, scopeIndent);
if (token == null) break;
if (token.GetType() == typeof(OperatorToken) && (token as OperatorToken).Text == "]")
{
ret._closeToken = new ArrayBraceToken(ret, scope, token.Span, ret, false);
ret._tokens.Add(ret._closeToken);
done = true;
}
else if (token.BreaksStatement)
{
scope.File.Position = token.Span.Start;
done = true;
}
else
{
ret._tokens.Add(token);
}
}
ret.Span = new Span(startPos, scope.File.Position);
return ret;
}
示例3: Parse
public static BracketsToken Parse(Token parent, Scope scope)
{
var file = scope.File;
var startPos = file.Position;
file.MoveNext();
var scopeIndent = scope.IndentNonRoot();
scopeIndent.Hint |= ScopeHint.SuppressVarDecl | ScopeHint.SuppressFunctionDefinition | ScopeHint.SuppressFunctionCall;
var retToken = new BracketsToken(parent, scope, new Span(startPos, startPos));
retToken._openToken = new BracketToken(retToken, scope, new Span(startPos, file.Position), retToken, true);
retToken._tokens.Add(retToken._openToken);
var closeToken = null as Token;
var done = false;
while (!file.EndOfFile && !done)
{
var token = file.ParseToken(retToken, scopeIndent);
if (token != null)
{
if (token.GetType() == typeof(OperatorToken) && token.Text == ")")
{
retToken._closeToken = new BracketToken(retToken, scope, token.Span, retToken, false);
retToken._tokens.Add(retToken._closeToken);
done = true;
}
else
{
retToken._tokens.Add(token);
}
}
}
retToken.Span = new Span(startPos, file.Position);
return retToken;
}