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

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

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

        this.data = data;
    }

    public append(characters: string): void {
        this.data += characters;
    }

    public appendReplacementCharacter(): void {
        this.append(REPLACEMENT_CHARACTER);
    }

    public static createEmpty(): CommentToken {
        return new CommentToken('');
    }

    public static createWith(data: string): CommentToken {
        return new CommentToken(data);
    }

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