diff --git a/src/main/java/myutil/intboolsolver/IBSStdParser.java b/src/main/java/myutil/intboolsolver/IBSStdParser.java index 2ac4048d7f39a6cdfd930f90be30b724bf6d0535..151c0e9f4829ce4dfb95391c6a23446d1fbd3bc9 100644 --- a/src/main/java/myutil/intboolsolver/IBSStdParser.java +++ b/src/main/java/myutil/intboolsolver/IBSStdParser.java @@ -8,6 +8,7 @@ package myutil.intboolsolver; import java_cup.runtime.*; import java.util.HashSet; import java_cup.runtime.XMLElement; +import myutil.TraceManager; /** CUP v0.11b 20210814 (GIT d69c832) generated parser. */ @@ -199,7 +200,9 @@ public class IBSStdParser< Spec extends IBSParamSpec, Comp extends IBSParamComp, - public void report_error(String message, Object info){} + public void report_error(String message, Object info){ + TraceManager.addDev("Error during parsing: " + message + " / class " + info.getClass()); + } IBSScanner<Spec,Comp,State,SpecState,CompState> lexer; diff --git a/src/main/java/ui/AvatarDesignPanelTranslator.java b/src/main/java/ui/AvatarDesignPanelTranslator.java index 6d4b68613dd0865b133d058c9e87b0ef03de06d6..ccc1dbe15c44e0541e62152636b79188a03d3e88 100644 --- a/src/main/java/ui/AvatarDesignPanelTranslator.java +++ b/src/main/java/ui/AvatarDesignPanelTranslator.java @@ -567,7 +567,7 @@ public class AvatarDesignPanelTranslator { ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); - TraceManager.addDev("UPPAAL Pragma " + _pragma + " cannot be parsed"); + TraceManager.addDev("Safety Pragma " + _pragma + " cannot be parsed"); return false; } @@ -578,7 +578,7 @@ public class AvatarDesignPanelTranslator { ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); - TraceManager.addDev("UPPAAL Pragma " + _pragma + " improperly formatted"); + TraceManager.addDev("Safety Pragma " + _pragma + " improperly formatted"); return false; } else if (returnVal == -1) { return false; @@ -618,7 +618,7 @@ public class AvatarDesignPanelTranslator { ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); - TraceManager.addDev("UPPAAL Pragma " + _pragma + " improperly formatted"); + TraceManager.addDev("Safety Pragma " + _pragma + " improperly formatted"); return -1; } return 0; @@ -629,7 +629,7 @@ public class AvatarDesignPanelTranslator { ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); - TraceManager.addDev("UPPAAL Pragma " + _pragma + " improperly formatted"); + TraceManager.addDev("Safety Pragma " + _pragma + " improperly formatted"); return -1; } return 1; @@ -640,7 +640,7 @@ public class AvatarDesignPanelTranslator { ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); - TraceManager.addDev("UPPAAL Pragma " + _pragma + " improperly formatted"); + TraceManager.addDev("Safety Pragma " + _pragma + " improperly formatted"); return -1; } String block = state.split("\\.", 2)[0]; @@ -658,7 +658,7 @@ public class AvatarDesignPanelTranslator { if (bl != null) { AvatarStateMachine asm = bl.getStateMachine(); if (bl.getIndexOfAvatarAttributeWithName(attr) == -1 && asm.getStateWithName(attr) == null) { - UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + + UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " contains invalid attribute or state name " + attr); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); @@ -681,7 +681,7 @@ public class AvatarDesignPanelTranslator { return 0; } } else { - UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + + UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " contains invalid block name " + block); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); @@ -696,7 +696,7 @@ public class AvatarDesignPanelTranslator { int index = getOperatorIndex(state); if (index == -1) { - UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + " cannot parse " + state); + UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " cannot parse " + state); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); @@ -723,7 +723,7 @@ public class AvatarDesignPanelTranslator { switch (optype) { case -1: - ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + " unrecognized " + operator); + ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " unrecognized " + operator); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); addWarning(ce); @@ -732,7 +732,7 @@ public class AvatarDesignPanelTranslator { return -1; case 1: if (!(optypel == 1 && optyper == 1)) { - ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + + ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " expected integer attributes around " + operator); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); @@ -744,7 +744,7 @@ public class AvatarDesignPanelTranslator { break; case 0: if (!(optypel == 0 && optyper == 0)) { - ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + + ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " expected boolean attributes around " + operator); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); @@ -756,7 +756,7 @@ public class AvatarDesignPanelTranslator { break; case 3: if (optypel != optyper) { - ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "UPPAAL Pragma " + _pragma + + ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Safety Pragma " + _pragma + " has incompatible types around " + operator); ce.setTDiagramPanel(adp.getAvatarBDPanel()); ce.setTGComponent(tgc); diff --git a/src/main/java/ui/avatarbd/AvatarBDSafetyPragma.java b/src/main/java/ui/avatarbd/AvatarBDSafetyPragma.java index ae2c4de2d8507ff00315f28867542287a2a4677f..a6a068d1b76f9115cdb08a32f17053333f8e434b 100644 --- a/src/main/java/ui/avatarbd/AvatarBDSafetyPragma.java +++ b/src/main/java/ui/avatarbd/AvatarBDSafetyPragma.java @@ -124,7 +124,7 @@ public class AvatarBDSafetyPragma extends TGCScalableWithoutInternalComponent { editable = true; removable = true; syntaxErrors = new ArrayList<String>(); - name = "UPPAAL Pragma"; + name = "Safety Pragma"; value = ""; myImageIcon = IconManager.imgic6000; diff --git a/src/main/java/ui/window/JFrameAI.java b/src/main/java/ui/window/JFrameAI.java index c188d7fab5e05630184298a3fa7c52869deed341..2218ac5701e65f20a746ee3cb40ebec93e5be31f 100644 --- a/src/main/java/ui/window/JFrameAI.java +++ b/src/main/java/ui/window/JFrameAI.java @@ -291,8 +291,8 @@ public class JFrameAI extends JFrame implements ActionListener { String[] names = {"pico", "zebre", "pingouin", "chien", "minou", "kitty", "chaton", "whatsapp", "Luke Skywalker", "macareux", "ours", "italien", "paris-brest", "belle-mère", "apéro (l'abus d'alcool est dangereux pour la santé)", "carpe", "crocodile", "psychologue", "dr emacs", "3615-TTool", "100 balles et 1 mars", - "opéra (l’abus d’Alcôve est dangereux pour la santé)", "chapon", "perroquet", "chameau volant", "Alice", "Oasis", "ATC RAK", - "Adibou", "Cheval de Troyes", "Twist", "GSM", "Etalon"}; + "opéra (l’abus d’Alcôve est dangereux pour la santé)", "chapon", "perroquet", "chameau volant", "Alice", "oasis", "ATC RAK", + "Adibou", "cheval de Troyes", "Twist", "GSM", "étalon", "jaseux"}; int x = (int) (Math.random() * names.length); return names[x]; } diff --git a/ttool/src/test/java/avatartranslator/AvatarIBSStdParserTest.java b/ttool/src/test/java/avatartranslator/AvatarIBSStdParserTest.java index 236cc0e4a854c4fe13eb4a2721c77216b3e408ac..7a130c9939660923245027a55293d9317919a085 100644 --- a/ttool/src/test/java/avatartranslator/AvatarIBSStdParserTest.java +++ b/ttool/src/test/java/avatartranslator/AvatarIBSStdParserTest.java @@ -268,6 +268,14 @@ public class AvatarIBSStdParserTest { assertTrue(e13!=null); AvatarIBSExpressions.BExpr e14 = AvatarIBSolver.parseBool(block1,"x-40<3"); assertTrue(e14!=null); + + TraceManager.addDev("Testing e15"); + AvatarIBSExpressions.BExpr e15 = AvatarIBSolver.parseBool(block1,"x-40<3*b"); + TraceManager.addDev("Expr e15 built"); + //assertTrue(e15!=null); + //TraceManager.addDev("Testing e15 done"); + + assertTrue(e1.eval(specBlock) == 15); assertTrue(e2.eval(specBlock)); assertTrue(!e3.eval(specBlock));