import { REPLACEMENT_CHARACTER, Token, Type } from '../token.js';

export class CharacterToken extends Token {
    public readonly data: NonNullable<string>;

    public constructor(data: NonNullable<string>) {
        super(Type.Character);

        this.data = data;
    }

    public static createWith(data: NonNullable<string>): CharacterToken {
        return new CharacterToken(data);
    }

    public static createReplacementCharacter(): CharacterToken {
        return new CharacterToken(REPLACEMENT_CHARACTER);
    }

    public override inspect(indent: number): string {
        return `CharacterToken { '${this.data}' }`;
    }
}
