javax0.jamal.api.ASTNode Maven / Gradle / Ivy
package javax0.jamal.api;
import java.util.List;
/**
* The AST node refers to a node within the Abstract Syntax Tree, which is generated by the parser.
* The parser is not utilized during the execution of Jamal.
* It serves as a supplementary tool that aids in creating the AST,
* particularly for providing editor support such as implementing the Language Server Protocol (LSP).
* The development of the parser preceded the implementation of the LSP,
* but it was designed with editor support as a consideration for the release 2.5.0.
*/
public interface ASTNode extends Iterable {
Type getType();
String getText();
int getStart();
int getEnd();
List getChildren();
/**
* The type of the node.
*
* It can be one of the following:
*
*
{@link Type#LIST} - the node is a list of other nodes
* {@link Type#OPEN} - the node is a macro opening string
* {@link Type#CLOSE} - the node is a macro closing string
* {@link Type#ID} - the node is an identifier
* {@link Type#TEXT} - the node is a text
* {@link Type#PREFIX} - the node is a prefix
* {@link Type#BIMCHAR} - the node is a built-in macro character, either {@code @} or {@code #}
*/
public enum Type {
LIST, OPEN, CLOSE, ID, TEXT, PREFIX, BIMCHAR
}
}