com.github.uscexp.grappa.extension.nodes.AstCommandTreeNode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grappa.extension Show documentation
Show all versions of grappa.extension Show documentation
Extension for parboiled/grappa parser.
The newest version!
/*
* Copyright (C) 2014 - 2016 by haui - all rights reserved
*/
package com.github.uscexp.grappa.extension.nodes;
import com.github.uscexp.grappa.extension.annotations.AstCommand;
/**
* base class for all {@link AstCommand} annotated parser rules.
* the subclass has to contain the command logic.
*
* @author haui
*
*/
public abstract class AstCommandTreeNode extends AstTreeNode {
public AstCommandTreeNode(String rule, String value) {
super(rule, value);
}
public AstTreeNode getSibling(int index) {
AstTreeNode sibling = null;
if(getParent() != null && getParent().getChildren() != null && getParent().getChildren().size() > index) {
sibling = getParent().getChildren().get(index);
}
return sibling;
}
}