Skip to content

Commit

Permalink
start of extending action language
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahur Kotkas committed Apr 7, 2015
1 parent c03479b commit 0da03da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.gitignore
.classpath
.project

*.class

Expand All @@ -10,4 +12,4 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

/bin/
/bin
15 changes: 13 additions & 2 deletions MealyMachineSupervisor.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public class MealyMachineSupervisor {
Map <String,HashSet<String>> stateCodeInputs = new HashMap<String,HashSet<String>>();
Map <String,HashSet<String>> stateCodeOutputs = new HashMap<String,HashSet<String>>();
Map <String,ArrayList<SubtaskMethod>> stateSubtasks = new HashMap<String,ArrayList<SubtaskMethod>>();

static String[] arithmOp = new String {"+","-","*","/","%"};
static String[] comparOp = new String {"==","!=","<",">","<=",">="};
static String[] logicOp = new String {"||","&&","!","&","|","~","^","<<",">>",""};
static String[] evalOp = new String {"="};
static String[] complexEvalOp = new String {"+=","-=","*=","/=","%="};
static String[] unaryEvalOp = new String {"++","--"};

public String init(String csoName) {
if (debug) {
Expand Down Expand Up @@ -307,7 +314,7 @@ private String processCondition(String logExp, HashSet<String> inputs,
if (logExp == null ||logExp.isEmpty() || logExp.equals("true")) {
return "true";
}
String[] split1 = logExp.split("<|>|=|\\+|\\-|\\*|/|\\(|\\)|\\|\\||&&");
String[] split1 = logExp.split("<|>|=|\\+|\\-|\\*|/|\\(|\\)|\\|\\||&&|!");
for (String s : split1) {
if (debugParse) {
System.out.println(" Token extracted: "+s);
Expand Down Expand Up @@ -434,7 +441,7 @@ private String processAction(String clauses, HashSet<String> inputs,
result += stm.getJavaScript();
} else {
String[] cSplit = clause.split("=",2);
if (cSplit.length==1) {
if (cSplit.length==1) { // There was no "=" in clause
if (debugParse) {
System.out.println(" case (MC): "+clause);
}
Expand Down Expand Up @@ -483,6 +490,10 @@ private String parseExpression(String exp, HashSet<String> inputs,
ArrayList<String> ins = new ArrayList<String>();
String[] split1 = exp.split("\\+|-|\\*|/|\\(|\\)");
for (String s : split1) {
if () {
// Ignore method names
continue;
}
if (s.length()>0 && !s.matches("\\d*") && !s.contains(".")) {
ins.add(s.trim());
}
Expand Down

0 comments on commit 0da03da

Please sign in to comment.