55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// An integer literal.
|
|
/// </summary>
|
|
public sealed class UnsignedIntegerLiteralToken : Token
|
|
{
|
|
private readonly ulong _Literal;
|
|
|
|
private readonly TypeCharacter _TypeCharacter;
|
|
|
|
private readonly IntegerBase _IntegerBase;
|
|
|
|
/// <summary>
|
|
/// The value of the literal.
|
|
/// </summary>
|
|
[CLSCompliant(false)]
|
|
public ulong Literal => _Literal;
|
|
|
|
/// <summary>
|
|
/// The type character of the literal.
|
|
/// </summary>
|
|
public TypeCharacter TypeCharacter => _TypeCharacter;
|
|
|
|
/// <summary>
|
|
/// The integer base of the literal.
|
|
/// </summary>
|
|
public IntegerBase IntegerBase => _IntegerBase;
|
|
|
|
/// <summary>
|
|
/// Constructs a new unsigned integer literal.
|
|
/// </summary>
|
|
/// <param name="literal">The literal value.</param>
|
|
/// <param name="integerBase">The integer base of the literal.</param>
|
|
/// <param name="typeCharacter">The type character of the literal.</param>
|
|
/// <param name="span">The location of the literal.</param>
|
|
[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;
|
|
}
|
|
}
|