public virtual Node InsertedToken()
{
Node node;
int n;
// this will only be null if inode != null
if (Insert == - 1)
{
node = Inode;
Inode = null;
return node;
}
// is this is the "latest" node then update
// the position, otherwise use current values
if (Inode == null)
{
Lines = Input.CursorLine;
Columns = Input.CursorColumn;
}
node = NewNode(Node.START_TAG, Lexbuf, Txtstart, Txtend); // GLP: Bugfix 126261. Remove when this change
// is fixed in istack.c in the original Tidy
node.Isimplicit = true;
InlineStack stack = (Istack.ToArray())[Istack.Count - (Insert + 1)];
node.Element = stack.Element;
node.Tag = stack.Tag;
if (stack.Attributes != null)
{
node.Attributes = CloneAttributes(stack.Attributes);
}
// advance lexer to next item on the stack
n = Insert;
// and recover state if we have reached the end
if (++n < Istack.Count)
{
Insert = n;
}
else
{
Insert = - 1;
}
return node;
}