예제 #1
0
  private static ModuleKey getModuleKeyForAssimilation(
      Path str, String main, Map<Path, Integer> dependentFiles, SGLR strParser)
      throws IOException, InvalidParseTableException, TokenExpectedException, BadTokenException,
          SGLRException {
    log.beginTask("Generating", "Generate module key for current assimilation", Log.CACHING);
    try {
      IStrategoTerm aterm =
          (IStrategoTerm)
              strParser.parse(
                  FileCommands.readFileAsString(str), str.getAbsolutePath(), "StrategoModule");

      aterm = ATermCommands.getApplicationSubterm(aterm, "Module", 1);

      return new ModuleKey(dependentFiles, STR_FILE_PATTERN, aterm);
    } catch (Exception e) {
      throw new SGLRException(strParser, "could not parse STR file " + str, e);
    } finally {
      log.endTask();
    }
  }