diff --git a/.gitignore b/.gitignore index 8155b5a..d71fbbb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .gitignore +.classpath +.project *.class @@ -10,4 +12,4 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* -/bin/ +/bin diff --git a/MealyMachineSupervisor.java b/MealyMachineSupervisor.java index 061bfea..4fc45d0 100644 --- a/MealyMachineSupervisor.java +++ b/MealyMachineSupervisor.java @@ -43,6 +43,13 @@ public class MealyMachineSupervisor { Map > stateCodeInputs = new HashMap>(); Map > stateCodeOutputs = new HashMap>(); Map > stateSubtasks = new HashMap>(); + + 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) { @@ -307,7 +314,7 @@ private String processCondition(String logExp, HashSet 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); @@ -434,7 +441,7 @@ private String processAction(String clauses, HashSet 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); } @@ -483,6 +490,10 @@ private String parseExpression(String exp, HashSet inputs, ArrayList ins = new ArrayList(); 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()); }