Пример #1
0
 /**
  * Filters Spoofax editor-service declarations.
  *
  * @param term a SugarJ extension declaration.
  */
 public static IStrategoTerm extractEditor(IStrategoTerm term) throws IOException {
   IStrategoTerm result = null;
   Context extractionContext = SugarJContexts.extractionContext();
   try {
     result = extract_editor_0_0.instance.invoke(extractionContext, term);
   } catch (StrategoExit e) {
     if (e.getValue() != 0 || result == null)
       throw new RuntimeException("Editor service extraction failed", e);
   } finally {
     SugarJContexts.releaseContext(extractionContext);
   }
   return result;
 }
Пример #2
0
 public static IStrategoTerm renameRules(IStrategoTerm term, String oldName, String newName)
     throws IOException {
   IStrategoTerm result = null;
   Context renameRulesContext = SugarJContexts.renameRulesContext();
   try {
     IStrategoTerm toldName = renameRulesContext.getFactory().makeString(oldName);
     IStrategoTerm tnewName = renameRulesContext.getFactory().makeString(newName);
     result = rename_rules_0_2.instance.invoke(renameRulesContext, term, toldName, tnewName);
   } catch (StrategoExit e) {
     if (e.getValue() != 0 || result == null)
       throw new RuntimeException("Stratego extraction failed", e);
   } finally {
     SugarJContexts.releaseContext(renameRulesContext);
   }
   return result;
 }