本文整理汇总了C#中Lexer.HasOwnership方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.HasOwnership方法的具体用法?C# Lexer.HasOwnership怎么用?C# Lexer.HasOwnership使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer
的用法示例。
在下文中一共展示了Lexer.HasOwnership方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Detect
internal override void Detect(Lexer l)
{
if (l.Text.TrimStart().StartsWith("using ") && !l.HasOwnership())
l.TakeOwnership();
else if (l.HasOwnership() && l.Char == ';')
{
l.AddNode(new UsingNode(l.Text.Substring("using ".Length, l.Text.Length - "using ".Length - 1)));
l.EndOwnership();
}
else if (!l.HasOwnership() && !"using ".StartsWith(l.Text.TrimStart()))
l.ForceExclude();
}
示例2: Detect
internal override void Detect(Lexer l)
{
if (l.Text.TrimStart().StartsWith("#") &&
(l.MatchNext(" ") || l.MatchNext("\n")) &&
l.Text != "#import" &&
l.Text != "#include")
l.TakeOwnership();
else if (!l.Text.TrimStart().StartsWith("#") || l.Text == "#import" || l.Text == "#include")
l.ForceExclude();
if (l.HasOwnership())
{
if (l.Char == '\\' && l.MatchNext("\n"))
{
this.m_KeepOwnership = true;
}
else if (l.Char == '\n' && !this.m_KeepOwnership)
{
l.AddNode(new DirectNode(l.Text));
l.EndOwnership();
}
else if (this.m_KeepOwnership)
this.m_KeepOwnership = false;
}
}
示例3: Detect
internal override void Detect(Lexer l)
{
if (l.Text.TrimStart().StartsWith("class ") && !l.HasOwnership())
l.TakeOwnership();
else if (!l.HasOwnership() && !"class ".StartsWith(l.Text.TrimStart()))
l.ForceExclude();
if (l.HasOwnership())
{
if (l.Char == '{')
{
string n = l.Text.TrimStart().Substring("class ".Length, l.Text.TrimStart().Length - "class ".Length - 1);
Regex r = new Regex("[ \n\r]as[ \n\r]", RegexOptions.Multiline);
Match m = r.Match(n);
if (m.Success)
{
l.AddNode(new ClassDefinitionNode(
n.Substring(0, m.Index),
n.Substring(m.Index + m.Length)
));
}
else
{
l.AddNode(new ClassDefinitionNode(
n,
""
));
}
l.AddParent();
l.EndOwnership();
}
else if (l.Char == ';')
{
l.AddNode(new DirectNode(l.Text.Substring(0, l.Text.Length - 1)));
l.EndOwnership();
}
}
}
示例4: Detect
internal override void Detect(Lexer l)
{
if (l.Text == "#include")
l.TakeOwnership();
else if (!l.Text.TrimStart().StartsWith("#"))
l.ForceExclude();
if (l.HasOwnership())
{
if (l.Char == '\\' && l.MatchNext("\n"))
{
this.m_KeepOwnership = true;
}
else if (l.Char == '\n' && !this.m_KeepOwnership)
{
l.AddNode(new IncludeNode(l.Text.Substring("#include".Length).Trim()));
l.EndOwnership();
}
else if (this.m_KeepOwnership)
this.m_KeepOwnership = false;
}
}