progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
55
AspClassic.Parser/IntegerLiteralExpression.cs
Normal file
55
AspClassic.Parser/IntegerLiteralExpression.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for an integer literal.
|
||||
/// </summary>
|
||||
public sealed class IntegerLiteralExpression : LiteralExpression
|
||||
{
|
||||
private readonly int _Literal;
|
||||
|
||||
private readonly TypeCharacter _TypeCharacter;
|
||||
|
||||
private readonly IntegerBase _IntegerBase;
|
||||
|
||||
/// <summary>
|
||||
/// The literal value.
|
||||
/// </summary>
|
||||
public int Literal => _Literal;
|
||||
|
||||
public override object Value => _Literal;
|
||||
|
||||
/// <summary>
|
||||
/// The type character on the literal.
|
||||
/// </summary>
|
||||
public TypeCharacter TypeCharacter => _TypeCharacter;
|
||||
|
||||
/// <summary>
|
||||
/// The integer base of the literal.
|
||||
/// </summary>
|
||||
public IntegerBase IntegerBase => _IntegerBase;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new parse tree for an 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 on the literal.</param>
|
||||
/// <param name="span">The location of the parse tree.</param>
|
||||
public IntegerLiteralExpression(int literal, IntegerBase integerBase, TypeCharacter typeCharacter, Span span)
|
||||
: base(TreeType.IntegerLiteralExpression, span)
|
||||
{
|
||||
if (integerBase < IntegerBase.Decimal || integerBase > IntegerBase.Hexadecimal)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("integerBase");
|
||||
}
|
||||
if (typeCharacter != 0 && typeCharacter != TypeCharacter.IntegerSymbol && typeCharacter != TypeCharacter.IntegerChar && typeCharacter != TypeCharacter.ShortChar && typeCharacter != TypeCharacter.LongSymbol && typeCharacter != TypeCharacter.LongChar)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("typeCharacter");
|
||||
}
|
||||
_Literal = literal;
|
||||
_IntegerBase = integerBase;
|
||||
_TypeCharacter = typeCharacter;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue