Search in sources :

Example 1 with LARASystem

use of Utils.LARASystem in project lara-framework by specs-feup.

the class ImportProcessor method importAndInitialize.

/**
 */
public void importAndInitialize() {
    for (Class<?> importingClass : LaraApis.getImportableClasses()) {
        importClassWithSimpleName(importingClass);
    }
    for (Class<?> importingClass : WeaverApis.getImportableClasses()) {
        importClassWithSimpleName(importingClass);
    }
    for (Class<?> importingClass : CLASSES_TO_IMPORT) {
        importClassWithSimpleName(importingClass);
    }
    final File jarDir = new File(LaraIUtils.getJarFoldername());
    final String laraPath = "var " + LARASystem.LARAPATH + "  = '" + jarDir.getAbsolutePath().replace('\\', '/') + "';\n";
    final String attribute = "var " + Interpreter.ATTRIBUTES + " = { set: function(newReport){ mergeObjects(this,newReport);}};\n";
    interpreter.evaluate(laraPath, "import_and_initialize");
    interpreter.evaluate(attribute, "import_and_initialize");
    LaraI laraI = interpreter.getLaraI();
    if (laraI.getOptions().useStackTrace()) {
        interpreter.put(CallStackTrace.STACKTRACE_NAME, interpreter.getStackStrace());
    }
    interpreter.put(MasterWeaver.WEAVER_NAME, laraI.getWeaver());
    interpreter.put(LARASystem.LARA_SYSTEM_NAME, new LARASystem(laraI));
    WeaverEngine engine = laraI.getWeaver().getEngine();
    LanguageSpecificationV2 ls = engine.getLanguageSpecificationV2();
    interpreter.put(MasterWeaver.LANGUAGE_SPECIFICATION_NAME, WeaverSpecification.newInstance(ls, engine.getScriptEngine()));
}
Also used : WeaverEngine(org.lara.interpreter.weaver.interf.WeaverEngine) LanguageSpecificationV2(org.lara.language.specification.dsl.LanguageSpecificationV2) LARASystem(Utils.LARASystem) LaraI(larai.LaraI) File(java.io.File)

Aggregations

LARASystem (Utils.LARASystem)1 File (java.io.File)1 LaraI (larai.LaraI)1 WeaverEngine (org.lara.interpreter.weaver.interf.WeaverEngine)1 LanguageSpecificationV2 (org.lara.language.specification.dsl.LanguageSpecificationV2)1