@Override public Integer caseAStringPattern(AStringPattern pattern) throws AnalysisException { return pattern.getValue().getValue().length(); }
public static AStringLiteralExp newAStringLiteralExp(ILexStringToken value) { AStringLiteralExp result = new AStringLiteralExp(); initExpression(result, value.getLocation()); result.setValue(value); return result; }
/** * Sets the {@code _value} child of this {@link AStringLiteralExp} node. * @param value the new {@code _value} child of this {@link AStringLiteralExp} node */ public void setValue(ILexStringToken value) { if (this._value != null) { this._value.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._value = value; }
/** * Called by the {@link AStringPattern} node from {@link AStringPattern#apply(IAnalysis)}. * @param node the calling {@link AStringPattern} node */ public void caseAStringPattern(AStringPattern node) throws AnalysisException { _visitedNodes.add(node); inAStringPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getValue() != null ) { node.getValue().apply(this); } outAStringPattern(node); }
public PExp caseAStringPattern(AStringPattern node) throws AnalysisException { AStringLiteralExp string = new AStringLiteralExp(); string.setValue(node.getValue().clone()); addPossibleType(string, node); return string; }
/** * Called by the {@link AStringPattern} node from {@link AStringPattern#apply(IAnalysis)}. * @param node the calling {@link AStringPattern} node */ public void caseAStringPattern(AStringPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); inAStringPattern(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getValue() != null ) { node.getValue().apply(this, question); } outAStringPattern(node, question); }
@Override public SPatternIR caseAStringPattern(AStringPattern node, IRInfo question) throws AnalysisException { String value = node.getValue().getValue(); AStringPatternIR stringPatternCg = new AStringPatternIR(); stringPatternCg.setValue(value); return stringPatternCg; }
/** * Called by the {@link AStringPattern} node from {@link AStringPattern#apply(IPOFAnalysis)}. * @param node the calling {@link AStringPattern} node */ public void caseAStringPattern(AStringPattern node) throws AnalysisException { _visitedNodes.add(node); inAStringPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getValue() != null ) { node.getValue().apply(this); } outAStringPattern(node); }
/** * Sets the {@code _value} child of this {@link AStringPattern} node. * @param value the new {@code _value} child of this {@link AStringPattern} node */ public void setValue(ILexStringToken value) { if (this._value != null) { this._value.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._value = value; }
@Override public List<NameValuePairList> caseAStringPattern(AStringPattern pattern, Newquestion question) throws AnalysisException { List<NameValuePairList> result = new Vector<NameValuePairList>(); try { if (!question.expval.stringValue(question.ctxt).equals(pattern.getValue().getValue())) { VdmRuntimeError.patternFail(4122, "String pattern match failed", pattern.getLocation()); } } catch (ValueException e) { VdmRuntimeError.patternFail(e, pattern.getLocation()); } result.add(new NameValuePairList()); return result; }
/** * Called by the {@link AStringLiteralExp} node from {@link AStringLiteralExp#apply(IAnalysis)}. * @param node the calling {@link AStringLiteralExp} node */ public void caseAStringLiteralExp(AStringLiteralExp node) throws AnalysisException { _visitedNodes.add(node); inAStringLiteralExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getValue() != null ) { node.getValue().apply(this); } outAStringLiteralExp(node); }
@Override public Value caseAStringLiteralExp(AStringLiteralExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); return new SeqValue(node.getValue().getValue()); }
/** * Called by the {@link AStringLiteralExp} node from {@link AStringLiteralExp#apply(IAnalysis)}. * @param node the calling {@link AStringLiteralExp} node */ public void caseAStringLiteralExp(AStringLiteralExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAStringLiteralExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getValue() != null ) { node.getValue().apply(this, question); } outAStringLiteralExp(node, question); }
@Override public PType caseAStringLiteralExp(AStringLiteralExp node, TypeCheckInfo question) { if (node.getValue().getValue().isEmpty()) { ASeqSeqType tt = AstFactory.newASeqSeqType(node.getLocation(), AstFactory.newACharBasicType(node.getLocation())); node.setType(tt); } else { node.setType(AstFactory.newASeq1SeqType(node.getLocation(), AstFactory.newACharBasicType(node.getLocation()))); } return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
/** * Called by the {@link AStringLiteralExp} node from {@link AStringLiteralExp#apply(IPOFAnalysis)}. * @param node the calling {@link AStringLiteralExp} node */ public void caseAStringLiteralExp(AStringLiteralExp node) throws AnalysisException { _visitedNodes.add(node); inAStringLiteralExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getValue() != null ) { node.getValue().apply(this); } outAStringLiteralExp(node); }
throws AnalysisException String value = node.getValue().getValue(); if (question.getSettings().getCharSeqAsString())
/** * Called by the {@link AStringPattern} node from {@link AStringPattern#apply(IAnalysis)}. * @param node the calling {@link AStringPattern} node */ public A caseAStringPattern(AStringPattern node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAStringPattern(node)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this)); } mergeReturns(retVal,outAStringPattern(node)); return retVal; }
/** * Called by the {@link AStringPattern} node from {@link AStringPattern#apply(IAnalysis)}. * @param node the calling {@link AStringPattern} node */ public A caseAStringPattern(AStringPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAStringPattern(node, question)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outAStringPattern(node, question)); return retVal; }
/** * Called by the {@link AStringLiteralExp} node from {@link AStringLiteralExp#apply(IAnalysis)}. * @param node the calling {@link AStringLiteralExp} node */ public A caseAStringLiteralExp(AStringLiteralExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAStringLiteralExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outAStringLiteralExp(node, question)); return retVal; }
/** * Called by the {@link AStringLiteralExp} node from {@link AStringLiteralExp#apply(IAnalysis)}. * @param node the calling {@link AStringLiteralExp} node */ public A caseAStringLiteralExp(AStringLiteralExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAStringLiteralExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this)); } mergeReturns(retVal,outAStringLiteralExp(node)); return retVal; }