namespace CanonSharp.Common.Scanner; public enum LexicalTokenType { Keyword, ConstInteger, ConstFloat, Operator, Delimiter, Identifier, Character, String } public sealed class LexicalToken(LexicalTokenType type, string literalValue) : IEquatable { public LexicalTokenType TokenType { get; } = type; public string LiteralValue { get; } = literalValue; public bool Equals(LexicalToken? other) => other is not null && TokenType == other.TokenType && LiteralValue == other.LiteralValue; public override bool Equals(object? obj) => obj is LexicalToken other && Equals(other); public override int GetHashCode() => TokenType.GetHashCode() ^ LiteralValue.GetHashCode(); public override string ToString() => $"<{TokenType}>'{LiteralValue}'"; }