using System;
namespace AspClassic.Parser;
///
/// An integer literal.
///
public sealed class UnsignedIntegerLiteralToken : Token
{
private readonly ulong _Literal;
private readonly TypeCharacter _TypeCharacter;
private readonly IntegerBase _IntegerBase;
///
/// The value of the literal.
///
[CLSCompliant(false)]
public ulong Literal => _Literal;
///
/// The type character of the literal.
///
public TypeCharacter TypeCharacter => _TypeCharacter;
///
/// The integer base of the literal.
///
public IntegerBase IntegerBase => _IntegerBase;
///
/// Constructs a new unsigned integer literal.
///
/// The literal value.
/// The integer base of the literal.
/// The type character of the literal.
/// The location of the literal.
[CLSCompliant(false)]
public UnsignedIntegerLiteralToken(ulong literal, IntegerBase integerBase, TypeCharacter typeCharacter, Span span)
: base(TokenType.UnsignedIntegerLiteral, span)
{
if (integerBase < IntegerBase.Decimal || integerBase > IntegerBase.Hexadecimal)
{
throw new ArgumentOutOfRangeException("integerBase");
}
if (typeCharacter != 0 && typeCharacter != TypeCharacter.UnsignedIntegerChar && typeCharacter != TypeCharacter.UnsignedLongChar && typeCharacter != TypeCharacter.UnsignedShortChar)
{
throw new ArgumentOutOfRangeException("typeCharacter");
}
_Literal = literal;
_IntegerBase = integerBase;
_TypeCharacter = typeCharacter;
}
}