Skip to content

Commit

Permalink
Merge pull request #13 from trinnguyen/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
eyip002 authored Jul 23, 2021
2 parents 2a64f53 + 2692c36 commit f2be896
Show file tree
Hide file tree
Showing 6 changed files with 530 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

package de.uniba.swt.dsl.common.generator.sccharts.builder;

import de.uniba.swt.dsl.bahn.BahnFactory;
import de.uniba.swt.dsl.bahn.FuncDecl;
import de.uniba.swt.dsl.bahn.RefVarDecl;
import de.uniba.swt.dsl.bahn.*;
import de.uniba.swt.dsl.common.generator.sccharts.StateTable;
import de.uniba.swt.dsl.common.generator.sccharts.models.RootState;
import de.uniba.swt.dsl.common.util.BahnUtil;
Expand All @@ -52,11 +50,19 @@ public RootStateBuilder(FuncDecl funcDecl) {

var hasReturnVar = createNewVarDecl(SCChartsUtil.VAR_HAS_RETURN_NAME, ExprDataType.ScalarBool);
superState.getDeclarations().add(convertDeclaration(hasReturnVar, false, false));

// Create initialisation assignment
var initialAssignment = createBooleanAssignment(hasReturnVar, false);
statementList.getStmts().add(0, initialAssignment);
}

if (BahnUtil.hasBreakStmt(funcDecl.getStmtList())) {
var hasBreakVar = createNewVarDecl(SCChartsUtil.VAR_HAS_BREAK, ExprDataType.ScalarBool);
superState.getDeclarations().add(convertDeclaration(hasBreakVar, false, false));

// Create initialisation assignment
var initialAssignment = createBooleanAssignment(hasBreakVar, false);
statementList.getStmts().add(0, initialAssignment);
}
}

Expand All @@ -68,6 +74,12 @@ private RefVarDecl createNewVarDecl(String name, ExprDataType dataType) {
return decl;
}

private AssignmentStmt createBooleanAssignment(RefVarDecl decl, boolean value) {
var booleanLiteral = BahnUtil.createBooleanLiteral(value);
var assignmentStmt = BahnUtil.createAssignmentStmt(decl, booleanLiteral);
return assignmentStmt;
}

public RootState getRootState() {
return (RootState) superState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class SuperStateBuilder {

private final StateTable stateTable;
protected SuperState superState;
private final StatementList statementList;
protected final StatementList statementList;
private final Stack<SuperState> stackSuperStates;

public SuperStateBuilder(Stack<SuperState> stackSuperStates, String id, StatementList statementList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private boolean executeFile(IFileSystemAccess2 fsa, String[] inputs) {
// ensure exist
for (String input : inputs) {
if (!fsa.isFile(input)) {
logger.debug("File is not exist: " + input);
logger.debug("File does not exist: " + input);
return false;
}
}
Expand Down
Loading

0 comments on commit f2be896

Please sign in to comment.