本文整理汇总了C#中Token.MoveToContent方法的典型用法代码示例。如果您正苦于以下问题:C# Token.MoveToContent方法的具体用法?C# Token.MoveToContent怎么用?C# Token.MoveToContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token.MoveToContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Parse
// Methods
public static new JSONNull Parse(Token token)
{
token.MoveToContent();
if (token.Peeks("null"))
{
token.Skip(4);
return JSONValue.Null;
}
return null;
}
示例3: Parse
public static new JSONBoolean Parse(Token token)
{
token.MoveToContent();
if (token.Peeks("true"))
{
token.Skip("true");
return new JSONBoolean(true);
}
if (token.Peeks("false"))
{
token.Skip("false");
return new JSONBoolean(false);
}
return null;
}
示例4: Parse
public static new JSONNumber Parse(Token token)
{
token.MoveToContent();
if (_validChars.Contains<char>(token.Current))
{
var builder = new StringBuilder();
while (_validChars.Contains<char>(token.Current))
{
builder.Append(token.Current);
token.Next();
}
var value = builder.ToString();
return new JSONNumber(value, value.Contains('.'));
}
return null;
}
示例5: 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(">");
}
示例6: 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;
}
}
}