@Override public void caseILexIdentifierToken(ILexIdentifierToken node) throws AnalysisException { validateName(node.getName(), node.getLocation(), /* no module */ null); }
/** * Sets the {@code _name} child of this {@link AErrorCase} node. * @param value the new {@code _name} child of this {@link AErrorCase} node */ public void setName(ILexIdentifierToken value) { if (this._name != null) { this._name.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._name = value; }
public LexNameToken(String module, ILexIdentifierToken id) { super(id.getLocation(), VDMToken.NAME); this.module = module; this.name = id.getName(); this.old = id.isOld(); this.explicit = false; }
private LexIdentifierToken consLexIdToken(ILexIdentifierToken defName, String newName) { return new LexIdentifierToken(newName, defName.getOld(), defName.getLocation()); }
/** * @return The current default module's file name. */ @Override public File getDefaultFile() { return defaultModule.getName().getLocation().getFile(); }
/** * Called by the {@link AModuleImports} node from {@link AModuleImports#apply(IAnalysis)}. * @param node the calling {@link AModuleImports} node */ public void caseAModuleImports(AModuleImports node) throws AnalysisException { _visitedNodes.add(node); inAModuleImports(node); if(node.getName() != null ) { node.getName().apply(this); } { List<AFromModuleImports> copy = new ArrayList<AFromModuleImports>(node.getImports()); for( AFromModuleImports e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAModuleImports(node); }
public PStm findStatement(AModuleModules m, File file, int lineno) { if (m.getName().getLocation().getFile().equals(file)) { return af.createPDefinitionAssistant().findStatement(m.getDefs(), lineno); } return null; }
/** * Called by the {@link AModuleImports} node from {@link AModuleImports#apply(IAnalysis)}. * @param node the calling {@link AModuleImports} node */ public void caseAModuleImports(AModuleImports node, Q question) throws AnalysisException { _visitedNodes.add(node); inAModuleImports(node, question); if(node.getName() != null ) { node.getName().apply(this, question); } { List<AFromModuleImports> copy = new ArrayList<AFromModuleImports>(node.getImports()); for( AFromModuleImports e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outAModuleImports(node, question); }
@Override public PExp caseAFieldStateDesignator(AFieldStateDesignator node) throws AnalysisException { // pack this with the output of the visitor recursive calls. PExp value = node.getObject().apply(this); AFieldExp fieldExp = new AFieldExp(); fieldExp.setObject(value.clone()); fieldExp.setField(node.getField().clone()); // Not 100% sure these 2 match fieldExp.setMemberName(node.getObjectfield().clone()); fieldExp.setType(node.getType().clone()); return fieldExp; }
/** * @return The current default module name. */ @Override public String getDefaultName() { return defaultModule.getName().getName(); }
public LexNameToken getMemberName(AClassType cls, ILexIdentifierToken id) { // Note: not explicit return new LexNameToken(cls.getName().getName(), id.getName(), id.getLocation(), false, false); }
public PExp findExpression(AModuleModules m, File file, int lineno) { if (m.getName().getLocation().getFile().equals(file)) { return af.createPDefinitionListAssistant().findExpression(m.getDefs(), lineno); } return null; }
/** * Called by the {@link AModuleImports} node from {@link AModuleImports#apply(IPOFAnalysis)}. * @param node the calling {@link AModuleImports} node */ public void caseAModuleImports(AModuleImports node) throws AnalysisException { _visitedNodes.add(node); inAModuleImports(node); if(node.getName() != null ) { node.getName().apply(this); } { List<AFromModuleImports> copy = new ArrayList<AFromModuleImports>(node.getImports()); for( AFromModuleImports e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAModuleImports(node); }
@Override // see [1] pg. 179 unary expressions public IProofObligationList caseAHeadUnaryExp(AHeadUnaryExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = defaultSUnaryExp(node, question); PExp exp = node.getExp(); // RWL This is a hack. The new ast LexNameToken's toString method // includes the module e.g. like Test`b for variables // which the old one did not. Hence proof obligations with variable // names are different as "Test`b" is just b with the old proof // obligations generator. PExp fake = exp.clone(); if (exp instanceof AVariableExp) { AVariableExp var = (AVariableExp) fake; var.setName(new LexNameToken("", var.getName().getIdentifier().clone())); } if (!aF.createPTypeAssistant().isType(exp.getType(), ASeq1SeqType.class)) { obligations.add(new NonEmptySeqObligation(fake, question, aF)); } return obligations; }
/** * Sets the {@code _field} child of this {@link AFieldStateDesignator} node. * @param value the new {@code _field} child of this {@link AFieldStateDesignator} node */ public void setField(ILexIdentifierToken value) { if (this._field != null) { this._field.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._field = value; }
public String toString() { return "" + "("+_object+"."+(_memberName == null ? _field.getName() : _memberName.getFullName())+")"; }
private AFromModuleImports importAll(ILexIdentifierToken from) { List<List<PImport>> types = new Vector<List<PImport>>(); ILexNameToken all = new LexNameToken(from.getName(), "all", from.getLocation()); List<PImport> impAll = new Vector<PImport>(); AAllImport iport = AstFactory.newAAllImport(all); iport.setLocation(all.getLocation()); iport.setName(all); iport.setRenamed(all); iport.setFrom(null); impAll.add(iport); types.add(impAll); return AstFactory.newAFromModuleImports(from, types); } }
private void handleLexIdToken(INode parent, ILexIdentifierToken node) { Renaming r = findRenaming(node.getLocation()); if (r != null) { parent.replaceChild(node, consLexIdToken(node, r.getNewName())); } }