本文整理汇总了C#中Reader.ReadNextForm方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.ReadNextForm方法的具体用法?C# Reader.ReadNextForm怎么用?C# Reader.ReadNextForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader.ReadNextForm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapFormReader
public static object MapFormReader(TextReader stream, Reader reader)
{
char cur;
if (!(PeekChar(stream, out cur) && cur == '{')) {
return null;
}
NLMap map = new NLMap();
SkipChar(stream);
do {
object[] pair = { null, null };
SkipWhitespace(stream);
if (Empty(stream)) {
throw new ReaderException("Unterminated map!");
}
PeekChar(stream, out cur);
if (cur == '}') {
break;
}
pair[0] = reader.ReadNextForm(stream);
if (pair[0] == null) {
throw new ReaderException("Unreadable form in map!");
}
SkipWhitespace(stream);
if (Empty(stream)) {
throw new ReaderException("Unterminated map!");
}
pair[1] = reader.ReadNextForm(stream);
if (pair[1] == null) {
throw new ReaderException("Unreadable form in map!");
}
SkipWhitespace(stream);
if (Empty(stream)) {
throw new ReaderException("Unterminated map!");
}
map.Assoc(pair[0], pair[1]);
} while (PeekChar(stream, out cur) && cur != '}');
SkipChar(stream);
return map;
}
示例2: FlatCollectionFormReader
public static IFlatCollection FlatCollectionFormReader(TextReader stream, Reader reader, char open, char close, FormFactory factory)
{
char cur;
if (!(PeekChar(stream, out cur) && cur == open)) {
return null;
}
IFlatCollection coll = factory();
SkipChar(stream);
do {
SkipWhitespace(stream);
object form = reader.ReadNextForm(stream);
if (form != null) {
coll.Append(form);
}
SkipWhitespace(stream);
if (Empty(stream)) {
throw new ReaderException("Unterminated vector!");
}
} while (PeekChar(stream, out cur) && cur != close);
SkipChar(stream);
return coll;
}