Skip to content

Commit

Permalink
Merge pull request #2 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 24201f3 + 5c1a3fb commit f389e44
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 120 deletions.
18 changes: 6 additions & 12 deletions AnyWeaver/src/pt/up/fe/specs/anycompiler/weaver/AnyWeaver.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import org.lara.interpreter.weaver.interf.JoinPoint;
import org.lara.interpreter.weaver.options.WeaverOption;
import org.lara.interpreter.weaver.utils.LaraResourceProvider;
import org.lara.language.specification.LanguageSpecification;
import org.lara.language.specification.dsl.LanguageSpecificationV2;
import org.lara.language.specification.dsl.LanguageSpecification;
import org.suikasoft.jOptions.Interfaces.DataStore;
import pt.up.fe.specs.anycompiler.ast.AnyNode;
import pt.up.fe.specs.anycompiler.ast.GenericAnyNode;
Expand Down Expand Up @@ -37,15 +36,10 @@ public class AnyWeaver extends AAnyWeaver {
private DataStore args;
private AnyNode root;

/**
* @return
* @deprecated
*/
@Deprecated
public static LanguageSpecification buildLanguageSpecificationOld() {
public static LanguageSpecification buildLanguageSpecification() {
return LanguageSpecification.newInstance(() -> "anycompiler/weaverspecs/joinPointModel.xml",
() -> "anycompiler/weaverspecs/artifacts.xml",
() -> "anycompiler/weaverspecs/actionModel.xml", true);
() -> "anycompiler/weaverspecs/actionModel.xml");
}

public AnyWeaver() {
Expand Down Expand Up @@ -92,7 +86,7 @@ public boolean begin(List<File> sources, File outputDir, DataStore args) {
}


private LanguageSpecificationV2 buildLangSpec() {
private LanguageSpecification buildLangSpec() {
// TODO Auto-generated method stub
return null;
}
Expand Down Expand Up @@ -162,8 +156,8 @@ public List<WeaverOption> getOptions() {
}

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public final String get_class() {
*
*/
protected enum AnyAttributes {
GETVALUE("getValue"),
PARENT("parent"),
AST("ast"),
CHILDREN("children"),
DESCENDANTS("descendants");
DESCENDANTS("descendants"),
GETVALUE("getValue"),
PARENT("parent");
private String name;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public AJoinPoint addAstImpl(AJoinPoint ast) {
* Adds an AST to the current program, returns the inserted join point
* @param ast
*/
public final AJoinPoint addAst(AJoinPoint ast) {
public final Object addAst(AJoinPoint ast) {
try {
if(hasListeners()) {
eventTrigger().triggerAction(Stage.BEGIN, "addAst", this, Optional.empty(), ast);
Expand All @@ -39,7 +39,7 @@ public final AJoinPoint addAst(AJoinPoint ast) {
if(hasListeners()) {
eventTrigger().triggerAction(Stage.END, "addAst", this, Optional.ofNullable(result), ast);
}
return result;
return result!=null?result:getUndefinedValue();
} catch(Exception e) {
throw new ActionException(get_class(), "addAst", e);
}
Expand Down Expand Up @@ -106,11 +106,11 @@ public final String get_class() {
*
*/
protected enum AppAttributes {
GETVALUE("getValue"),
PARENT("parent"),
AST("ast"),
CHILDREN("children"),
DESCENDANTS("descendants");
DESCENDANTS("descendants"),
GETVALUE("getValue"),
PARENT("parent");
private String name;

/**
Expand Down
Loading

0 comments on commit f389e44

Please sign in to comment.