本文整理汇总了C#中Token.MovePast方法的典型用法代码示例。如果您正苦于以下问题:C# Token.MovePast方法的具体用法?C# Token.MovePast怎么用?C# Token.MovePast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token.MovePast方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static new JSONString Parse(Token token)
{
StringBuilder builder = new StringBuilder();
token.MoveToContent();
if (!token.Peeks("\""))
{
return null;
}
token.MovePast("\"");
while (!token.Peeks("\""))
{
if (token.Peeks("\\\""))
{
builder.Append("\"");
token.Skip(2);
}
else
{
builder.Append(token.Current);
token.Skip(1);
}
}
token.MovePast("\"");
return new JSONString(builder.ToString());
}
示例2: CssRule
public CssRule(Token token)
{
_selectorStacks = new List<CssSelectorStack>();
_statements = new List<CssStatement>();
string data = token.ReadUntil('{');
token.MovePast("{");
foreach (var stack in data.Split(',').Select(CssSelectorStack.Parse).Where(stack => stack != null))
_selectorStacks.Add(stack);
var statements = token.ReadUntil('}').Split(';').Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
foreach (string statement in statements)
{
_statements.Add(new CssStatement(statement));
}
token.MovePast("}");
}
示例3: HtmlTag
public HtmlTag(Token token)
{
token.Next();
Name = token.ReadUntil(' ', '/', '>');
ReadAttributes(token);
Attributes.Changed += OnAttributesChanged;
_styles = new HtmlStyleCollection();
_styles.Changed += OnStylesChanged;
UpdateStyles();
token.MoveToContent();
Closed = token.Peeks('/');
token.MovePast(">");
}
示例4: ReadAttributes
protected void ReadAttributes(Token token)
{
var done = false;
while (!done)
{
token.MoveToContent();
if (token.Peeks("/>") || token.Peeks(">") || token.IsDone)
done = true;
else
{
string attributeName = token.ReadUntil(' ', '=');
token.MovePast("=");
token.MoveToContent();
string attributeValue;
if (token.Current == '\'' || token.Current == '"')
{
char delimiter = token.Current;
token.Next();
attributeValue = token.ReadUntil(delimiter);
token.Next();
}
else
attributeValue = token.ReadUntil(' ', '/', '>');
_attributes[attributeName] = attributeValue;
}
}
}
示例5: HtmlEndTag
public HtmlEndTag(Token token)
{
token.MovePast("</");
TagName = token.ReadUntil(">").ToLower();
token.MovePast(">");
}