/** * Accept the visitor. */ public Object childrenAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException { for (Node childNode : children) { // Note: modified JavaCC code, child's data no longer ignored data = childNode.jjtAccept(visitor, data); } return data; }
/** * Return the depth of the node in the parse tree. The depth is ZERO (0) if * the node does not have a parent. * * @param node * The node. * @return The depth of that node. */ final protected int depth(Node node) { int i = 0; while ((node = node.jjtGetParent()) != null) { i++; } return i; }
public void closeNodeScope(Node n, int num) { mk = marks.remove(marks.size()-1); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; }
/** * Replaces this node with the supplied one in the AST. * * @param newNode * The replacement node. */ public void jjtReplaceWith(Node newNode) { if (parent != null) { parent.jjtReplaceChild(this, newNode); } for (Node childNode : children) { childNode.jjtSetParent(newNode); } }
/** * Unwrap an {@link ASTInfix} node, returning the inner {@link FunctionNode} * constructed for it. * <p> * Note: Sesame has picked up the notion of an ASTInfix node, but they are * handling it slightly differently. * * @see http://www.openrdf.org/issues/browse/SES-818 */ @Override final public FunctionNode visit(ASTInfix node, Object data) throws VisitorException { final Node left = node.jjtGetChild(0); final Node op = node.jjtGetChild(1); op.jjtInsertChild(left, 0); return (FunctionNode) op.jjtAccept(this, data); }
graphPattern.setContextVar(parentGP.getContext()); for (int i = 0; i < node.jjtGetNumChildren(); i++) { node.jjtGetChild(i).jjtAccept(this, data);
public void openNodeScope(Node n) { marks.add(mk); mk = sp; n.jjtOpen(); }
graphPattern.setContextVar(parentGP.getContext()); for (int i = 0; i < node.jjtGetNumChildren(); i++) { node.jjtGetChild(i).jjtAccept(this, data);
/** * Unwrap an {@link ASTInfix} node, returning the inner {@link FunctionNode} * constructed for it. * <p> * Note: Sesame has picked up the notion of an ASTInfix node, but they are * handling it slightly differently. * * @see http://www.openrdf.org/issues/browse/SES-818 */ @Override final public FunctionNode visit(ASTInfix node, Object data) throws VisitorException { final Node left = node.jjtGetChild(0); final Node op = node.jjtGetChild(1); op.jjtInsertChild(left, 0); return (FunctionNode) op.jjtAccept(this, data); }
/** * Replaces this node with the supplied one in the AST. * * @param newNode * The replacement node. */ public void jjtReplaceWith(Node newNode) { if (parent != null) { parent.jjtReplaceChild(this, newNode); } for (Node childNode : children) { childNode.jjtSetParent(newNode); } }
public void openNodeScope(Node n) { marks.add(mk); mk = sp; n.jjtOpen(); }
/** * Accept the visitor. */ public Object childrenAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException { for (Node childNode : children) { // Note: modified JavaCC code, child's data no longer ignored data = childNode.jjtAccept(visitor, data); } return data; }
public void closeNodeScope(Node n, int num) { mk = marks.remove(marks.size()-1); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; }
/** * Return the depth of the node in the parse tree. The depth is ZERO (0) if * the node does not have a parent. * * @param node * The node. * @return The depth of that node. */ final protected int depth(Node node) { int i = 0; while ((node = node.jjtGetParent()) != null) { i++; } return i; }
protected ValueExpressionNode right(final SimpleNode node) throws VisitorException { return (ValueExpressionNode) node.jjtGetChild(1).jjtAccept(this, null); }
public void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = marks.remove(marks.size()-1); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = marks.remove(marks.size()-1); node_created = false; } } }
private Node getParentContainer(Node node) { if (node instanceof ASTOperationContainer || node == null) { return node; } return getParentContainer(node.jjtGetParent()); }
protected ValueExpressionNode right(final SimpleNode node) throws VisitorException { return (ValueExpressionNode) node.jjtGetChild(1).jjtAccept(this, null); }
public void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = marks.remove(marks.size()-1); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = marks.remove(marks.size()-1); node_created = false; } } }
private Node getParentContainer(Node node) { if (node instanceof ASTOperationContainer || node == null) { return node; } return getParentContainer(node.jjtGetParent()); }