'use strict';

var model = require('./model.js');

class GAstVisitor {
    visit(node) {
        const nodeAny = node;
        switch (nodeAny.constructor) {
            case model.NonTerminal:
                return this.visitNonTerminal(nodeAny);
            case model.Alternative:
                return this.visitAlternative(nodeAny);
            case model.Option:
                return this.visitOption(nodeAny);
            case model.RepetitionMandatory:
                return this.visitRepetitionMandatory(nodeAny);
            case model.RepetitionMandatoryWithSeparator:
                return this.visitRepetitionMandatoryWithSeparator(nodeAny);
            case model.RepetitionWithSeparator:
                return this.visitRepetitionWithSeparator(nodeAny);
            case model.Repetition:
                return this.visitRepetition(nodeAny);
            case model.Alternation:
                return this.visitAlternation(nodeAny);
            case model.Terminal:
                return this.visitTerminal(nodeAny);
            case model.Rule:
                return this.visitRule(nodeAny);
            /* c8 ignore next 2 */
            default:
                throw Error("non exhaustive match");
        }
    }
    /* c8 ignore next */
    visitNonTerminal(node) { }
    /* c8 ignore next */
    visitAlternative(node) { }
    /* c8 ignore next */
    visitOption(node) { }
    /* c8 ignore next */
    visitRepetition(node) { }
    /* c8 ignore next */
    visitRepetitionMandatory(node) { }
    /* c8 ignore next 3 */
    visitRepetitionMandatoryWithSeparator(node) { }
    /* c8 ignore next */
    visitRepetitionWithSeparator(node) { }
    /* c8 ignore next */
    visitAlternation(node) { }
    /* c8 ignore next */
    visitTerminal(node) { }
    /* c8 ignore next */
    visitRule(node) { }
}

exports.GAstVisitor = GAstVisitor;
