using System;
namespace AspClassic.Parser;
///
/// A lexical error.
///
public sealed class ErrorToken : Token
{
private readonly SyntaxError _SyntaxError;
///
/// The syntax error that represents the lexical error.
///
public SyntaxError SyntaxError => _SyntaxError;
///
/// Creates a new lexical error token.
///
/// The type of the error.
/// The location of the error.
public ErrorToken(SyntaxErrorType errorType, Span span)
: base(TokenType.LexicalError, span)
{
if (errorType < SyntaxErrorType.InvalidEscapedIdentifier || errorType > SyntaxErrorType.InvalidDecimalLiteral)
{
throw new ArgumentOutOfRangeException("errorType");
}
_SyntaxError = new SyntaxError(errorType, span);
}
}