Intuitive DSL for Java

Version 2.0.0 · src/main/java/ch/dbalabs/intuitivedsl/grammar/SyntaxNode.java

Git clone
git clone https://www.dbalabs.ch/git/intuitive-dsl-java.git

SyntaxNode.java

/*
 * This file is part of the Intuitive DSL project.
 * Copyright (c) 2026 DBA Labs - Switzerland. All rights reserved.
 *
 * This program is dual-licensed under a commercial license and the AGPLv3.
 * For commercial licensing, contact us at [email protected] or visit https://www.dbalabs.ch.
 *
 * AGPLv3 licensing:
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, version 3 (19 November 2007).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
 */

package ch.dbalabs.intuitivedsl.grammar;

/**
 * The base interface for all nodes in the Intuitive DSL engine Abstract Syntax Tree (AST).
 * <p>
 * This interface is sealed to ensure that the grammar structure is strictly bounded.
 * It allows the parser and binder to use Java 17+ Pattern Matching (switch expressions)
 * exhaustively without needing a default branch.
 * </p>
 *
 * @author DBA Labs
 */
public sealed interface SyntaxNode permits
        KeywordNode,
        ParameterNode,
        DelimiterNode,
        GroupNode,
        AlternativeNode,
        MacroNode {

    /**
     * Indicates whether this specific node can be repeated multiple times.
     * In iBNF grammar, this is typically represented by the ellipsis marker ('...').
     *
     * @return true if the node is repeatable, false otherwise
     */
    boolean isRepeatable();
}