本文整理汇总了C#中Symbol.Assert方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.Assert方法的具体用法?C# Symbol.Assert怎么用?C# Symbol.Assert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol.Assert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntegerType
/// <summary>
/// Creates an <see cref="IntegerType"/> instance.
/// </summary>
/// <param name="module"></param>
/// <param name="name"></param>
/// <param name="enumerator"></param>
public IntegerType(IModule module, string name, Symbol type, ISymbolEnumerator symbols)
: base (module, name)
{
Types? t = GetExactType(type);
type.Assert(t.HasValue, "Unknown symbol for unsigned type!");
_type = t.Value;
_isEnumeration = false;
Symbol current = symbols.NextNonEOLSymbol();
if (current == Symbol.OpenBracket)
{
_isEnumeration = true;
symbols.PutBack(current);
_map = Lexer.DecodeEnumerations(symbols);
}
else if (current == Symbol.OpenParentheses)
{
symbols.PutBack(current);
_ranges = Lexer.DecodeRanges(symbols);
current.Assert(!_ranges.IsSizeDeclaration, "SIZE keyword is not allowed for ranges of integer types!");
}
else
{
symbols.PutBack(current);
}
}
示例2: UnsignedType
public UnsignedType(IModule module, string name, Symbol type, ISymbolEnumerator symbols)
: base(module, name)
{
Types? t = GetExactType(type);
type.Assert(t.HasValue, "Unknown symbol for unsigned type!");
_type = t.Value;
Symbol current = symbols.NextNonEOLSymbol();
if (current == Symbol.OpenParentheses)
{
current.Assert((_type != Types.Counter64), "Ranges are not supported for Counter64 type!"); // our internal struct can only hold int64 values
symbols.PutBack(current);
_ranges = Lexer.DecodeRanges(symbols);
current.Assert(!_ranges.IsSizeDeclaration, "SIZE keyword is not allowed for ranges of unsigned types!");
}
else
{
symbols.PutBack(current);
}
}