本文整理汇总了C#中Scope.Indent方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.Indent方法的具体用法?C# Scope.Indent怎么用?C# Scope.Indent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.Indent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static ReplaceSetToken Parse(Token parent, Scope scope, PreprocessorToken replaceToken)
{
#if DEBUG
if (replaceToken == null) throw new ArgumentNullException("replaceToken");
#endif
var file = scope.File;
var startPos = replaceToken.Span.Start;
var scopeIndent = scope.Indent();
var ret = new ReplaceSetToken(parent, scope, new Span(startPos, startPos));
ret._replaceToken = new ReplaceToken(ret, scope, replaceToken.Span, ret);
ret._tokens.Add(ret._replaceToken);
var done = false;
while (!file.EndOfFile && !done)
{
var token = file.ParseToken(ret, scopeIndent);
if (token == null) break;
if (token.GetType() == typeof(PreprocessorToken))
{
if ((token as PreprocessorToken).Text == "#with" && ret._withToken == null)
{
ret._withToken = new ReplaceToken(ret, scope, token.Span, ret);
ret._tokens.Add(ret._withToken);
}
else if ((token as PreprocessorToken).Text == "#endreplace")
{
ret._endReplaceToken = new ReplaceToken(ret, scope, token.Span, ret);
ret._tokens.Add(ret._endReplaceToken);
done = true;
}
else
{
ret._tokens.Add(token);
if (ret._withToken == null) ret._oldTokens.Add(token);
else ret._newTokens.Add(token);
}
}
else
{
ret._tokens.Add(token);
if (ret._withToken == null) ret._oldTokens.Add(token);
else ret._newTokens.Add(token);
}
}
ret.Span = new Span(startPos, file.Position);
return ret;
}
示例2: Parse
public static Token Parse(Token parent, Scope scope, PreprocessorToken insertToken)
{
var ret = new InsertToken(parent, scope);
var scopeIndent = scope.Indent();
var tokens = new List<Token>();
tokens.Add(ret._startToken = new InsertBoundaryToken(ret, scope, insertToken.Span, true));
while (true)
{
var token = scope.File.ParseToken(parent, scopeIndent);
if (token == null) break;
if (token.GetType() == typeof(PreprocessorToken) && token.Text == "#endinsert")
{
tokens.Add(ret._endToken = new InsertBoundaryToken(ret, scope, token.Span, false));
break;
}
else tokens.Add(token);
}
ret._tokens = tokens.ToArray();
ret.Span = new Span(ret._tokens.First().Span.Start, ret._tokens.Last().Span.End);
return ret;
}