本文整理汇总了C#中TidyNet.Lexer.DeferDup方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.DeferDup方法的具体用法?C# Lexer.DeferDup怎么用?C# Lexer.DeferDup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TidyNet.Lexer
的用法示例。
在下文中一共展示了Lexer.DeferDup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public virtual void Parse(Lexer lexer, Node table, short mode)
{
Node node, parent;
int istackbase;
TagTable tt = lexer.Options.tt;
lexer.DeferDup();
istackbase = lexer.istackbase;
lexer.istackbase = lexer.istack.Count;
while (true)
{
node = lexer.GetToken(Lexer.IgnoreWhitespace);
if (node == null)
break;
if (node.Tag == table.Tag && node.Type == Node.EndTag)
{
lexer.istackbase = istackbase;
table.Closed = true;
Node.TrimEmptyElement(lexer, table);
return;
}
/* deal with comments etc. */
if (Node.InsertMisc(table, node))
continue;
/* discard unknown tags */
if (node.Tag == null && node.Type != Node.TextNode)
{
Report.Warning(lexer, table, node, Report.DISCARDING_UNEXPECTED);
continue;
}
/* if TD or TH or text or inline or block then infer <TR> */
if (node.Type != Node.EndTag)
{
if (node.Tag == tt.TagTd || node.Tag == tt.TagTh || node.Tag == tt.tagTable)
{
lexer.UngetToken();
node = lexer.InferredTag("tr");
Report.Warning(lexer, table, node, Report.MISSING_STARTTAG);
}
else if (node.Type == Node.TextNode || (node.Tag.Model & (ContentModel.Block | ContentModel.Inline)) != 0)
{
Node.InsertNodeBeforeElement(table, node);
Report.Warning(lexer, table, node, Report.TAG_NOT_ALLOWED_IN);
lexer.exiled = true;
/* AQ: TODO
Line 2040 of parser.c (13 Jan 2000) reads as follows:
if (!node->type == TextNode)
This will always evaluate to false.
This has been reported to Dave Raggett <[email protected].org>
*/
//Should be?: if (!(node.Type == Node.TextNode))
// if (false)
// TidyNet.ParserImpl.parseTag(lexer, node, Lexer.IgnoreWhitespace);
lexer.exiled = false;
continue;
}
else if ((node.Tag.Model & ContentModel.Head) != 0)
{
TidyNet.ParserImpl.moveToHead(lexer, table, node);
continue;
}
}
/*
if this is the end tag for an ancestor element
then infer end tag for this element
*/
if (node.Type == Node.EndTag)
{
if (node.Tag == tt.TagForm)
{
lexer.badForm = 1;
Report.Warning(lexer, table, node, Report.DISCARDING_UNEXPECTED);
continue;
}
if (node.Tag != null && (node.Tag.Model & (ContentModel.Table | ContentModel.Row)) != 0)
{
Report.Warning(lexer, table, node, Report.DISCARDING_UNEXPECTED);
continue;
}
for (parent = table.Parent; parent != null; parent = parent.Parent)
{
if (node.Tag == parent.Tag)
{
Report.Warning(lexer, table, node, Report.MISSING_ENDTAG_BEFORE);
lexer.UngetToken();
lexer.istackbase = istackbase;
Node.TrimEmptyElement(lexer, table);
return;
}
}
//.........这里部分代码省略.........