Ejemplo n.º 1
0
  public static void init() {
    listeners = new ArrayList<CompilerListener>();

    commentProperties = new HashMap<Integer, CommentProperties>();
    methodProperties = new HashMap<Integer, MethodProperties>();
    identifierProperties = new HashMap<Integer, IdentifierProperties>();

    Keyword.addLanguage(JAVA);
    Keyword.addLanguage(GLSL);
    Keyword.addLanguage(ASSEMBLY);
    Keyword.addLanguage(FOXY);
    Keyword.addLanguage(CPP);
    Keyword.addLanguage(C);
    Keyword.addLanguage(PHP);
    Keyword.addLanguage(PYTHON);

    JavaLanguage.init();
    GLSLLanguage.init();
    AssemblyLanguage.init();
    FoxyLanguage.init();
    CppLanguage.init();
    CLanguage.init();
    PHPLanguage.init();
    PythonLanguage.init();

    commentProperties.put(JAVA, JavaLanguage.COMMENT_PROPERTIES);
    commentProperties.put(GLSL, GLSLLanguage.COMMENT_PROPERTIES);
    commentProperties.put(ASSEMBLY, AssemblyLanguage.COMMENT_PROPERTIES);
    commentProperties.put(FOXY, FoxyLanguage.COMMENT_PROPERTIES);
    commentProperties.put(CPP, CppLanguage.COMMENT_PROPERTIES);
    commentProperties.put(C, CppLanguage.COMMENT_PROPERTIES);
    commentProperties.put(PHP, PHPLanguage.COMMENT_PROPERTIES);
    commentProperties.put(PYTHON, PythonLanguage.COMMENT_PROPERTIES);

    methodProperties.put(JAVA, JavaLanguage.METHOD_PROPERTIES);
    methodProperties.put(GLSL, GLSLLanguage.METHOD_PROPERTIES);
    methodProperties.put(ASSEMBLY, AssemblyLanguage.METHOD_PROPERTIES);
    methodProperties.put(FOXY, FoxyLanguage.METHOD_PROPERTIES);
    methodProperties.put(CPP, CppLanguage.METHOD_PROPERTIES);
    methodProperties.put(C, CppLanguage.METHOD_PROPERTIES);
    methodProperties.put(PHP, PHPLanguage.METHOD_PROPERTIES);
    methodProperties.put(PYTHON, PythonLanguage.METHOD_PROPERTIES);

    identifierProperties.put(JAVA, JavaLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(GLSL, GLSLLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(ASSEMBLY, AssemblyLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(FOXY, FoxyLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(CPP, CppLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(C, CppLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(PHP, PHPLanguage.IDENTIFIER_PROPERTIES);
    identifierProperties.put(PYTHON, PythonLanguage.IDENTIFIER_PROPERTIES);
  }
Ejemplo n.º 2
0
  public static void compile(
      String fileLocation, String code, String outputLocation, PrintStream stream) {
    if (fileLocation != null) {
      int language = FileUtils.getLanguage(fileLocation);

      if (language == Language.JAVA) {
        JavaLanguage.compile(fileLocation, code, outputLocation, stream, listeners);
      } else if (language == Language.GLSL) {
        GLSLLanguage.loadVertexShader(fileLocation, code, stream, listeners);
      } else if (language == Language.ASSEMBLY) {
        AssemblyLanguage.compile(fileLocation, outputLocation, stream, listeners);
      } else if (language == Language.CPP) {
        CppLanguage.compile(
            fileLocation, FileUtils.getParentFolder(fileLocation), stream, listeners);
      }
    }
  }
Ejemplo n.º 3
0
  public static Program run(
      int language, String fileLocation, ConsoleStream stream, ProgramListener listener) {
    fileLocation = FileUtils.removeEndingSlashes(fileLocation.replace('\\', '/'));

    if (language == JAVA) {
      return JavaLanguage.run(fileLocation, stream, listener);
    } else if (language == GLSL) {

    } else if (language == ASSEMBLY) {
      return AssemblyLanguage.run(fileLocation, stream, listener);
    } else if (language == CPP) {
      return CppLanguage.run(fileLocation, stream, listener);
    } else if (language == PYTHON) {
      return PythonLanguage.run(fileLocation, stream, listener);
    } else {
      throw new UnsupportedOperationException(
          "The deployment of the specified language is not currently supported by ArrowIDE.");
    }

    return null;
  }