@Override public void remove() { // Detach current node of its parent, if any final Node parent = jjtGetParent(); if (parent != null) { parent.removeChildAtIndex(jjtGetChildIndex()); jjtSetParent(null); } // TODO [autofix]: Notify action for handling text edition }
private boolean insideLoop(AbstractNode node) { Node n = node.jjtGetParent(); while (n != null) { if (n instanceof ASTDoLoopStatement || n instanceof ASTWhileLoopStatement || n instanceof ASTForLoopStatement || n instanceof ASTForEachStatement) { return true; } n = n.jjtGetParent(); } return false; } }
protected Node getNextSibling(Node contextNode) { Node parentNode = contextNode.jjtGetParent(); if (parentNode != null) { int nextPosition = contextNode.jjtGetChildIndex() + 1; if (nextPosition < parentNode.jjtGetNumChildren()) { return parentNode.jjtGetChild(nextPosition); } } return null; }
/** * Indicate whether this node is allocating a new object. * * @param n * node that might be allocating a new object * @return true if child 0 is an AllocationExpression */ private boolean isAllocation(Node n) { return n.jjtGetNumChildren() > 0 && n.jjtGetChild(0) instanceof ASTAllocationExpression && n.jjtGetParent().jjtGetNumChildren() == 1; }
protected Node getFirstChild(Node contextNode) { if (contextNode.jjtGetNumChildren() > 0) { return contextNode.jjtGetChild(0); } else { return null; } }
protected Node getPreviousSibling(Node contextNode) { Node parentNode = contextNode.jjtGetParent(); if (parentNode != null) { int prevPosition = contextNode.jjtGetChildIndex() - 1; if (prevPosition >= 0) { return parentNode.jjtGetChild(prevPosition); } } return null; }
/** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 19 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; }
/** * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object) */ @Override public int getChildCount(Object parent) { return ((Node) parent).jjtGetNumChildren(); }
/* package */ void calculateLineNumbers(SourceCodePositioner positioner, int startOffset, int endOffset) { // end column will be interpreted as inclusive, while endOffset/endIndex // is exclusive endOffset -= 1; this.beginLine = positioner.lineNumberFromOffset(startOffset); this.beginColumn = positioner.columnFromOffset(this.beginLine, startOffset); this.endLine = positioner.lineNumberFromOffset(endOffset); this.endColumn = positioner.columnFromOffset(this.endLine, endOffset); if (this.endColumn < 0) { this.endColumn = 0; } }
public AbstractDataFlowNode(List<DataFlowNode> dataFlow, Node node) { this(dataFlow); this.node = node; node.setDataFlowNode(this); this.line = node.getBeginLine(); }
@Override public DataFlowNode getDataFlowNode() { if (this.dataFlowNode == null) { if (this.parent != null) { return parent.getDataFlowNode(); } return null; // TODO wise? } return dataFlowNode; }
/** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); }
/** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */
/** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } }
protected Node getLastChild(Node contextNode) { if (contextNode.jjtGetNumChildren() > 0) { return contextNode.jjtGetChild(contextNode.jjtGetNumChildren() - 1); } else { return null; } } }
/** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 4 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; }
/** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); }
/** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */
/** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 4 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; }
/** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */