private static final Set<String> varDependenciesOf(final Statement s) { Set<String> list = new HashSet(); for (Facet facet : EGaml.getFacetsOf(s)) { Expression expr = facet.getExpr(); if (expr != null) { if (expr instanceof VariableRef) { list.add(EGaml.getKey.caseVariableRef((VariableRef) expr)); } else { for (TreeIterator<EObject> tree = expr.eAllContents(); tree.hasNext(); ) { EObject obj = tree.next(); if (obj instanceof VariableRef) { list.add(EGaml.getKey.caseVariableRef((VariableRef) obj)); } } } } } if (list.isEmpty()) { return null; } return list; }
private static void convertFacets( final Statement stm, final String keyword, final ISyntacticElement elt, final Set<Diagnostic> errors) { SymbolProto p = DescriptionFactory.getProto(keyword, null); for (Facet f : EGaml.getFacetsOf(stm)) { String fname = EGaml.getKey.caseFacet(f); // We change the "<-" and "->" symbols into full names if (fname.equals("<-")) { fname = keyword.equals(LET) || keyword.equals(SET) ? VALUE : INIT; } else if (fname.equals("->")) { fname = FUNCTION; } // We compute (and convert) the expression attached to the facet boolean label = p == null ? false : p.isLabel(fname); IExpressionDescription fexpr = convExpr(f, label, errors); addFacet(elt, fname, fexpr, errors); } // We add the "default" (or omissible) facet to the syntactic element String def = stm.getFirstFacet(); if (def != null) { if (def.endsWith(":")) { def = def.substring(0, def.length() - 1); } } else { def = DescriptionFactory.getOmissibleFacetForSymbol(keyword); } if (def != null && !def.isEmpty() && !elt.hasFacet(def)) { IExpressionDescription ed = findExpr(stm, errors); if (ed != null) { elt.setFacet(def, ed); } } }