本文整理汇总了C#中IParser.MoveNext方法的典型用法代码示例。如果您正苦于以下问题:C# IParser.MoveNext方法的具体用法?C# IParser.MoveNext怎么用?C# IParser.MoveNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParser
的用法示例。
在下文中一共展示了IParser.MoveNext方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnumerationOf
private IEnumerable<ParsingEvent> EnumerationOf(IParser parser)
{
while (parser.MoveNext())
{
yield return parser.Current;
}
}
示例2: ReadYaml
public object ReadYaml(IParser parser, Type type)
{
var scalar = (YamlDotNet.Core.Events.Scalar)parser.Current;
var bytes = Convert.FromBase64String(scalar.Value);
parser.MoveNext();
return bytes;
}
示例3: ReadYaml
public object ReadYaml(IParser parser, Type type)
{
var value = ((Scalar)parser.Current).Value;
parser.MoveNext();
return DateTime.Parse(value);
}
示例4: ReadYaml
public object ReadYaml(IParser parser, Type type) {
var current = parser.Current;
parser.MoveNext();
if (type!=typeof(Regex)) return null;
if (current.Type!=EventType.Scalar) return null;
var scalar = (Scalar) current;
if (!isRegexLiteral(scalar.Value)) return null;
return new Regex(@"\b"+scalar.Value.Trim('/')[email protected]"\b");
}
示例5: InvalidOperationException
/// <summary>
/// Reads this object's state from a YAML parser.
/// </summary>
/// <param name="parser"></param>
void IYamlSerializable.ReadYaml(IParser parser)
{
events.Clear();
int depth = 0;
do
{
if (!parser.MoveNext())
{
throw new InvalidOperationException("The parser has reached the end before deserialization completed.");
}
events.Add(parser.Current);
depth += parser.Current.NestingIncrease;
} while (depth > 0);
Debug.Assert(depth == 0);
}
示例6: AssertSequenceOfEventsFrom
private void AssertSequenceOfEventsFrom(IParser parser, params ParsingEvent[] events)
{
var eventNumber = 1;
foreach (var expected in events)
{
parser.MoveNext().Should().BeTrue("Missing parse event number {0}", eventNumber);
AssertEvent(expected, parser.Current, eventNumber);
eventNumber++;
}
parser.MoveNext().Should().BeFalse("Found extra parse events");
}
示例7: AssertHasNext
private void AssertHasNext(IParser parser)
{
Assert.True(parser.MoveNext());
}
示例8: AssertDoesNotHaveNext
private void AssertDoesNotHaveNext(IParser parser)
{
Assert.False(parser.MoveNext());
}
示例9: ReadYaml
public object ReadYaml(IParser parser, Type type)
{
var version = ((Scalar)parser.Current).Value;
parser.MoveNext();
return string.IsNullOrEmpty(version) ? null : new System.Version(version);
}