Skip to content

Commit

Permalink
Merge pull request #3 from specs-feup/refactor/langspecv1-removal
Browse files Browse the repository at this point in the history
Replace LanguageSpecification class
  • Loading branch information
joaobispo authored Jan 2, 2025
2 parents ee8f8f5 + 6a82b55 commit db0ca39
Show file tree
Hide file tree
Showing 38 changed files with 1,202 additions and 1,203 deletions.
49 changes: 22 additions & 27 deletions jsweaver/src/pt/up/fe/specs/jackdaw/JackdawWeaver.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
package pt.up.fe.specs.jackdaw;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import javax.script.ScriptException;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import org.lara.interpreter.joptions.config.interpreter.LaraiKeys;
import org.lara.interpreter.weaver.ast.AstMethods;
import org.lara.interpreter.weaver.interf.AGear;
import org.lara.interpreter.weaver.interf.JoinPoint;
import org.lara.interpreter.weaver.options.WeaverOption;
import org.lara.language.specification.LanguageSpecification;
import org.lara.language.specification.dsl.LanguageSpecification;
import org.suikasoft.jOptions.Interfaces.DataStore;
import org.suikasoft.jOptions.storedefinition.StoreDefinition;
import org.suikasoft.jOptions.storedefinition.StoreDefinitionBuilder;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import pt.up.fe.specs.jackdaw.abstracts.AJackdawWeaverJoinPoint;
import pt.up.fe.specs.jackdaw.abstracts.weaver.AJackdawWeaver;
import pt.up.fe.specs.jackdaw.api.JackdawLaraApi;
Expand All @@ -34,20 +24,27 @@
import pt.up.fe.specs.util.lazy.Lazy;
import pt.up.fe.specs.util.providers.ResourceProvider;

import javax.script.ScriptException;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
* Weaver Implementation for JackdawWeaver<br>
* Since the generated abstract classes are always overwritten, their implementation should be done by extending those
* abstract classes with user-defined classes.<br>
* The abstract class {@link pt.up.fe.specs.jackdaw.abstracts.AJackdawWeaverJoinPoint} can be used to add user-defined
* methods and fields which the user intends to add for all join points and are not intended to be used in LARA aspects.
*
*
* @author Lara Weaver Generator
*/
public class JackdawWeaver extends AJackdawWeaver {

public static LanguageSpecification getLanguageSpec() {
return LanguageSpecification.newInstance(() -> "jackdaw/specs/joinPointModel.xml",
() -> "jackdaw/specs/artifacts.xml", () -> "jackdaw/specs/actionModel.xml", true);
() -> "jackdaw/specs/artifacts.xml", () -> "jackdaw/specs/actionModel.xml");
}

/**
Expand All @@ -70,7 +67,7 @@ public static StoreDefinition getWeaverDefinition() {

/**
* Warns the lara interpreter if the weaver accepts a folder as the application or only one file at a time.
*
*
* @return true if the weaver is able to work with several files, false if only works with one file
*/
@Override
Expand All @@ -81,13 +78,10 @@ public boolean handlesApplicationFolder() {

/**
* Set a file/folder in the weaver if it is valid file/folder type for the weaver.
*
* @param source
* the file with the source code
* @param outputDir
* output directory for the generated file(s)
* @param args
* arguments to start the weaver
*
* @param source the file with the source code
* @param outputDir output directory for the generated file(s)
* @param args arguments to start the weaver
* @return true if the file type is valid
*/
@Override
Expand Down Expand Up @@ -154,7 +148,7 @@ public String getName() {

/**
* Return a JoinPoint instance of the language root, i.e., an instance of AProject
*
*
* @return an instance of the join point root/program
*/
@Override
Expand All @@ -168,7 +162,7 @@ public JsonObject getProject() {

/**
* Closes the weaver to the specified output directory location, if the weaver generates new file(s)
*
*
* @return if close was successful
*/
@Override
Expand All @@ -192,7 +186,7 @@ public boolean close() {

/**
* Returns a list of Gears associated to this weaver engine
*
*
* @return a list of implementations of {@link AGear} or null if no gears are available
*/
@Override
Expand All @@ -217,8 +211,9 @@ public List<WeaverOption> getOptions() {
.collect(Collectors.toList());
}


@Override
public LanguageSpecification getLanguageSpecification() {
protected LanguageSpecification buildLangSpecs() {
return getLanguageSpec();
}

Expand Down
4 changes: 0 additions & 4 deletions jsweaver/src/pt/up/fe/specs/jackdaw/JackdawWeaver.json
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,6 @@
},
{
"type": "attribute",
"tooltip": "",
"children": [
{
"type": "boolean",
Expand All @@ -2782,7 +2781,6 @@
},
{
"type": "attribute",
"tooltip": "",
"children": [
{
"type": "boolean",
Expand Down Expand Up @@ -3007,7 +3005,6 @@
},
{
"type": "attribute",
"tooltip": "",
"children": [
{
"type": "boolean",
Expand All @@ -3016,7 +3013,6 @@
},
{
"type": "attribute",
"tooltip": "",
"children": [
{
"type": "boolean",
Expand Down
Loading

0 comments on commit db0ca39

Please sign in to comment.