<commit_before>/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */
package claw.wani.x2t.translator;

import claw.shenron.transformation.TransformationGroup;
import claw.tatsu.common.Context;
import claw.tatsu.common.Message;
import claw.tatsu.primitive.Pragma;
import claw.tatsu.xcodeml.exception.IllegalDirectiveException;
import claw.tatsu.xcodeml.exception.IllegalTransformationException;
import claw.tatsu.xcodeml.xnode.common.Xcode;
import claw.tatsu.xcodeml.xnode.common.XcodeProgram;
import claw.tatsu.xcodeml.xnode.common.Xnode;
import claw.wani.ClawConstant;
import claw.wani.language.ClawPragma;
import claw.wani.transformation.ClawTransformation;
import claw.wani.x2t.configuration.Configuration;
import claw.wani.x2t.configuration.GroupConfiguration;
import xcodeml.util.XmOption;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.util.Map;

/**
 * ClawTranslatorDriver is the class driving the translation. It creates the
 * translator and pass to it all the directives it can manage.
 * It is also in charge of decompiling the XcodeML/F after the translation took
 * place.
 *
 * @author clementval
 */
public class ClawTranslatorDriver {

  private String _xcodemlInputFile = null;
  private String _xcodemlOutputFile = null;
  private boolean _canTransform = false;
  private ClawTranslator _translator = null;
  private XcodeProgram _translationUnit = null;

  /**
   * ClawTranslatorDriver ctor.
   *
   * @param xcodemlInputFile  The XcodeML input file path.
   * @param xcodemlOutputFile The XcodeML output file path.
   */
  public ClawTranslatorDriver(String xcodemlInputFile,
                              String xcodemlOutputFile)
      throws Exception
  {
    _xcodemlInputFile = xcodemlInputFile;
    _xcodemlOutputFile = xcodemlOutputFile;
<commit_msg>#2 changes to ClawTranslatorDriver to enable easy extension<commit_after>/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */
package claw.wani.x2t.translator;

import claw.shenron.transformation.TransformationGroup;
import claw.tatsu.common.Context;
import claw.tatsu.common.Message;
import claw.tatsu.primitive.Pragma;
import claw.tatsu.xcodeml.exception.IllegalDirectiveException;
import claw.tatsu.xcodeml.exception.IllegalTransformationException;
import claw.tatsu.xcodeml.xnode.common.Xcode;
import claw.tatsu.xcodeml.xnode.common.XcodeProgram;
import claw.tatsu.xcodeml.xnode.common.Xnode;
import claw.wani.ClawConstant;
import claw.wani.language.ClawPragma;
import claw.wani.transformation.ClawTransformation;
import claw.wani.x2t.configuration.Configuration;
import claw.wani.x2t.configuration.GroupConfiguration;
import xcodeml.util.XmOption;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.util.Map;

/**
 * ClawTranslatorDriver is the class driving the translation. It creates the
 * translator and pass to it all the directives it can manage.
 * It is also in charge of decompiling the XcodeML/F after the translation took
 * place.
 *
 * @author clementval
 */
public class ClawTranslatorDriver {

  protected String _xcodemlInputFile = null;
  protected String _xcodemlOutputFile = null;
  protected boolean _canTransform = false;
  protected ClawTranslator _translator = null;
  protected XcodeProgram _translationUnit = null;

  /**
   * Parameterless constructor does nothing. Added so that constructors
   * of classes that extend this one don't have to worry.
   */
  public ClawTranslatorDriver()
  {

  }

  /**
   * ClawTranslatorDriver ctor.
   *
   * @param xcodemlInputFile  The XcodeML input file path.
   * @param xcodemlOutputFile The XcodeML output file path.
   */
  public ClawTranslatorDriver(String xcodemlInputFile,
                              String xcodemlOutputFile)
      throws Exception
  {
    _xcodemlInputFile = xcodemlInputFile;
    _xcodemlOutputFile = xcodemlOutputFile;

{'fraction_non_alphanumeric': 0.07498754359740907, 'fraction_numerical': 0.0017438963627304435, 'mean_word_length': 4.477489768076398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5525006', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1230, 'n_words': 313}