List of usage examples for org.eclipse.jdt.core.dom WhileStatement getStartPosition
public final int getStartPosition()
From source file:br.uff.ic.gems.resources.ast.Visitor.java
@Override public boolean visit(WhileStatement node) { int beginLine = cu.getLineNumber(node.getStartPosition()); int endLine = cu.getLineNumber(node.getStartPosition() + node.getLength()); int beginColumn = cu.getColumnNumber(node.getStartPosition()); int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength()); Statement body = node.getBody(); if (body != null) { int beginLineBody = cu.getLineNumber(body.getStartPosition()); int endLineBody = cu.getLineNumber(body.getStartPosition() + body.getLength()); int beginColumnBody = cu.getColumnNumber(body.getStartPosition()); int endColumnBody = cu.getColumnNumber(body.getStartPosition() + body.getLength()); languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn, beginLineBody, endLineBody, beginColumnBody, endColumnBody, null)); } else {/* w ww .ja v a2 s . co m*/ languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn)); } return true; }
From source file:com.chookapp.org.bracketeer.jdt.ClosingBracketHintVisitor.java
License:Open Source License
@Override public boolean visit(WhileStatement node) { String hint = GetNodeText(node.getExpression()); int startLoc = node.getStartPosition(); int endLoc = startLoc + node.getLength() - 1; hint = "while( " + hint + " )"; //$NON-NLS-1$ //$NON-NLS-2$ _scopeStack.push(new ScopeInfo(hint, startLoc, node)); try {/*from w ww . j a v a2 s .co m*/ _container.add(new Hint("while", startLoc, endLoc, hint)); //$NON-NLS-1$ } catch (BadLocationException e) { _cancelProcessing.set(true); } return shouldContinue(); }
From source file:com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.java
License:Open Source License
private CAstNode visit(WhileStatement n, WalkContext context) { Expression cond = n.getExpression(); Statement body = n.getBody(); ASTNode breakTarget = makeBreakOrContinueTarget(n, "breakLabel" + n.getStartPosition()); CAstNode breakNode = visitNode(breakTarget, context); ASTNode continueTarget = makeBreakOrContinueTarget(n, "continueLabel" + n.getStartPosition()); CAstNode continueNode = visitNode(continueTarget, context); String loopLabel = (String) context.getLabelMap().get(n); LoopContext lc = new LoopContext(context, loopLabel, breakTarget, continueTarget); /*/*w w w . ja v a2 s. c om*/ * The following loop is created sligtly differently than in jscore. It doesn't have a specific target for continue. */ return makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, makeNode(context, fFactory, n, CAstNode.LOOP, visitNode(cond, context), makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, visitNode(body, lc), continueNode)), breakNode); }
From source file:org.evolizer.changedistiller.jdt.JavaASTBodyTransformer.java
License:Apache License
/** * {@inheritDoc}/*ww w . j a v a2s. com*/ */ @Override public boolean visit(WhileStatement node) { push(fASTHelper.convertNode(node), node.getExpression().toString(), node.getStartPosition(), node.getLength()); return true; }
From source file:sharpen.core.CSharpBuilder.java
License:Open Source License
public boolean visit(final WhileStatement node) { consumeContinueLabel(new Function<CSBlock>() { public CSBlock apply() { CSWhileStatement stmt = new CSWhileStatement(node.getStartPosition(), mapExpression(node.getExpression())); visitBlock(stmt.body(), node.getBody()); addStatement(stmt);/*www . j a v a2 s . c o m*/ return stmt.body(); } }); return false; }