#define DEBUG using System; using System.Diagnostics; namespace AspClassic.Parser; /// /// The base class for all tokens. Contains line and column information as well as token type. /// public abstract class Token { private readonly TokenType _Type; private readonly Span _Span; /// /// The type of the token. /// public TokenType Type => _Type; /// /// The span of the token in the source text. /// public Span Span => _Span; protected Token(TokenType type, Span span) { Debug.Assert(Enum.IsDefined(typeof(TokenType), type)); _Type = type; _Span = span; } /// /// Returns the unreserved keyword type of an identifier. /// /// The unreserved keyword type of an identifier, the token's type otherwise. public virtual TokenType AsUnreservedKeyword() { return Type; } }