@Override public int visit(IASTStatement statement) { try { if (statement instanceof IASTIfStatement) visitIf((IASTIfStatement) statement); if (statement instanceof IASTSwitchStatement) visitSwitch((IASTSwitchStatement) statement); if (statement instanceof IASTForStatement) visitFor((IASTForStatement) statement); if (statement instanceof IASTWhileStatement) visitWhile((IASTWhileStatement) statement); if (statement instanceof IASTDoStatement) visitDo((IASTDoStatement) statement); if (statement instanceof IASTCaseStatement || statement instanceof IASTDefaultStatement) visitCase(statement); if (statement instanceof IASTBreakStatement || statement instanceof IASTContinueStatement) visitBreak(statement); } catch (BadLocationException e) { _cancelProcessing.set(true); } catch (Exception e) { if (!(e instanceof ScopeTraceException || e instanceof EmptyStackException)) Activator.log(e); else if (Activator.DEBUG) Activator.log(e); } return shouldContinue(); }
@Override public int visit(ICPPASTNamespaceDefinition namespaceDefinition) { IASTName name = namespaceDefinition.getName(); try { IASTFileLocation location = namespaceDefinition.getFileLocation(); int endLoc = location.getNodeOffset() + location.getNodeLength() - 1; int startLoc = location.getNodeOffset(); _container.add( new Hint("namespace", startLoc, endLoc, "namespace " + name.toString())); // $NON-NLS-1$ } catch (BadLocationException e) { _cancelProcessing.set(true); } return shouldContinue(); }
private int shouldContinue() { if (_cancelProcessing.get()) return PROCESS_ABORT; else return PROCESS_CONTINUE; }