@Override public PType caseADivideNumericBinaryExp( ADivideNumericBinaryExp node, TypeCheckInfo question) throws AnalysisException { checkNumeric(node, THIS, question.newConstraint(null)); node.setType(AstFactory.newARealNumericBasicType(node.getLocation())); return node.getType(); }
/** * Returns a deep clone of this {@link ADivideNumericBinaryExp} node. * @return a deep clone of this {@link ADivideNumericBinaryExp} node */ public ADivideNumericBinaryExp clone() { return new ADivideNumericBinaryExp( _type, _location, cloneNode(_left), cloneNode(_op), cloneNode(_right) ); }
/** * Called by the {@link ADivideNumericBinaryExp} node from {@link ADivideNumericBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ADivideNumericBinaryExp} node */ public void caseADivideNumericBinaryExp(ADivideNumericBinaryExp node) throws AnalysisException { _visitedNodes.add(node); inADivideNumericBinaryExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this); } if(node.getOp() != null ) { node.getOp().apply(this); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this); } outADivideNumericBinaryExp(node); }
@Override public Value caseADivideNumericBinaryExp(ADivideNumericBinaryExp node, Context ctxt) throws AnalysisException { // breakpoint.check(location, ctxt); node.getLocation().hit(); // Mark as covered try { double lv = node.getLeft().apply(VdmRuntime.getExpressionEvaluator(), ctxt).realValue(ctxt); double rv = node.getRight().apply(VdmRuntime.getExpressionEvaluator(), ctxt).realValue(ctxt); return NumericValue.valueOf(lv / rv, ctxt); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
@Override public String caseADivideNumericBinaryExp(ADivideNumericBinaryExp node, IndentTracker question) throws AnalysisException { String l = node.getLeft().apply(THIS, question); String r = node.getRight().apply(THIS,question); String op = mytable.getDIVIDE(); StringBuilder sb = new StringBuilder(); sb.append(l); sb.append(space); sb.append(op); sb.append(space); sb.append(r); return Utilities.wrap(sb.toString()); }
public static ADivideNumericBinaryExp newADivideNumericBinaryExp(PExp left, LexToken op, PExp right) { ADivideNumericBinaryExp result = new ADivideNumericBinaryExp(); initExpressionBinary(result, left, op, right); return result; }
/** * Called by the {@link ADivideNumericBinaryExp} node from {@link ADivideNumericBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ADivideNumericBinaryExp} node */ public void caseADivideNumericBinaryExp(ADivideNumericBinaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inADivideNumericBinaryExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this, question); } if(node.getOp() != null ) { node.getOp().apply(this, question); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this, question); } outADivideNumericBinaryExp(node, question); }
/** * Called by the {@link ADivideNumericBinaryExp} node from {@link ADivideNumericBinaryExp#apply(IPOFAnalysis)}. * @param node the calling {@link ADivideNumericBinaryExp} node */ public void caseADivideNumericBinaryExp(ADivideNumericBinaryExp node) throws AnalysisException { _visitedNodes.add(node); inADivideNumericBinaryExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this); } if(node.getOp() != null ) { node.getOp().apply(this); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this); } outADivideNumericBinaryExp(node); }
/** * Creates a deep clone of this {@link ADivideNumericBinaryExp} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ADivideNumericBinaryExp} node */ public ADivideNumericBinaryExp clone(Map<INode,INode> oldToNewMap) { ADivideNumericBinaryExp node = new ADivideNumericBinaryExp( _type, _location, cloneNode(_left, oldToNewMap), cloneNode(_op, oldToNewMap), cloneNode(_right, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ADivideNumericBinaryExp} node from {@link ADivideNumericBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ADivideNumericBinaryExp} node */ public A caseADivideNumericBinaryExp(ADivideNumericBinaryExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inADivideNumericBinaryExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { mergeReturns(retVal,node.getLeft().apply(this)); } if(node.getOp() != null ) { mergeReturns(retVal,node.getOp().apply(this)); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { mergeReturns(retVal,node.getRight().apply(this)); } mergeReturns(retVal,outADivideNumericBinaryExp(node)); return retVal; }
/** * Called by the {@link ADivideNumericBinaryExp} node from {@link ADivideNumericBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ADivideNumericBinaryExp} node */ public A caseADivideNumericBinaryExp(ADivideNumericBinaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inADivideNumericBinaryExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { mergeReturns(retVal,node.getLeft().apply(this, question)); } if(node.getOp() != null ) { mergeReturns(retVal,node.getOp().apply(this, question)); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { mergeReturns(retVal,node.getRight().apply(this, question)); } mergeReturns(retVal,outADivideNumericBinaryExp(node, question)); return retVal; }