本文整理汇总了C#中Symbol.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.Expect方法的具体用法?C# Symbol.Expect怎么用?C# Symbol.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol.Expect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseAugments
private static string ParseAugments(IEnumerator<Symbol> enumerator, ref Symbol temp)
{
string augment = null;
if (temp == Symbol.Augments)
{
temp = enumerator.NextNonEOLSymbol();
temp.Expect(Symbol.OpenBracket);
temp = enumerator.NextNonEOLSymbol();
augment = temp.ToString();
temp = enumerator.NextNonEOLSymbol();
temp.Expect(Symbol.CloseBracket);
temp = enumerator.NextNonEOLSymbol();
}
return augment;
}
示例2: ParseDefVal
private static Symbol ParseDefVal(IEnumerator<Symbol> enumerator, ref Symbol temp)
{
Symbol defVal = null;
if (temp == Symbol.DefVal)
{
temp = enumerator.NextNonEOLSymbol();
temp.Expect(Symbol.OpenBracket);
temp = enumerator.NextNonEOLSymbol();
if (temp == Symbol.OpenBracket)
{
var depth = 1;
// TODO: decode this.
while (depth > 0)
{
temp = enumerator.NextNonEOLSymbol();
if (temp == Symbol.OpenBracket)
{
depth++;
}
else if (temp == Symbol.CloseBracket)
{
depth--;
}
}
}
else
{
defVal = temp;
temp = enumerator.NextNonEOLSymbol();
}
}
return defVal;
}
示例3: ParseSyntax
private static ITypeAssignment ParseSyntax(string module, string name, IEnumerator<Symbol> enumerator, ref Symbol temp)
{
ITypeAssignment syntax;
temp.Expect(Symbol.Syntax);
temp = enumerator.NextNonEOLSymbol();
if (temp == Symbol.Bits)
{
syntax = new BitsType(string.Empty, string.Empty, enumerator);
temp = enumerator.NextNonEOLSymbol();
}
else if (temp == Symbol.Integer || temp == Symbol.Integer32)
{
syntax = new IntegerType(module, name, enumerator, ref temp);
}
else if (temp == Symbol.Octet)
{
temp = enumerator.NextNonEOLSymbol();
temp.Expect(Symbol.String);
syntax = new OctetStringType(string.Empty, string.Empty, enumerator, ref temp);
}
else if (temp == Symbol.Opaque)
{
syntax = new OctetStringType(string.Empty, string.Empty, enumerator, ref temp);
}
else if (temp == Symbol.IpAddress)
{
syntax = new IpAddressType(string.Empty, string.Empty, enumerator);
temp = enumerator.NextNonEOLSymbol();
}
else if (temp == Symbol.Counter64)
{
syntax = new Counter64Type(string.Empty, string.Empty, enumerator);
temp = enumerator.NextNonEOLSymbol();
}
else if (temp == Symbol.Unsigned32 || temp == Symbol.Counter32 || temp == Symbol.Gauge32 || temp == Symbol.TimeTicks)
{
syntax = new UnsignedType(string.Empty, string.Empty, enumerator, ref temp);
}
else if (temp == Symbol.Object)
{
temp = enumerator.NextNonEOLSymbol();
temp.Expect(Symbol.Identifier);
syntax = new ObjectIdentifierType(string.Empty, string.Empty, enumerator);
temp = enumerator.NextNonEOLSymbol();
}
else if (temp == Symbol.Sequence)
{
temp = enumerator.NextNonEOLSymbol();
if (temp == Symbol.Of)
{
temp = enumerator.NextNonEOLSymbol();
syntax = new TypeAssignment(string.Empty, string.Empty, enumerator, ref temp);
}
else
{
syntax = new Sequence(string.Empty, string.Empty, enumerator);
temp = enumerator.NextNonEOLSymbol();
}
}
else
{
syntax = new TypeAssignment(string.Empty, string.Empty, enumerator, ref temp);
}
return syntax;
}
示例4: ParseStatus
private static Status ParseStatus(IEnumerator<Symbol> enumerator, ref Symbol temp)
{
Status status = Status.Obsolete;
temp.Expect(Symbol.Status);
temp = enumerator.NextNonEOLSymbol();
try
{
status = StatusHelper.CreateStatus(temp.ToString());
temp = enumerator.NextNonEOLSymbol();
}
catch (ArgumentException)
{
temp.Throw("Invalid status");
}
return status;
}