@Override public Integer caseAStringPattern(AStringPattern pattern) throws AnalysisException { return pattern.getValue().getValue().length(); }
@Override public PType caseAStringPattern(AStringPattern pattern) throws AnalysisException { ASeqSeqType t = AstFactory.newASeqSeqType(pattern.getLocation(), AstFactory.newACharBasicType(pattern.getLocation())); return t; }
/** * Returns a deep clone of this {@link AStringPattern} node. * @return a deep clone of this {@link AStringPattern} node */ public AStringPattern clone() { return new AStringPattern( _location, cloneList(_definitions), _resolved, cloneNode(_value) ); }
public static AStringPattern newAStringPattern(LexStringToken token) { AStringPattern result = new AStringPattern(); initPattern(result, token.location); result.setValue(token); return result; }
/** * 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); }
@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; }
/** * Creates a new complete constructor {@code AStringPattern} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param value_ the {@link ILexStringToken} node for the {@code value} child of this {@link AStringPattern} node */ public AStringPattern(ILexLocation location_, List<? extends PDefinition> definitions_, Boolean resolved_, ILexStringToken value_) { super(location_,definitions_,resolved_); this.setValue(value_); }
/** * 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); }
/** * 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); }
@Override public SPatternIR caseAStringPattern(AStringPattern node, IRInfo question) throws AnalysisException { String value = node.getValue().getValue(); AStringPatternIR stringPatternCg = new AStringPatternIR(); stringPatternCg.setValue(value); return stringPatternCg; }
/** * Creates a deep clone of this {@link AStringPattern} 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 AStringPattern} node */ public AStringPattern clone(Map<INode,INode> oldToNewMap) { AStringPattern node = new AStringPattern( _location, cloneList(_definitions, oldToNewMap), _resolved, cloneNode(_value, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * 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; }
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 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; }