From 4023fa8a2b5c23e42750add172ba971604a382dc Mon Sep 17 00:00:00 2001 From: Guillotin Damien Date: Tue, 18 Jan 2022 09:20:03 +0100 Subject: [PATCH 1/3] feat: ATL ca avance --- .../fr.n7.game2petrinet/Game2PetriNet.atl | 293 +- .../src-gen/.nfs0000000001ae00dc00000007 | 15 + .../fr.n7.petrinet.examples/src-gen/jeu.net | 4 +- .../fr.n7.game.toPrototype/bin/.gitignore | 1 + .../n7/game/toPrototype/main/toPrototype.emtl | 4240 ++++++++--------- .../xtext/tests/.GameParsingTest.xtendbin | Bin 3389 -> 3389 bytes .../xtext/generator/.GameGenerator.xtendbin | Bin 2284 -> 2284 bytes .../fr.n7.petrinet.toTINA/bin/.gitignore | 1 + 8 files changed, 2279 insertions(+), 2275 deletions(-) create mode 100644 runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 create mode 100644 workspace/fr.n7.game.toPrototype/bin/.gitignore create mode 100644 workspace/fr.n7.petrinet.toTINA/bin/.gitignore diff --git a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl index cf822e4..3b3db31 100755 --- a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl +++ b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl @@ -4,49 +4,7 @@ create OUT: petrinet from IN: game; -helper context game!Explorateur -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Objet -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Connaissance -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Action -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Personne -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Chemin -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Lieu -def: getJeu() : game!Jeu = - game!Jeu.allInstances() - ->asSequence() - ->first(); - -helper context game!Interaction +helper context String def: getJeu() : game!Jeu = game!Jeu.allInstances() ->asSequence() @@ -56,7 +14,7 @@ helper context String def: getTaille() : Integer = game!Objet.allInstances() ->asSequence() - ->select(o | o.nom.nom = self) + ->select(o | o.name = self) ->first().taille; helper context game!Lieu @@ -68,12 +26,6 @@ def : estDepart() : Integer = ->size() > 0) ->size(); --- Obtenir le network -helper def: getNetwork() : petrinet!Network = - petrinet!Network.allInstances() - ->select(n | n.name = 'jeu') - ->asSequence()->first(); - -- Obtenir la taille de l'explorateur helper context String def: getTailleExp() : Integer = @@ -94,7 +46,7 @@ def : getNombreInit() : Integer = game!Explorateur.allInstances() ->asSequence() ->first().objets - ->select(o | o.nom = self.nom.nom) + ->select(o | o.name = self.name) ->size(); -- Nombre de connaissances initiaux de l'explo @@ -103,7 +55,7 @@ def : getNombreInit() : Integer = game!Explorateur.allInstances() ->asSequence() ->first().connaissances - ->select(c | c.nom = self.nom.nom) + ->select(c | c.name = self.name) ->size(); -- Nombre de place libre itiale de l'explo @@ -124,7 +76,7 @@ def: getPlaceOf(s : String): petrinet!Place = helper context game!Lieu def: getPlace(): petrinet!Place = petrinet!Place.allInstances() - ->select(p | p.name = 'lieu_' + self.nom.nom) + ->select(p | p.name = 'lieu_' + self.name) ->asSequence() ->first(); @@ -141,7 +93,7 @@ def: getPersonne(): game!Personne = helper context String def : getObjet() : game!Objet = game!Objet.allInstances() - ->select(o | o.nom.nom = self) + ->select(o | o.name = self) ->asSequence() ->first(); @@ -149,7 +101,7 @@ helper context game!Personne def: getLieu(): game!Lieu = game!Lieu.allInstances() ->select(l | l.personnes - ->select(p | p.nom = self.nom.nom) + ->select(p | p.name = self.name) ->asSequence() ->size() > 0) ->asSequence() @@ -159,16 +111,16 @@ helper context game!Action def : getInteraction() : game!Interaction = game!Interaction.allInstances() ->select(i | i.actions - ->select(a | a.nom.nom = self.nom.nom) + ->select(a | a.name = self.name) ->asSequence() ->size() > 0) ->asSequence() ->first(); -helper context petrinet!Transition -def : getPlace(s : String) : petrinet!Place = +helper context String +def : getPlace() : petrinet!Place = petrinet!Place.allInstances() - ->select(p | p.name = s) + ->select(p | p.name = self) ->asSequence() ->first(); @@ -184,105 +136,111 @@ rule Explorateur2Petrinet { p: petrinet!Place( name <- 'taille', tokens <- e.getNombreInit(), - network <- e.getJeu()) + network <- ''.getJeu()) } rule Objet2PetriNet { from o: game!Objet to p_obj: petrinet!Place( - name <- 'objet_' + o.nom.nom, + name <- 'objet_' + o.name, tokens <- o.getNombreInit(), - network <- o.getJeu()), + network <- ''.getJeu()), p_objneg: petrinet!Place( - name <- 'objet_' + o.nom.nom + '_neg', + name <- 'objet_' + o.name + '_neg', tokens <- ''.getTailleExp() div o.taille - o.getNombreInit(), - network <- o.getJeu()) + network <- ''.getJeu()) } rule Connaissance2PetriNet { from c: game!Connaissance to p_con: petrinet!Place( - name <- 'connaissance_' + c.nom.nom, + name <- 'connaissance_' + c.name, tokens <- c.getNombreInit(), - network <- c.getJeu()), + network <- ''.getJeu()), p_conneg: petrinet!Place( - name <- 'connaissance_' + c.nom.nom + '_neg', + name <- 'connaissance_' + c.name + '_neg', tokens <- 1 - c.getNombreInit(), - network <- c.getJeu()) + network <- ''.getJeu()) } rule Personne2PetriNet { from p: game!Personne to pers: petrinet!Place( - name <- 'personne_' + p.nom.nom, + name <- 'personne_' + p.name, tokens <- 0, - network <- p.getJeu()) + network <- ''.getJeu()) } rule Lieu2PetriNet { from l: game!Lieu to p: petrinet!Place( - name <- 'lieu_' + l.nom.nom, + name <- 'lieu_' + l.name, tokens <- l.estDepart(), - network <- l.getJeu()) + network <- ''.getJeu()) } rule Chemin2PetriNet { from c: game!Chemin - to - t: petrinet!Transition( - name <- 'chemin_' + c.nom.nom, - network <- c.getJeu()), - - arcIn: petrinet!Arc( - place <- c.getPlaceOf('lieu_' + c.lieuIn.nom), - transition <- t, - outgoing <- false, - weight <- 1), - - arcOut: petrinet!Arc( - place <- c.getPlaceOf('lieu_' + c.lieuOut.nom), - transition <- t, - outgoing <- true, - weight <- 1) + using { + index : Integer = 0; + } do { - for (o in c.objetsConso) { - thisModule.consoObjet(t, o.nom); - } - for (o in c.objetsRecus) { - thisModule.recuObjet(t, o.nom); - } - for (con in c.connaissances) { - thisModule.recuConn(t, con.nom); - } - for (cond in c.visible.condition) { - for (cond2 in cond.conditionTest) { - if (cond2.oclIsKindOf(game!ConditionObjet)) { - thisModule.readObjetEga(t, cond2.objet, cond2.nombre); - } else { - if (cond2.negation = '!') { - thisModule.readConnNeg(t, cond2.connaissance); - } else { - thisModule.readConn(t, cond2.connaissance); - } - } + index <- 0; + for (condVis in c.visible.condition) { + for (condOuv in c.ouvert.condition) { + thisModule.newChemin(c, index, condVis.union(condOuv)); + index <- index + 1; } } } } -rule Interaction2PetriNet { - from i: game!Interaction +rule newChemin(c : game!Chemin, index : Integer, conditions : game!ConditionTest) { to t: petrinet!Transition( - name <- 'interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom, - network <- i.getJeu()), + name <- 'chemin_' + c.name + '_' + index.toString(), + network <- ''.getJeu()), + + arcIn: petrinet!Arc( + place <- c.getPlaceOf('lieu_' + c.lieuIn.name), + transition <- t, + outgoing <- false, + weight <- 1), + + arcOut: petrinet!Arc( + place <- c.getPlaceOf('lieu_' + c.lieuOut.name), + transition <- t, + outgoing <- true, + weight <- 1) + do { + for (o in c.objetsConso) { + thisModule.consoObjet(t, o.name); + } + for (o in c.objetsRecus) { + thisModule.recuObjet(t, o.name); + } + for (con in c.connaissances) { + thisModule.recuConn(t, con.name); + } + thisModule.Condition2PetriNet(t, conditions); + } +} + +rule Interaction2PetriNet { + from i: game!Interaction + using { + index : Integer = 0; + } + to + t: petrinet!Transition( + name <- 'interaction_' + i.name + '_' + i.getPersonne().name, + network <- ''.getJeu()), arcOut: petrinet!Arc( place <- i.getPersonne(), @@ -297,28 +255,42 @@ rule Interaction2PetriNet { weight <- 1) do { for (o in i.objetsConso) { - thisModule.consoObjet(t, o.nom); + thisModule.consoObjet(t, o.name); } for (o in i.objetsRecus) { - thisModule.recuObjet(t, o.nom); + thisModule.recuObjet(t, o.name); } for (c in i.connaissances) { - thisModule.recuConn(t, c.nom); + thisModule.recuConn(t, c.name); } - for (cond in i.getPersonne().visible.condition) { - for (cond2 in cond.conditionTest) { - if (cond2.oclIsKindOf(game!ConditionObjet)) { - if (cond2.comparateur = '==') { - thisModule.readObjetEga(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.objet, cond2.nombre); - } else if (cond2.comparateur = '>') { - thisModule.readObjetSup(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.objet, cond2.nombre); - } + index <- 0; + for (condV in i.getPersonne().visible.condition) { + thisModule.Condition2PetriNet(('interaction_' + i.name + '_' + i.getPersonne().name).getTransition(), condV); + index <- index + 1; + } + } +} + +rule Condition2PetriNet(t : petrinet!Transition, c : game!Condition) { + do { + for (cond in c) { + if (cond.oclIsKindOf(game!ConditionObjet)) { + if (cond.comparateur = '==') { + thisModule.readObjetEga(t, cond.objet, cond.nombre); + } else if (cond.comparateur = '>') { + thisModule.readObjetSup(t, cond.objet, cond.nombre); + } else if (cond.comparateur = '>=') { + thisModule.readObjetSup(t, cond.objet, cond.nombre - 1); + } else if (cond.comparateur = '<') { + thisModule.readObjetInf(t, cond.objet, cond.nombre); + } else if (cond.comparateur = '<=') { + thisModule.readObjetInf(t, cond.objet, cond.nombre + 1); + } + } else { + if (cond.negation = '!') { + thisModule.readConnNeg(t, cond.connaissance); } else { - if (cond2.negation = '!') { - thisModule.readConnNeg(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.connaissance); - } else { - thisModule.readConn(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.connaissance); - } + thisModule.readConn(t, cond.connaissance); } } } @@ -329,8 +301,8 @@ rule Action2PetriNet { from a: game!Action to t: petrinet!Transition( - name <- 'action_' + a.nom.nom, - network <- a.getJeu()), + name <- 'action_' + a.name, + network <- ''.getJeu()), arcIn: petrinet!Arc( place <- a.getInteraction().getPersonne(), @@ -345,13 +317,13 @@ rule Action2PetriNet { weight <- 1) do { for (o in a.objetsConso) { - thisModule.consoObjet(t, o.nom); + thisModule.consoObjet(t, o.name); } for (o in a.objetsRecus) { - thisModule.recuObjet(t, o.nom); + thisModule.recuObjet(t, o.name); } for (c in a.connaissances) { - thisModule.recuConn(t, c.nom); + thisModule.recuConn(t, c.name); } } } @@ -359,19 +331,19 @@ rule Action2PetriNet { rule consoObjet(t : game!Transition, s : String) { to arc : petrinet!Arc( - place <- t.getPlace('objet_' + s), + place <- ('objet_' + s).getPlace(), transition <- t, outgoing <- false, weight <- 1), arcNeg : petrinet!Arc( - place <- t.getPlace('objet_' + s + '_neg'), + place <- ('objet_' + s + '_neg').getPlace(), transition <- t, outgoing <- true, weight <- 1), arcTaille : petrinet!Arc( - place <- t.getPlace('taille'), + place <- 'taille'.getPlace(), transition <- t, outgoing <- true, weight <- s.getObjet().taille) @@ -380,55 +352,70 @@ rule consoObjet(t : game!Transition, s : String) { rule readObjetEga(t : game!Transition, s : String, n : Integer) { to arc : petrinet!Arc( - place <- t.getPlace('objet_' + s), + place <- ('objet_' + s).getPlace(), transition <- t, outgoing <- false, weight <- n), arc2 : petrinet!Arc( - place <- t.getPlace('objet_' + s), + place <- ('objet_' + s).getPlace(), transition <- t, outgoing <- true, weight <- n), arc_neg : petrinet!Arc( - place <- t.getPlace('objet_' + s + '_neg'), + place <- ('objet_' + s + '_neg').getPlace(), transition <- t, outgoing <- false, - weight <- (s.getTailleExp() div s.getTaille()) - n), + weight <- (''.getTailleExp() div s.getTaille()) - n), arc2_neg : petrinet!Arc( - place <- t.getPlace('objet_' + s + '_neg'), + place <- ('objet_' + s + '_neg').getPlace(), transition <- t, outgoing <- true, - weight <- (s.getTailleExp() div s.getTaille()) - n) + weight <- (''.getTailleExp() div s.getTaille()) - n) } rule readObjetSup(t : game!Transition, s : String, n : Integer) { to arc : petrinet!Arc( - place <- t.getPlace('objet_' + s), + place <- ('objet_' + s).getPlace(), transition <- t, outgoing <- false, weight <- n + 1), arc2 : petrinet!Arc( - place <- t.getPlace('objet_' + s), + place <- ('objet_' + s).getPlace(), transition <- t, outgoing <- true, weight <- n + 1) } +rule readObjetInf(t : game!Transition, s : String, n : Integer) { + to + arc : petrinet!Arc( + place <- ('objet_' + s + '_neg').getPlace(), + transition <- t, + outgoing <- false, + weight <- (s.getTailleExp() div s.getTaille()) - n + 1), + + arc2 : petrinet!Arc( + place <- ('objet_' + s + '_neg').getPlace(), + transition <- t, + outgoing <- true, + weight <- (s.getTailleExp() div s.getTaille()) - n + 1) +} + rule readConn(t : game!Transition, s : String) { to arc : petrinet!Arc( - place <- t.getPlace('connaissance_' + s), + place <- ('connaissance_' + s).getPlace(), transition <- t, outgoing <- false, weight <- 1), arc2 : petrinet!Arc( - place <- t.getPlace('connaissance_' + s), + place <- ('connaissance_' + s).getPlace(), transition <- t, outgoing <- true, weight <- 1) @@ -437,13 +424,13 @@ rule readConn(t : game!Transition, s : String) { rule readConnNeg(t : game!Transition, s : String) { to arc : petrinet!Arc( - place <- t.getPlace('connaissance_' + s + '_neg'), + place <- ('connaissance_' + s + '_neg').getPlace(), transition <- t, outgoing <- false, weight <- 1), arc2 : petrinet!Arc( - place <- t.getPlace('connaissance_' + s + '_neg'), + place <- ('connaissance_' + s + '_neg').getPlace(), transition <- t, outgoing <- true, weight <- 1) @@ -452,19 +439,19 @@ rule readConnNeg(t : game!Transition, s : String) { rule recuObjet(t : game!Transition, s : String) { to arc : petrinet!Arc( - place <- t.getPlace('objet_' + s), + place <- ('objet_' + s).getPlace(), transition <- t, outgoing <- true, weight <- 1), arcNeg : petrinet!Arc( - place <- t.getPlace('objet_' + s + '_neg'), + place <- ('objet_' + s + '_neg').getPlace(), transition <- t, outgoing <- false, weight <- 1), arcTaille : petrinet!Arc( - place <- t.getPlace('taille'), + place <- 'taille'.getPlace(), transition <- t, outgoing <- false, weight <- s.getObjet().taille) @@ -473,13 +460,13 @@ rule recuObjet(t : game!Transition, s : String) { rule recuConn(t : game!Transition, s : String) { to arc : petrinet!Arc( - place <- t.getPlace('connaissance_' + s), + place <- ('connaissance_' + s).getPlace(), transition <- t, outgoing <- true, weight <- 1), arcNeg : petrinet!Arc( - place <- t.getPlace('connaissance_' + s + '_neg'), + place <- ('connaissance_' + s + '_neg').getPlace(), transition <- t, outgoing <- false, weight <- 1) diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 b/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 new file mode 100644 index 0000000..a8d10bf --- /dev/null +++ b/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 @@ -0,0 +1,15 @@ +net jeu +pl taille (0) +pl objet_tentative (3) +pl objet_tentative_neg (0) +pl connaissance_Reussite (0) +pl connaissance_Reussite_neg (1) +pl personne_Sphinx (0) +pl lieu_Enigme (1) +pl lieu_Succes (0) +pl lieu_Echec (0) +tr chemin_Win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 +tr chemin_Loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 +tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 +tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 +tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net index c4d42fe..a8d10bf 100644 --- a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net +++ b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net @@ -8,8 +8,8 @@ pl personne_Sphinx (0) pl lieu_Enigme (1) pl lieu_Succes (0) pl lieu_Echec (0) -tr chemin_win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 -tr chemin_loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 +tr chemin_Win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 +tr chemin_Loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/workspace/fr.n7.game.toPrototype/bin/.gitignore b/workspace/fr.n7.game.toPrototype/bin/.gitignore new file mode 100644 index 0000000..44fde90 --- /dev/null +++ b/workspace/fr.n7.game.toPrototype/bin/.gitignore @@ -0,0 +1 @@ +/fr/ diff --git a/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl b/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl index 99a5201..54728bc 100644 --- a/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl +++ b/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl @@ -14,7 +14,7 @@ - + @@ -123,7 +123,7 @@ - + @@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-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/workspace/fr.n7.game.xtext.tests/xtend-gen/fr/n7/game/xtext/tests/.GameParsingTest.xtendbin b/workspace/fr.n7.game.xtext.tests/xtend-gen/fr/n7/game/xtext/tests/.GameParsingTest.xtendbin index 68e04d19823ad54548b399d0726ee32be9c4d900..a7cbff0f10a7782766605e819234e9799fd8a1ff 100644 GIT binary patch delta 58 zcmdlhwO5KKz?+#xgn@&DgW+`7MxGC>OsBgx|6}!M0nz?kdQ3oiay^d)h}y~H0HS{L GH~|120~AsK delta 58 zcmdlhwO5KKz?+#xgn@&DgW+x6MxGC>OmFKp|6}!M0nz?kdQ3oiay^d)h}y~H0HS{L GH~|1E*A&(O diff --git a/workspace/fr.n7.game.xtext/xtend-gen/fr/n7/game/xtext/generator/.GameGenerator.xtendbin b/workspace/fr.n7.game.xtext/xtend-gen/fr/n7/game/xtext/generator/.GameGenerator.xtendbin index 40a7f24ca8f618b5f4d8d3ad465a2f4df1950cac..3a7f63ff4fa8d7744f95187a1b12c87da1d72093 100644 GIT binary patch delta 58 zcmaDO_(qT?z?+#xgn@&DgW*)yMxH&)OsBdwpJHxc0?|Hf4;X>;WIYZG5S78<0HRiL GH~|1ENfZVE delta 58 zcmaDO_(qT?z?+#xgn@&DgW+x6MxH&)OmFKppJHxc0?|Hf4;X>;WIYZG5S78<0HRiL GH~|1RuN05~ diff --git a/workspace/fr.n7.petrinet.toTINA/bin/.gitignore b/workspace/fr.n7.petrinet.toTINA/bin/.gitignore new file mode 100644 index 0000000..44fde90 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/bin/.gitignore @@ -0,0 +1 @@ +/fr/ From 8d09b1d3621eaeaebf42827950694a1d32630eab Mon Sep 17 00:00:00 2001 From: Guillotin Damien Date: Tue, 18 Jan 2022 12:08:49 +0100 Subject: [PATCH 2/3] FEAT: toujours meilleur --- .../fr.n7.game2petrinet/Game2PetriNet.atl | 82 ++++++++------ .../src-gen/.nfs0000000001ae00dd00000022 | 15 +++ .../fr.n7.petrinet.examples/src-gen/jeu.net | 6 +- .../antlr/internal/InternalGame.g | 20 ++-- .../antlr/internal/InternalGameLexer.java | 102 +++++++++--------- .../antlr/internal/InternalGameParser.java | 72 ++++++++----- .../AbstractGameProposalProvider.java | 4 +- .../model/generated/Game.ecore | 4 +- .../model/generated/Game.genmodel | 4 +- .../src-gen/fr/n7/game/xtext/Game.xtextbin | Bin 6854 -> 6890 bytes .../xtext/game/ConditionConnaissance.java | 14 +-- .../fr/n7/game/xtext/game/ConditionObjet.java | 14 +-- .../fr/n7/game/xtext/game/GamePackage.java | 24 ++--- .../game/impl/ConditionConnaissanceImpl.java | 53 +++++---- .../xtext/game/impl/ConditionObjetImpl.java | 55 ++++++---- .../game/xtext/game/impl/GamePackageImpl.java | 16 +-- .../parser/antlr/internal/InternalGame.g | 26 ++--- .../antlr/internal/InternalGameLexer.java | 102 +++++++++--------- .../antlr/internal/InternalGameParser.java | 88 +++++++-------- .../serializer/GameSemanticSequencer.java | 6 +- .../xtext/services/GameGrammarAccess.java | 32 +++--- .../src/fr/n7/game/xtext/Game.xtext | 16 +-- 22 files changed, 409 insertions(+), 346 deletions(-) create mode 100644 runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 diff --git a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl index 3b3db31..9221f23 100755 --- a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl +++ b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl @@ -65,13 +65,6 @@ def : getNombreInit() : Integer = ->asSequence() ->iterate(o; res : Integer = self.tailleInventaire | res - o.getNombreInit() * o.taille); --- Obtenir la place d'un chemin (in / out) -helper context game!Chemin -def: getPlaceOf(s : String): petrinet!Place = - petrinet!Place.allInstances() - ->select(p | p.name = s) - ->asSequence() - ->first(); helper context game!Lieu def: getPlace(): petrinet!Place = @@ -194,7 +187,7 @@ rule Chemin2PetriNet { index <- 0; for (condVis in c.visible.condition) { for (condOuv in c.ouvert.condition) { - thisModule.newChemin(c, index, condVis.union(condOuv)); + thisModule.newChemin(c, index, condVis.conditionTest.union(condOuv.conditionTest)); index <- index + 1; } } @@ -208,13 +201,13 @@ rule newChemin(c : game!Chemin, index : Integer, conditions : game!ConditionTest network <- ''.getJeu()), arcIn: petrinet!Arc( - place <- c.getPlaceOf('lieu_' + c.lieuIn.name), + place <- ('lieu_' + c.lieuIn.name).getPlace(), transition <- t, outgoing <- false, weight <- 1), arcOut: petrinet!Arc( - place <- c.getPlaceOf('lieu_' + c.lieuOut.name), + place <- ('lieu_' + c.lieuOut.name).getPlace(), transition <- t, outgoing <- true, weight <- 1) @@ -237,19 +230,29 @@ rule Interaction2PetriNet { using { index : Integer = 0; } + do { + index <- 0; + for (condVis in i.getPersonne().visible.condition) { + thisModule.newInteraction(i, index, condVis.conditionTest); + index <- index + 1; + } + } +} + +rule newInteraction(i : game!Interaction, index : Integer, conditions : game!ConditionTest) { to t: petrinet!Transition( - name <- 'interaction_' + i.name + '_' + i.getPersonne().name, + name <- 'interaction_' + i.name + '_' + i.getPersonne().name + '_' + index.toString(), network <- ''.getJeu()), - - arcOut: petrinet!Arc( - place <- i.getPersonne(), + + arcIn: petrinet!Arc( + place <- ('personne_' + i.getPersonne().name).getPlace(), transition <- t, outgoing <- true, weight <- 1), - - arcIn: petrinet!Arc( - place <- i.getPersonne().getLieu().getPlace(), + + arcOut: petrinet!Arc( + place <- ('lieu_' + i.getPersonne().getLieu().name).getPlace(), transition <- t, outgoing <- false, weight <- 1) @@ -260,38 +263,36 @@ rule Interaction2PetriNet { for (o in i.objetsRecus) { thisModule.recuObjet(t, o.name); } - for (c in i.connaissances) { - thisModule.recuConn(t, c.name); - } - index <- 0; - for (condV in i.getPersonne().visible.condition) { - thisModule.Condition2PetriNet(('interaction_' + i.name + '_' + i.getPersonne().name).getTransition(), condV); - index <- index + 1; + for (con in i.connaissances) { + thisModule.recuConn(t, con.name); } + thisModule.Condition2PetriNet(t, conditions); } } + rule Condition2PetriNet(t : petrinet!Transition, c : game!Condition) { do { for (cond in c) { if (cond.oclIsKindOf(game!ConditionObjet)) { if (cond.comparateur = '==') { - thisModule.readObjetEga(t, cond.objet, cond.nombre); + thisModule.readObjetEga(t, cond.objet.name, cond.nombre); } else if (cond.comparateur = '>') { - thisModule.readObjetSup(t, cond.objet, cond.nombre); + thisModule.readObjetSup(t, cond.objet.name, cond.nombre); } else if (cond.comparateur = '>=') { - thisModule.readObjetSup(t, cond.objet, cond.nombre - 1); + thisModule.readObjetSup(t, cond.objet.name, cond.nombre - 1); } else if (cond.comparateur = '<') { - thisModule.readObjetInf(t, cond.objet, cond.nombre); + thisModule.readObjetInf(t, cond.objet.name, cond.nombre); } else if (cond.comparateur = '<=') { - thisModule.readObjetInf(t, cond.objet, cond.nombre + 1); + thisModule.readObjetInf(t, cond.objet.name, cond.nombre + 1); + } + } else if (cond.oclIsKindOf(game!ConditionConnaissance)) { + if (cond.negation = '!') { + thisModule.readConnNeg(t, cond.connaissance.name); + } else { + thisModule.readConn(t, cond.connaissance.name); } } else { - if (cond.negation = '!') { - thisModule.readConnNeg(t, cond.connaissance); - } else { - thisModule.readConn(t, cond.connaissance); - } } } } @@ -299,6 +300,19 @@ rule Condition2PetriNet(t : petrinet!Transition, c : game!Condition) { rule Action2PetriNet { from a: game!Action + using { + index : Integer = 0; + } + do { + index <- 0; + for (condVis in a.visible.condition) { + thisModule.newAction(a, index, condVis.conditionTest); + index <- index + 1; + } + } +} + +rule newAction(a : game!Action, index : Integer, conditions : game!ConditionTest) { to t: petrinet!Transition( name <- 'action_' + a.name, diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 b/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 new file mode 100644 index 0000000..a8d10bf --- /dev/null +++ b/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 @@ -0,0 +1,15 @@ +net jeu +pl taille (0) +pl objet_tentative (3) +pl objet_tentative_neg (0) +pl connaissance_Reussite (0) +pl connaissance_Reussite_neg (1) +pl personne_Sphinx (0) +pl lieu_Enigme (1) +pl lieu_Succes (0) +pl lieu_Echec (0) +tr chemin_Win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 +tr chemin_Loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 +tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 +tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 +tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net index a8d10bf..eae9517 100644 --- a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net +++ b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net @@ -8,8 +8,8 @@ pl personne_Sphinx (0) pl lieu_Enigme (1) pl lieu_Succes (0) pl lieu_Echec (0) -tr chemin_Win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 -tr chemin_Loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 -tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 +tr chemin_Win_0 lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 +tr chemin_Loose_0 lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 +tr interaction_Parler_Sphinx_0 lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGame.g b/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGame.g index effa784..d827adb 100644 --- a/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGame.g +++ b/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGame.g @@ -8208,9 +8208,13 @@ rule__ConditionConnaissance__ConnaissanceAssignment_1 } : ( - { before(grammarAccess.getConditionConnaissanceAccess().getConnaissanceIDTerminalRuleCall_1_0()); } - RULE_ID - { after(grammarAccess.getConditionConnaissanceAccess().getConnaissanceIDTerminalRuleCall_1_0()); } + { before(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceCrossReference_1_0()); } + ( + { before(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceIDTerminalRuleCall_1_0_1()); } + RULE_ID + { after(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceIDTerminalRuleCall_1_0_1()); } + ) + { after(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceCrossReference_1_0()); } ) ; finally { @@ -8223,9 +8227,13 @@ rule__ConditionObjet__ObjetAssignment_0 } : ( - { before(grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0()); } - RULE_ID - { after(grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0()); } + { before(grammarAccess.getConditionObjetAccess().getObjetObjetCrossReference_0_0()); } + ( + { before(grammarAccess.getConditionObjetAccess().getObjetObjetIDTerminalRuleCall_0_0_1()); } + RULE_ID + { after(grammarAccess.getConditionObjetAccess().getObjetObjetIDTerminalRuleCall_0_0_1()); } + ) + { after(grammarAccess.getConditionObjetAccess().getObjetObjetCrossReference_0_0()); } ) ; finally { diff --git a/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameLexer.java b/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameLexer.java index 69c2e83..74af28c 100644 --- a/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameLexer.java +++ b/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameLexer.java @@ -808,10 +808,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_COMPARATEUR; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8265:18: ( ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) ) - // InternalGame.g:8265:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) + // InternalGame.g:8273:18: ( ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) ) + // InternalGame.g:8273:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) { - // InternalGame.g:8265:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) + // InternalGame.g:8273:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) int alt1=6; switch ( input.LA(1) ) { case '<': @@ -855,21 +855,21 @@ public class InternalGameLexer extends Lexer { switch (alt1) { case 1 : - // InternalGame.g:8265:21: '<' + // InternalGame.g:8273:21: '<' { match('<'); } break; case 2 : - // InternalGame.g:8265:25: '>' + // InternalGame.g:8273:25: '>' { match('>'); } break; case 3 : - // InternalGame.g:8265:29: '==' + // InternalGame.g:8273:29: '==' { match("=="); @@ -877,7 +877,7 @@ public class InternalGameLexer extends Lexer { } break; case 4 : - // InternalGame.g:8265:34: '<=' + // InternalGame.g:8273:34: '<=' { match("<="); @@ -885,7 +885,7 @@ public class InternalGameLexer extends Lexer { } break; case 5 : - // InternalGame.g:8265:39: '>=' + // InternalGame.g:8273:39: '>=' { match(">="); @@ -893,7 +893,7 @@ public class InternalGameLexer extends Lexer { } break; case 6 : - // InternalGame.g:8265:44: '!=' + // InternalGame.g:8273:44: '!=' { match("!="); @@ -919,10 +919,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_BOOLEAN; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8267:14: ( ( 'true' | 'false' ) ) - // InternalGame.g:8267:16: ( 'true' | 'false' ) + // InternalGame.g:8275:14: ( ( 'true' | 'false' ) ) + // InternalGame.g:8275:16: ( 'true' | 'false' ) { - // InternalGame.g:8267:16: ( 'true' | 'false' ) + // InternalGame.g:8275:16: ( 'true' | 'false' ) int alt2=2; int LA2_0 = input.LA(1); @@ -940,7 +940,7 @@ public class InternalGameLexer extends Lexer { } switch (alt2) { case 1 : - // InternalGame.g:8267:17: 'true' + // InternalGame.g:8275:17: 'true' { match("true"); @@ -948,7 +948,7 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:8267:24: 'false' + // InternalGame.g:8275:24: 'false' { match("false"); @@ -974,10 +974,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_ID; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8269:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) - // InternalGame.g:8269:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // InternalGame.g:8277:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalGame.g:8277:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* { - // InternalGame.g:8269:11: ( '^' )? + // InternalGame.g:8277:11: ( '^' )? int alt3=2; int LA3_0 = input.LA(1); @@ -986,7 +986,7 @@ public class InternalGameLexer extends Lexer { } switch (alt3) { case 1 : - // InternalGame.g:8269:11: '^' + // InternalGame.g:8277:11: '^' { match('^'); @@ -1004,7 +1004,7 @@ public class InternalGameLexer extends Lexer { recover(mse); throw mse;} - // InternalGame.g:8269:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // InternalGame.g:8277:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* loop4: do { int alt4=2; @@ -1053,10 +1053,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_INT; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8271:10: ( ( '0' .. '9' )+ ) - // InternalGame.g:8271:12: ( '0' .. '9' )+ + // InternalGame.g:8279:10: ( ( '0' .. '9' )+ ) + // InternalGame.g:8279:12: ( '0' .. '9' )+ { - // InternalGame.g:8271:12: ( '0' .. '9' )+ + // InternalGame.g:8279:12: ( '0' .. '9' )+ int cnt5=0; loop5: do { @@ -1070,7 +1070,7 @@ public class InternalGameLexer extends Lexer { switch (alt5) { case 1 : - // InternalGame.g:8271:13: '0' .. '9' + // InternalGame.g:8279:13: '0' .. '9' { matchRange('0','9'); @@ -1102,10 +1102,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_STRING; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8273:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) - // InternalGame.g:8273:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + // InternalGame.g:8281:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalGame.g:8281:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) { - // InternalGame.g:8273:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + // InternalGame.g:8281:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) int alt8=2; int LA8_0 = input.LA(1); @@ -1123,10 +1123,10 @@ public class InternalGameLexer extends Lexer { } switch (alt8) { case 1 : - // InternalGame.g:8273:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + // InternalGame.g:8281:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' { match('\"'); - // InternalGame.g:8273:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + // InternalGame.g:8281:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* loop6: do { int alt6=3; @@ -1142,7 +1142,7 @@ public class InternalGameLexer extends Lexer { switch (alt6) { case 1 : - // InternalGame.g:8273:21: '\\\\' . + // InternalGame.g:8281:21: '\\\\' . { match('\\'); matchAny(); @@ -1150,7 +1150,7 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:8273:28: ~ ( ( '\\\\' | '\"' ) ) + // InternalGame.g:8281:28: ~ ( ( '\\\\' | '\"' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1175,10 +1175,10 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:8273:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + // InternalGame.g:8281:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' { match('\''); - // InternalGame.g:8273:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + // InternalGame.g:8281:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* loop7: do { int alt7=3; @@ -1194,7 +1194,7 @@ public class InternalGameLexer extends Lexer { switch (alt7) { case 1 : - // InternalGame.g:8273:54: '\\\\' . + // InternalGame.g:8281:54: '\\\\' . { match('\\'); matchAny(); @@ -1202,7 +1202,7 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:8273:61: ~ ( ( '\\\\' | '\\'' ) ) + // InternalGame.g:8281:61: ~ ( ( '\\\\' | '\\'' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1245,12 +1245,12 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_ML_COMMENT; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8275:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) - // InternalGame.g:8275:19: '/*' ( options {greedy=false; } : . )* '*/' + // InternalGame.g:8283:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalGame.g:8283:19: '/*' ( options {greedy=false; } : . )* '*/' { match("/*"); - // InternalGame.g:8275:24: ( options {greedy=false; } : . )* + // InternalGame.g:8283:24: ( options {greedy=false; } : . )* loop9: do { int alt9=2; @@ -1275,7 +1275,7 @@ public class InternalGameLexer extends Lexer { switch (alt9) { case 1 : - // InternalGame.g:8275:52: . + // InternalGame.g:8283:52: . { matchAny(); @@ -1305,12 +1305,12 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_SL_COMMENT; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8277:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) - // InternalGame.g:8277:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? + // InternalGame.g:8285:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) + // InternalGame.g:8285:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? { match("//"); - // InternalGame.g:8277:24: (~ ( ( '\\n' | '\\r' ) ) )* + // InternalGame.g:8285:24: (~ ( ( '\\n' | '\\r' ) ) )* loop10: do { int alt10=2; @@ -1323,7 +1323,7 @@ public class InternalGameLexer extends Lexer { switch (alt10) { case 1 : - // InternalGame.g:8277:24: ~ ( ( '\\n' | '\\r' ) ) + // InternalGame.g:8285:24: ~ ( ( '\\n' | '\\r' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1343,7 +1343,7 @@ public class InternalGameLexer extends Lexer { } } while (true); - // InternalGame.g:8277:40: ( ( '\\r' )? '\\n' )? + // InternalGame.g:8285:40: ( ( '\\r' )? '\\n' )? int alt12=2; int LA12_0 = input.LA(1); @@ -1352,9 +1352,9 @@ public class InternalGameLexer extends Lexer { } switch (alt12) { case 1 : - // InternalGame.g:8277:41: ( '\\r' )? '\\n' + // InternalGame.g:8285:41: ( '\\r' )? '\\n' { - // InternalGame.g:8277:41: ( '\\r' )? + // InternalGame.g:8285:41: ( '\\r' )? int alt11=2; int LA11_0 = input.LA(1); @@ -1363,7 +1363,7 @@ public class InternalGameLexer extends Lexer { } switch (alt11) { case 1 : - // InternalGame.g:8277:41: '\\r' + // InternalGame.g:8285:41: '\\r' { match('\r'); @@ -1395,10 +1395,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_WS; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8279:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) - // InternalGame.g:8279:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // InternalGame.g:8287:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalGame.g:8287:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ { - // InternalGame.g:8279:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // InternalGame.g:8287:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ int cnt13=0; loop13: do { @@ -1452,8 +1452,8 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_ANY_OTHER; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:8281:16: ( . ) - // InternalGame.g:8281:18: . + // InternalGame.g:8289:16: ( . ) + // InternalGame.g:8289:18: . { matchAny(); diff --git a/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameParser.java b/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameParser.java index a9798cf..0e47b91 100644 --- a/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameParser.java +++ b/workspace/fr.n7.game.xtext.ide/src-gen/fr/n7/game/xtext/ide/contentassist/antlr/internal/InternalGameParser.java @@ -1515,12 +1515,12 @@ public class InternalGameParser extends AbstractInternalContentAssistParser { { int LA1_3 = input.LA(2); - if ( (LA1_3==RULE_COMPARATEUR) ) { - alt1=3; - } - else if ( (LA1_3==EOF||LA1_3==15||LA1_3==17||(LA1_3>=19 && LA1_3<=20)||(LA1_3>=22 && LA1_3<=23)||LA1_3==25||(LA1_3>=27 && LA1_3<=28)||(LA1_3>=32 && LA1_3<=34)||LA1_3==38||LA1_3==41||LA1_3==43||(LA1_3>=45 && LA1_3<=46)) ) { + if ( (LA1_3==EOF||LA1_3==15||LA1_3==17||(LA1_3>=19 && LA1_3<=20)||(LA1_3>=22 && LA1_3<=23)||LA1_3==25||(LA1_3>=27 && LA1_3<=28)||(LA1_3>=32 && LA1_3<=34)||LA1_3==38||LA1_3==41||LA1_3==43||(LA1_3>=45 && LA1_3<=46)) ) { alt1=2; } + else if ( (LA1_3==RULE_COMPARATEUR) ) { + alt1=3; + } else { NoViableAltException nvae = new NoViableAltException("", 1, 3, input); @@ -24160,21 +24160,29 @@ public class InternalGameParser extends AbstractInternalContentAssistParser { // $ANTLR start "rule__ConditionConnaissance__ConnaissanceAssignment_1" - // InternalGame.g:8205:1: rule__ConditionConnaissance__ConnaissanceAssignment_1 : ( RULE_ID ) ; + // InternalGame.g:8205:1: rule__ConditionConnaissance__ConnaissanceAssignment_1 : ( ( RULE_ID ) ) ; public final void rule__ConditionConnaissance__ConnaissanceAssignment_1() throws RecognitionException { int stackSize = keepStackSize(); try { - // InternalGame.g:8209:1: ( ( RULE_ID ) ) - // InternalGame.g:8210:2: ( RULE_ID ) + // InternalGame.g:8209:1: ( ( ( RULE_ID ) ) ) + // InternalGame.g:8210:2: ( ( RULE_ID ) ) { - // InternalGame.g:8210:2: ( RULE_ID ) - // InternalGame.g:8211:3: RULE_ID + // InternalGame.g:8210:2: ( ( RULE_ID ) ) + // InternalGame.g:8211:3: ( RULE_ID ) { - before(grammarAccess.getConditionConnaissanceAccess().getConnaissanceIDTerminalRuleCall_1_0()); + before(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceCrossReference_1_0()); + // InternalGame.g:8212:3: ( RULE_ID ) + // InternalGame.g:8213:4: RULE_ID + { + before(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceIDTerminalRuleCall_1_0_1()); match(input,RULE_ID,FOLLOW_2); - after(grammarAccess.getConditionConnaissanceAccess().getConnaissanceIDTerminalRuleCall_1_0()); + after(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceIDTerminalRuleCall_1_0_1()); + + } + + after(grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceCrossReference_1_0()); } @@ -24197,21 +24205,29 @@ public class InternalGameParser extends AbstractInternalContentAssistParser { // $ANTLR start "rule__ConditionObjet__ObjetAssignment_0" - // InternalGame.g:8220:1: rule__ConditionObjet__ObjetAssignment_0 : ( RULE_ID ) ; + // InternalGame.g:8224:1: rule__ConditionObjet__ObjetAssignment_0 : ( ( RULE_ID ) ) ; public final void rule__ConditionObjet__ObjetAssignment_0() throws RecognitionException { int stackSize = keepStackSize(); try { - // InternalGame.g:8224:1: ( ( RULE_ID ) ) - // InternalGame.g:8225:2: ( RULE_ID ) + // InternalGame.g:8228:1: ( ( ( RULE_ID ) ) ) + // InternalGame.g:8229:2: ( ( RULE_ID ) ) { - // InternalGame.g:8225:2: ( RULE_ID ) - // InternalGame.g:8226:3: RULE_ID + // InternalGame.g:8229:2: ( ( RULE_ID ) ) + // InternalGame.g:8230:3: ( RULE_ID ) { - before(grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0()); + before(grammarAccess.getConditionObjetAccess().getObjetObjetCrossReference_0_0()); + // InternalGame.g:8231:3: ( RULE_ID ) + // InternalGame.g:8232:4: RULE_ID + { + before(grammarAccess.getConditionObjetAccess().getObjetObjetIDTerminalRuleCall_0_0_1()); match(input,RULE_ID,FOLLOW_2); - after(grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0()); + after(grammarAccess.getConditionObjetAccess().getObjetObjetIDTerminalRuleCall_0_0_1()); + + } + + after(grammarAccess.getConditionObjetAccess().getObjetObjetCrossReference_0_0()); } @@ -24234,17 +24250,17 @@ public class InternalGameParser extends AbstractInternalContentAssistParser { // $ANTLR start "rule__ConditionObjet__ComparateurAssignment_1" - // InternalGame.g:8235:1: rule__ConditionObjet__ComparateurAssignment_1 : ( RULE_COMPARATEUR ) ; + // InternalGame.g:8243:1: rule__ConditionObjet__ComparateurAssignment_1 : ( RULE_COMPARATEUR ) ; public final void rule__ConditionObjet__ComparateurAssignment_1() throws RecognitionException { int stackSize = keepStackSize(); try { - // InternalGame.g:8239:1: ( ( RULE_COMPARATEUR ) ) - // InternalGame.g:8240:2: ( RULE_COMPARATEUR ) + // InternalGame.g:8247:1: ( ( RULE_COMPARATEUR ) ) + // InternalGame.g:8248:2: ( RULE_COMPARATEUR ) { - // InternalGame.g:8240:2: ( RULE_COMPARATEUR ) - // InternalGame.g:8241:3: RULE_COMPARATEUR + // InternalGame.g:8248:2: ( RULE_COMPARATEUR ) + // InternalGame.g:8249:3: RULE_COMPARATEUR { before(grammarAccess.getConditionObjetAccess().getComparateurCOMPARATEURTerminalRuleCall_1_0()); match(input,RULE_COMPARATEUR,FOLLOW_2); @@ -24271,17 +24287,17 @@ public class InternalGameParser extends AbstractInternalContentAssistParser { // $ANTLR start "rule__ConditionObjet__NombreAssignment_2" - // InternalGame.g:8250:1: rule__ConditionObjet__NombreAssignment_2 : ( RULE_INT ) ; + // InternalGame.g:8258:1: rule__ConditionObjet__NombreAssignment_2 : ( RULE_INT ) ; public final void rule__ConditionObjet__NombreAssignment_2() throws RecognitionException { int stackSize = keepStackSize(); try { - // InternalGame.g:8254:1: ( ( RULE_INT ) ) - // InternalGame.g:8255:2: ( RULE_INT ) + // InternalGame.g:8262:1: ( ( RULE_INT ) ) + // InternalGame.g:8263:2: ( RULE_INT ) { - // InternalGame.g:8255:2: ( RULE_INT ) - // InternalGame.g:8256:3: RULE_INT + // InternalGame.g:8263:2: ( RULE_INT ) + // InternalGame.g:8264:3: RULE_INT { before(grammarAccess.getConditionObjetAccess().getNombreINTTerminalRuleCall_2_0()); match(input,RULE_INT,FOLLOW_2); diff --git a/workspace/fr.n7.game.xtext.ui/src-gen/fr/n7/game/xtext/ui/contentassist/AbstractGameProposalProvider.java b/workspace/fr.n7.game.xtext.ui/src-gen/fr/n7/game/xtext/ui/contentassist/AbstractGameProposalProvider.java index 15ca7ee..98489be 100644 --- a/workspace/fr.n7.game.xtext.ui/src-gen/fr/n7/game/xtext/ui/contentassist/AbstractGameProposalProvider.java +++ b/workspace/fr.n7.game.xtext.ui/src-gen/fr/n7/game/xtext/ui/contentassist/AbstractGameProposalProvider.java @@ -211,10 +211,10 @@ public abstract class AbstractGameProposalProvider extends TerminalsProposalProv // subclasses may override } public void completeConditionConnaissance_Connaissance(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { - completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); + lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); } public void completeConditionObjet_Objet(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { - completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); + lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); } public void completeConditionObjet_Comparateur(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); diff --git a/workspace/fr.n7.game.xtext/model/generated/Game.ecore b/workspace/fr.n7.game.xtext/model/generated/Game.ecore index cbf2d49..663a371 100644 --- a/workspace/fr.n7.game.xtext/model/generated/Game.ecore +++ b/workspace/fr.n7.game.xtext/model/generated/Game.ecore @@ -145,10 +145,10 @@ - + - + diff --git a/workspace/fr.n7.game.xtext/model/generated/Game.genmodel b/workspace/fr.n7.game.xtext/model/generated/Game.genmodel index eb6c7a5..e8dbb59 100644 --- a/workspace/fr.n7.game.xtext/model/generated/Game.genmodel +++ b/workspace/fr.n7.game.xtext/model/generated/Game.genmodel @@ -102,10 +102,10 @@ - + - + diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/Game.xtextbin b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/Game.xtextbin index 439e779966b5539db78bc29c9f61202474f72920..d09e890cccc792bb151dda13bb391f63ddd22027 100644 GIT binary patch literal 6890 zcma)>cYGYh6~{HZx7Tzh$+%#e!3GT2pd}_W<1%xyVg$BjWEsO%EW3dj=As3rRa-gWCYYJ-#!l1M+dj*wIb?K$k+tpi1vRf!>0^n!Q?9vQ z#i^B+yM7vR5Rt!)T+#7*C~T$LN@KE>am#MMTdDb0h9%RxyDL{zy&fyM+$j&b#wIMw zl9rKSjr7Q~96hp(u{<-3#<_DAw{^~)+di+`Y+|NinJJcNW~tGVMuh z1WPwAtkgC1zm{I39vqt@wtON_xm8 zKRphHn;o;vjkUp>kip}DHD+4I{%is)No>lp&23AeT!iagPNmPatg_o%+l=OMSTgCA z`j*xXYs@Svm3t^L8RN59 z#^UXy%zvgNW(NS6%6C<-yo1PmH~Mo6#&_4~ITAfrDb7RYGTuqV`I5MY`p^~V5phBI znjdNMZn%;a^Y&ic*}ZFfm&q4ucle&f!h-TeEH`qtTXB&DKUfp^UIuG0$4BY{3SF;f zQ?0XQ1+%Hv8FoTeLW{;(YBb-Qr-MkcQ7bWd>>fC7nyut!%VfeQ6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)w$gWEt0u&|=~YBwA9O$wuj%ROc3Pmhpjvv(aOG ze%`MPGjWdY{ah2Y^QZw6em>;H3uL4QbOA}Z5Kk!)9YYLEz<6KV@KD8+IGdn4chuf6Aii~P&95LX(RTvn<;^A z(P5Z`1iBSim7TZ2tu85;Sg+Byn*_Q;qwfT|&Q`_yF49N|B<_Y`bxYSb1aXg1D6a=l zNY{h9E&X1Scb}5SDZlTp%6kCB`o+w|gIeE12K=zr_XxoC#!BF$#D7fl-vghn0CM;; z+r{JXPj)Q#@xM}R1y5-FlLr5k#?!e!nN?;AOlN=bG*wmQZHs4gke}66Rkb7AoqhiANS~7a zbf6ddKrdb<-PBB{cOtw(gjcmvBD|*KAzlX|QL3!;DRuhCQ u+FK~fBg#L|^2hl*!WO5B3&qo7g4jv)@%235!+b4Y$4}Connaissance' attribute. + * Returns the value of the 'Connaissance' reference. * * - * @return the value of the 'Connaissance' attribute. - * @see #setConnaissance(String) + * @return the value of the 'Connaissance' reference. + * @see #setConnaissance(Connaissance) * @see fr.n7.game.xtext.game.GamePackage#getConditionConnaissance_Connaissance() * @model * @generated */ - String getConnaissance(); + Connaissance getConnaissance(); /** - * Sets the value of the '{@link fr.n7.game.xtext.game.ConditionConnaissance#getConnaissance Connaissance}' attribute. + * Sets the value of the '{@link fr.n7.game.xtext.game.ConditionConnaissance#getConnaissance Connaissance}' reference. * * - * @param value the new value of the 'Connaissance' attribute. + * @param value the new value of the 'Connaissance' reference. * @see #getConnaissance() * @generated */ - void setConnaissance(String value); + void setConnaissance(Connaissance value); } // ConditionConnaissance diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/ConditionObjet.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/ConditionObjet.java index c91bc03..6981cff 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/ConditionObjet.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/ConditionObjet.java @@ -25,26 +25,26 @@ package fr.n7.game.xtext.game; public interface ConditionObjet extends ConditionTest { /** - * Returns the value of the 'Objet' attribute. + * Returns the value of the 'Objet' reference. * * - * @return the value of the 'Objet' attribute. - * @see #setObjet(String) + * @return the value of the 'Objet' reference. + * @see #setObjet(Objet) * @see fr.n7.game.xtext.game.GamePackage#getConditionObjet_Objet() * @model * @generated */ - String getObjet(); + Objet getObjet(); /** - * Sets the value of the '{@link fr.n7.game.xtext.game.ConditionObjet#getObjet Objet}' attribute. + * Sets the value of the '{@link fr.n7.game.xtext.game.ConditionObjet#getObjet Objet}' reference. * * - * @param value the new value of the 'Objet' attribute. + * @param value the new value of the 'Objet' reference. * @see #getObjet() * @generated */ - void setObjet(String value); + void setObjet(Objet value); /** * Returns the value of the 'Comparateur' attribute. diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/GamePackage.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/GamePackage.java index c3143e5..843aa88 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/GamePackage.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/GamePackage.java @@ -948,7 +948,7 @@ public interface GamePackage extends EPackage int CONDITION_CONNAISSANCE__NEGATION = CONDITION_TEST_FEATURE_COUNT + 0; /** - * The feature id for the 'Connaissance' attribute. + * The feature id for the 'Connaissance' reference. * * * @generated @@ -976,7 +976,7 @@ public interface GamePackage extends EPackage int CONDITION_OBJET = 17; /** - * The feature id for the 'Objet' attribute. + * The feature id for the 'Objet' reference. * * * @generated @@ -1887,15 +1887,15 @@ public interface GamePackage extends EPackage EAttribute getConditionConnaissance_Negation(); /** - * Returns the meta object for the attribute '{@link fr.n7.game.xtext.game.ConditionConnaissance#getConnaissance Connaissance}'. + * Returns the meta object for the reference '{@link fr.n7.game.xtext.game.ConditionConnaissance#getConnaissance Connaissance}'. * * - * @return the meta object for the attribute 'Connaissance'. + * @return the meta object for the reference 'Connaissance'. * @see fr.n7.game.xtext.game.ConditionConnaissance#getConnaissance() * @see #getConditionConnaissance() * @generated */ - EAttribute getConditionConnaissance_Connaissance(); + EReference getConditionConnaissance_Connaissance(); /** * Returns the meta object for class '{@link fr.n7.game.xtext.game.ConditionObjet Condition Objet}'. @@ -1908,15 +1908,15 @@ public interface GamePackage extends EPackage EClass getConditionObjet(); /** - * Returns the meta object for the attribute '{@link fr.n7.game.xtext.game.ConditionObjet#getObjet Objet}'. + * Returns the meta object for the reference '{@link fr.n7.game.xtext.game.ConditionObjet#getObjet Objet}'. * * - * @return the meta object for the attribute 'Objet'. + * @return the meta object for the reference 'Objet'. * @see fr.n7.game.xtext.game.ConditionObjet#getObjet() * @see #getConditionObjet() * @generated */ - EAttribute getConditionObjet_Objet(); + EReference getConditionObjet_Objet(); /** * Returns the meta object for the attribute '{@link fr.n7.game.xtext.game.ConditionObjet#getComparateur Comparateur}'. @@ -2646,12 +2646,12 @@ public interface GamePackage extends EPackage EAttribute CONDITION_CONNAISSANCE__NEGATION = eINSTANCE.getConditionConnaissance_Negation(); /** - * The meta object literal for the 'Connaissance' attribute feature. + * The meta object literal for the 'Connaissance' reference feature. * * * @generated */ - EAttribute CONDITION_CONNAISSANCE__CONNAISSANCE = eINSTANCE.getConditionConnaissance_Connaissance(); + EReference CONDITION_CONNAISSANCE__CONNAISSANCE = eINSTANCE.getConditionConnaissance_Connaissance(); /** * The meta object literal for the '{@link fr.n7.game.xtext.game.impl.ConditionObjetImpl Condition Objet}' class. @@ -2664,12 +2664,12 @@ public interface GamePackage extends EPackage EClass CONDITION_OBJET = eINSTANCE.getConditionObjet(); /** - * The meta object literal for the 'Objet' attribute feature. + * The meta object literal for the 'Objet' reference feature. * * * @generated */ - EAttribute CONDITION_OBJET__OBJET = eINSTANCE.getConditionObjet_Objet(); + EReference CONDITION_OBJET__OBJET = eINSTANCE.getConditionObjet_Objet(); /** * The meta object literal for the 'Comparateur' attribute feature. diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionConnaissanceImpl.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionConnaissanceImpl.java index 7ebaa6b..fea3b76 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionConnaissanceImpl.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionConnaissanceImpl.java @@ -4,11 +4,13 @@ package fr.n7.game.xtext.game.impl; import fr.n7.game.xtext.game.ConditionConnaissance; +import fr.n7.game.xtext.game.Connaissance; import fr.n7.game.xtext.game.GamePackage; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; @@ -49,24 +51,14 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond protected String negation = NEGATION_EDEFAULT; /** - * The default value of the '{@link #getConnaissance() Connaissance}' attribute. + * The cached value of the '{@link #getConnaissance() Connaissance}' reference. * * * @see #getConnaissance() * @generated * @ordered */ - protected static final String CONNAISSANCE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getConnaissance() Connaissance}' attribute. - * - * - * @see #getConnaissance() - * @generated - * @ordered - */ - protected String connaissance = CONNAISSANCE_EDEFAULT; + protected Connaissance connaissance; /** * @@ -120,7 +112,27 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond * @generated */ @Override - public String getConnaissance() + public Connaissance getConnaissance() + { + if (connaissance != null && connaissance.eIsProxy()) + { + InternalEObject oldConnaissance = (InternalEObject)connaissance; + connaissance = (Connaissance)eResolveProxy(oldConnaissance); + if (connaissance != oldConnaissance) + { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, GamePackage.CONDITION_CONNAISSANCE__CONNAISSANCE, oldConnaissance, connaissance)); + } + } + return connaissance; + } + + /** + * + * + * @generated + */ + public Connaissance basicGetConnaissance() { return connaissance; } @@ -131,9 +143,9 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond * @generated */ @Override - public void setConnaissance(String newConnaissance) + public void setConnaissance(Connaissance newConnaissance) { - String oldConnaissance = connaissance; + Connaissance oldConnaissance = connaissance; connaissance = newConnaissance; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CONDITION_CONNAISSANCE__CONNAISSANCE, oldConnaissance, connaissance)); @@ -152,7 +164,8 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond case GamePackage.CONDITION_CONNAISSANCE__NEGATION: return getNegation(); case GamePackage.CONDITION_CONNAISSANCE__CONNAISSANCE: - return getConnaissance(); + if (resolve) return getConnaissance(); + return basicGetConnaissance(); } return super.eGet(featureID, resolve, coreType); } @@ -171,7 +184,7 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond setNegation((String)newValue); return; case GamePackage.CONDITION_CONNAISSANCE__CONNAISSANCE: - setConnaissance((String)newValue); + setConnaissance((Connaissance)newValue); return; } super.eSet(featureID, newValue); @@ -191,7 +204,7 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond setNegation(NEGATION_EDEFAULT); return; case GamePackage.CONDITION_CONNAISSANCE__CONNAISSANCE: - setConnaissance(CONNAISSANCE_EDEFAULT); + setConnaissance((Connaissance)null); return; } super.eUnset(featureID); @@ -210,7 +223,7 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond case GamePackage.CONDITION_CONNAISSANCE__NEGATION: return NEGATION_EDEFAULT == null ? negation != null : !NEGATION_EDEFAULT.equals(negation); case GamePackage.CONDITION_CONNAISSANCE__CONNAISSANCE: - return CONNAISSANCE_EDEFAULT == null ? connaissance != null : !CONNAISSANCE_EDEFAULT.equals(connaissance); + return connaissance != null; } return super.eIsSet(featureID); } @@ -228,8 +241,6 @@ public class ConditionConnaissanceImpl extends ConditionTestImpl implements Cond StringBuilder result = new StringBuilder(super.toString()); result.append(" (negation: "); result.append(negation); - result.append(", connaissance: "); - result.append(connaissance); result.append(')'); return result.toString(); } diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionObjetImpl.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionObjetImpl.java index 4f3e540..b581480 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionObjetImpl.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/ConditionObjetImpl.java @@ -5,10 +5,12 @@ package fr.n7.game.xtext.game.impl; import fr.n7.game.xtext.game.ConditionObjet; import fr.n7.game.xtext.game.GamePackage; +import fr.n7.game.xtext.game.Objet; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; @@ -30,24 +32,14 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; public class ConditionObjetImpl extends ConditionTestImpl implements ConditionObjet { /** - * The default value of the '{@link #getObjet() Objet}' attribute. + * The cached value of the '{@link #getObjet() Objet}' reference. * * * @see #getObjet() * @generated * @ordered */ - protected static final String OBJET_EDEFAULT = null; - - /** - * The cached value of the '{@link #getObjet() Objet}' attribute. - * - * - * @see #getObjet() - * @generated - * @ordered - */ - protected String objet = OBJET_EDEFAULT; + protected Objet objet; /** * The default value of the '{@link #getComparateur() Comparateur}' attribute. @@ -116,7 +108,27 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb * @generated */ @Override - public String getObjet() + public Objet getObjet() + { + if (objet != null && objet.eIsProxy()) + { + InternalEObject oldObjet = (InternalEObject)objet; + objet = (Objet)eResolveProxy(oldObjet); + if (objet != oldObjet) + { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, GamePackage.CONDITION_OBJET__OBJET, oldObjet, objet)); + } + } + return objet; + } + + /** + * + * + * @generated + */ + public Objet basicGetObjet() { return objet; } @@ -127,9 +139,9 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb * @generated */ @Override - public void setObjet(String newObjet) + public void setObjet(Objet newObjet) { - String oldObjet = objet; + Objet oldObjet = objet; objet = newObjet; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CONDITION_OBJET__OBJET, oldObjet, objet)); @@ -196,7 +208,8 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb switch (featureID) { case GamePackage.CONDITION_OBJET__OBJET: - return getObjet(); + if (resolve) return getObjet(); + return basicGetObjet(); case GamePackage.CONDITION_OBJET__COMPARATEUR: return getComparateur(); case GamePackage.CONDITION_OBJET__NOMBRE: @@ -216,7 +229,7 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb switch (featureID) { case GamePackage.CONDITION_OBJET__OBJET: - setObjet((String)newValue); + setObjet((Objet)newValue); return; case GamePackage.CONDITION_OBJET__COMPARATEUR: setComparateur((String)newValue); @@ -239,7 +252,7 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb switch (featureID) { case GamePackage.CONDITION_OBJET__OBJET: - setObjet(OBJET_EDEFAULT); + setObjet((Objet)null); return; case GamePackage.CONDITION_OBJET__COMPARATEUR: setComparateur(COMPARATEUR_EDEFAULT); @@ -262,7 +275,7 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb switch (featureID) { case GamePackage.CONDITION_OBJET__OBJET: - return OBJET_EDEFAULT == null ? objet != null : !OBJET_EDEFAULT.equals(objet); + return objet != null; case GamePackage.CONDITION_OBJET__COMPARATEUR: return COMPARATEUR_EDEFAULT == null ? comparateur != null : !COMPARATEUR_EDEFAULT.equals(comparateur); case GamePackage.CONDITION_OBJET__NOMBRE: @@ -282,9 +295,7 @@ public class ConditionObjetImpl extends ConditionTestImpl implements ConditionOb if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); - result.append(" (objet: "); - result.append(objet); - result.append(", comparateur: "); + result.append(" (comparateur: "); result.append(comparateur); result.append(", nombre: "); result.append(nombre); diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/GamePackageImpl.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/GamePackageImpl.java index cc5ba4b..2999fc1 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/GamePackageImpl.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/game/impl/GamePackageImpl.java @@ -1125,9 +1125,9 @@ public class GamePackageImpl extends EPackageImpl implements GamePackage * @generated */ @Override - public EAttribute getConditionConnaissance_Connaissance() + public EReference getConditionConnaissance_Connaissance() { - return (EAttribute)conditionConnaissanceEClass.getEStructuralFeatures().get(1); + return (EReference)conditionConnaissanceEClass.getEStructuralFeatures().get(1); } /** @@ -1147,9 +1147,9 @@ public class GamePackageImpl extends EPackageImpl implements GamePackage * @generated */ @Override - public EAttribute getConditionObjet_Objet() + public EReference getConditionObjet_Objet() { - return (EAttribute)conditionObjetEClass.getEStructuralFeatures().get(0); + return (EReference)conditionObjetEClass.getEStructuralFeatures().get(0); } /** @@ -1302,10 +1302,10 @@ public class GamePackageImpl extends EPackageImpl implements GamePackage conditionConnaissanceEClass = createEClass(CONDITION_CONNAISSANCE); createEAttribute(conditionConnaissanceEClass, CONDITION_CONNAISSANCE__NEGATION); - createEAttribute(conditionConnaissanceEClass, CONDITION_CONNAISSANCE__CONNAISSANCE); + createEReference(conditionConnaissanceEClass, CONDITION_CONNAISSANCE__CONNAISSANCE); conditionObjetEClass = createEClass(CONDITION_OBJET); - createEAttribute(conditionObjetEClass, CONDITION_OBJET__OBJET); + createEReference(conditionObjetEClass, CONDITION_OBJET__OBJET); createEAttribute(conditionObjetEClass, CONDITION_OBJET__COMPARATEUR); createEAttribute(conditionObjetEClass, CONDITION_OBJET__NOMBRE); } @@ -1441,10 +1441,10 @@ public class GamePackageImpl extends EPackageImpl implements GamePackage initEClass(conditionConnaissanceEClass, ConditionConnaissance.class, "ConditionConnaissance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getConditionConnaissance_Negation(), ecorePackage.getEString(), "negation", null, 0, 1, ConditionConnaissance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConditionConnaissance_Connaissance(), ecorePackage.getEString(), "connaissance", null, 0, 1, ConditionConnaissance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getConditionConnaissance_Connaissance(), this.getConnaissance(), null, "connaissance", null, 0, 1, ConditionConnaissance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(conditionObjetEClass, ConditionObjet.class, "ConditionObjet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getConditionObjet_Objet(), ecorePackage.getEString(), "objet", null, 0, 1, ConditionObjet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getConditionObjet_Objet(), this.getObjet(), null, "objet", null, 0, 1, ConditionObjet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getConditionObjet_Comparateur(), ecorePackage.getEString(), "comparateur", null, 0, 1, ConditionObjet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getConditionObjet_Nombre(), ecorePackage.getEInt(), "nombre", null, 0, 1, ConditionObjet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGame.g b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGame.g index 3bc2abc..bbae9f2 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGame.g +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGame.g @@ -2171,19 +2171,14 @@ ruleConditionConnaissance returns [EObject current=null] )? ( ( - lv_connaissance_1_0=RULE_ID - { - newLeafNode(lv_connaissance_1_0, grammarAccess.getConditionConnaissanceAccess().getConnaissanceIDTerminalRuleCall_1_0()); - } { if ($current==null) { $current = createModelElement(grammarAccess.getConditionConnaissanceRule()); } - setWithLastConsumed( - $current, - "connaissance", - lv_connaissance_1_0, - "org.eclipse.xtext.common.Terminals.ID"); + } + otherlv_1=RULE_ID + { + newLeafNode(otherlv_1, grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceCrossReference_1_0()); } ) ) @@ -2208,19 +2203,14 @@ ruleConditionObjet returns [EObject current=null] ( ( ( - lv_objet_0_0=RULE_ID - { - newLeafNode(lv_objet_0_0, grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0()); - } { if ($current==null) { $current = createModelElement(grammarAccess.getConditionObjetRule()); } - setWithLastConsumed( - $current, - "objet", - lv_objet_0_0, - "org.eclipse.xtext.common.Terminals.ID"); + } + otherlv_0=RULE_ID + { + newLeafNode(otherlv_0, grammarAccess.getConditionObjetAccess().getObjetObjetCrossReference_0_0()); } ) ) diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameLexer.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameLexer.java index 57b12f7..4179722 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameLexer.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameLexer.java @@ -808,10 +808,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_COMPARATEUR; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2266:18: ( ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) ) - // InternalGame.g:2266:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) + // InternalGame.g:2256:18: ( ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) ) + // InternalGame.g:2256:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) { - // InternalGame.g:2266:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) + // InternalGame.g:2256:20: ( '<' | '>' | '==' | '<=' | '>=' | '!=' ) int alt1=6; switch ( input.LA(1) ) { case '<': @@ -855,21 +855,21 @@ public class InternalGameLexer extends Lexer { switch (alt1) { case 1 : - // InternalGame.g:2266:21: '<' + // InternalGame.g:2256:21: '<' { match('<'); } break; case 2 : - // InternalGame.g:2266:25: '>' + // InternalGame.g:2256:25: '>' { match('>'); } break; case 3 : - // InternalGame.g:2266:29: '==' + // InternalGame.g:2256:29: '==' { match("=="); @@ -877,7 +877,7 @@ public class InternalGameLexer extends Lexer { } break; case 4 : - // InternalGame.g:2266:34: '<=' + // InternalGame.g:2256:34: '<=' { match("<="); @@ -885,7 +885,7 @@ public class InternalGameLexer extends Lexer { } break; case 5 : - // InternalGame.g:2266:39: '>=' + // InternalGame.g:2256:39: '>=' { match(">="); @@ -893,7 +893,7 @@ public class InternalGameLexer extends Lexer { } break; case 6 : - // InternalGame.g:2266:44: '!=' + // InternalGame.g:2256:44: '!=' { match("!="); @@ -919,10 +919,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_BOOLEAN; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2268:14: ( ( 'true' | 'false' ) ) - // InternalGame.g:2268:16: ( 'true' | 'false' ) + // InternalGame.g:2258:14: ( ( 'true' | 'false' ) ) + // InternalGame.g:2258:16: ( 'true' | 'false' ) { - // InternalGame.g:2268:16: ( 'true' | 'false' ) + // InternalGame.g:2258:16: ( 'true' | 'false' ) int alt2=2; int LA2_0 = input.LA(1); @@ -940,7 +940,7 @@ public class InternalGameLexer extends Lexer { } switch (alt2) { case 1 : - // InternalGame.g:2268:17: 'true' + // InternalGame.g:2258:17: 'true' { match("true"); @@ -948,7 +948,7 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:2268:24: 'false' + // InternalGame.g:2258:24: 'false' { match("false"); @@ -974,10 +974,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_ID; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2270:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) - // InternalGame.g:2270:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // InternalGame.g:2260:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalGame.g:2260:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* { - // InternalGame.g:2270:11: ( '^' )? + // InternalGame.g:2260:11: ( '^' )? int alt3=2; int LA3_0 = input.LA(1); @@ -986,7 +986,7 @@ public class InternalGameLexer extends Lexer { } switch (alt3) { case 1 : - // InternalGame.g:2270:11: '^' + // InternalGame.g:2260:11: '^' { match('^'); @@ -1004,7 +1004,7 @@ public class InternalGameLexer extends Lexer { recover(mse); throw mse;} - // InternalGame.g:2270:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // InternalGame.g:2260:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* loop4: do { int alt4=2; @@ -1053,10 +1053,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_INT; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2272:10: ( ( '0' .. '9' )+ ) - // InternalGame.g:2272:12: ( '0' .. '9' )+ + // InternalGame.g:2262:10: ( ( '0' .. '9' )+ ) + // InternalGame.g:2262:12: ( '0' .. '9' )+ { - // InternalGame.g:2272:12: ( '0' .. '9' )+ + // InternalGame.g:2262:12: ( '0' .. '9' )+ int cnt5=0; loop5: do { @@ -1070,7 +1070,7 @@ public class InternalGameLexer extends Lexer { switch (alt5) { case 1 : - // InternalGame.g:2272:13: '0' .. '9' + // InternalGame.g:2262:13: '0' .. '9' { matchRange('0','9'); @@ -1102,10 +1102,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_STRING; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2274:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) - // InternalGame.g:2274:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + // InternalGame.g:2264:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalGame.g:2264:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) { - // InternalGame.g:2274:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + // InternalGame.g:2264:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) int alt8=2; int LA8_0 = input.LA(1); @@ -1123,10 +1123,10 @@ public class InternalGameLexer extends Lexer { } switch (alt8) { case 1 : - // InternalGame.g:2274:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + // InternalGame.g:2264:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' { match('\"'); - // InternalGame.g:2274:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + // InternalGame.g:2264:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* loop6: do { int alt6=3; @@ -1142,7 +1142,7 @@ public class InternalGameLexer extends Lexer { switch (alt6) { case 1 : - // InternalGame.g:2274:21: '\\\\' . + // InternalGame.g:2264:21: '\\\\' . { match('\\'); matchAny(); @@ -1150,7 +1150,7 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:2274:28: ~ ( ( '\\\\' | '\"' ) ) + // InternalGame.g:2264:28: ~ ( ( '\\\\' | '\"' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1175,10 +1175,10 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:2274:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + // InternalGame.g:2264:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' { match('\''); - // InternalGame.g:2274:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + // InternalGame.g:2264:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* loop7: do { int alt7=3; @@ -1194,7 +1194,7 @@ public class InternalGameLexer extends Lexer { switch (alt7) { case 1 : - // InternalGame.g:2274:54: '\\\\' . + // InternalGame.g:2264:54: '\\\\' . { match('\\'); matchAny(); @@ -1202,7 +1202,7 @@ public class InternalGameLexer extends Lexer { } break; case 2 : - // InternalGame.g:2274:61: ~ ( ( '\\\\' | '\\'' ) ) + // InternalGame.g:2264:61: ~ ( ( '\\\\' | '\\'' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1245,12 +1245,12 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_ML_COMMENT; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2276:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) - // InternalGame.g:2276:19: '/*' ( options {greedy=false; } : . )* '*/' + // InternalGame.g:2266:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalGame.g:2266:19: '/*' ( options {greedy=false; } : . )* '*/' { match("/*"); - // InternalGame.g:2276:24: ( options {greedy=false; } : . )* + // InternalGame.g:2266:24: ( options {greedy=false; } : . )* loop9: do { int alt9=2; @@ -1275,7 +1275,7 @@ public class InternalGameLexer extends Lexer { switch (alt9) { case 1 : - // InternalGame.g:2276:52: . + // InternalGame.g:2266:52: . { matchAny(); @@ -1305,12 +1305,12 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_SL_COMMENT; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2278:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) - // InternalGame.g:2278:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? + // InternalGame.g:2268:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) + // InternalGame.g:2268:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? { match("//"); - // InternalGame.g:2278:24: (~ ( ( '\\n' | '\\r' ) ) )* + // InternalGame.g:2268:24: (~ ( ( '\\n' | '\\r' ) ) )* loop10: do { int alt10=2; @@ -1323,7 +1323,7 @@ public class InternalGameLexer extends Lexer { switch (alt10) { case 1 : - // InternalGame.g:2278:24: ~ ( ( '\\n' | '\\r' ) ) + // InternalGame.g:2268:24: ~ ( ( '\\n' | '\\r' ) ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1343,7 +1343,7 @@ public class InternalGameLexer extends Lexer { } } while (true); - // InternalGame.g:2278:40: ( ( '\\r' )? '\\n' )? + // InternalGame.g:2268:40: ( ( '\\r' )? '\\n' )? int alt12=2; int LA12_0 = input.LA(1); @@ -1352,9 +1352,9 @@ public class InternalGameLexer extends Lexer { } switch (alt12) { case 1 : - // InternalGame.g:2278:41: ( '\\r' )? '\\n' + // InternalGame.g:2268:41: ( '\\r' )? '\\n' { - // InternalGame.g:2278:41: ( '\\r' )? + // InternalGame.g:2268:41: ( '\\r' )? int alt11=2; int LA11_0 = input.LA(1); @@ -1363,7 +1363,7 @@ public class InternalGameLexer extends Lexer { } switch (alt11) { case 1 : - // InternalGame.g:2278:41: '\\r' + // InternalGame.g:2268:41: '\\r' { match('\r'); @@ -1395,10 +1395,10 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_WS; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2280:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) - // InternalGame.g:2280:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // InternalGame.g:2270:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalGame.g:2270:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ { - // InternalGame.g:2280:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // InternalGame.g:2270:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ int cnt13=0; loop13: do { @@ -1452,8 +1452,8 @@ public class InternalGameLexer extends Lexer { try { int _type = RULE_ANY_OTHER; int _channel = DEFAULT_TOKEN_CHANNEL; - // InternalGame.g:2282:16: ( . ) - // InternalGame.g:2282:18: . + // InternalGame.g:2272:16: ( . ) + // InternalGame.g:2272:18: . { matchAny(); diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameParser.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameParser.java index 4ddf2d9..e1633f4 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameParser.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/parser/antlr/internal/InternalGameParser.java @@ -4872,22 +4872,22 @@ public class InternalGameParser extends AbstractInternalAntlrParser { // $ANTLR start "ruleConditionConnaissance" - // InternalGame.g:2150:1: ruleConditionConnaissance returns [EObject current=null] : ( ( (lv_negation_0_0= '!' ) )? ( (lv_connaissance_1_0= RULE_ID ) ) ) ; + // InternalGame.g:2150:1: ruleConditionConnaissance returns [EObject current=null] : ( ( (lv_negation_0_0= '!' ) )? ( (otherlv_1= RULE_ID ) ) ) ; public final EObject ruleConditionConnaissance() throws RecognitionException { EObject current = null; Token lv_negation_0_0=null; - Token lv_connaissance_1_0=null; + Token otherlv_1=null; enterRule(); try { - // InternalGame.g:2156:2: ( ( ( (lv_negation_0_0= '!' ) )? ( (lv_connaissance_1_0= RULE_ID ) ) ) ) - // InternalGame.g:2157:2: ( ( (lv_negation_0_0= '!' ) )? ( (lv_connaissance_1_0= RULE_ID ) ) ) + // InternalGame.g:2156:2: ( ( ( (lv_negation_0_0= '!' ) )? ( (otherlv_1= RULE_ID ) ) ) ) + // InternalGame.g:2157:2: ( ( (lv_negation_0_0= '!' ) )? ( (otherlv_1= RULE_ID ) ) ) { - // InternalGame.g:2157:2: ( ( (lv_negation_0_0= '!' ) )? ( (lv_connaissance_1_0= RULE_ID ) ) ) - // InternalGame.g:2158:3: ( (lv_negation_0_0= '!' ) )? ( (lv_connaissance_1_0= RULE_ID ) ) + // InternalGame.g:2157:2: ( ( (lv_negation_0_0= '!' ) )? ( (otherlv_1= RULE_ID ) ) ) + // InternalGame.g:2158:3: ( (lv_negation_0_0= '!' ) )? ( (otherlv_1= RULE_ID ) ) { // InternalGame.g:2158:3: ( (lv_negation_0_0= '!' ) )? int alt33=2; @@ -4922,25 +4922,20 @@ public class InternalGameParser extends AbstractInternalAntlrParser { } - // InternalGame.g:2172:3: ( (lv_connaissance_1_0= RULE_ID ) ) - // InternalGame.g:2173:4: (lv_connaissance_1_0= RULE_ID ) + // InternalGame.g:2172:3: ( (otherlv_1= RULE_ID ) ) + // InternalGame.g:2173:4: (otherlv_1= RULE_ID ) { - // InternalGame.g:2173:4: (lv_connaissance_1_0= RULE_ID ) - // InternalGame.g:2174:5: lv_connaissance_1_0= RULE_ID + // InternalGame.g:2173:4: (otherlv_1= RULE_ID ) + // InternalGame.g:2174:5: otherlv_1= RULE_ID { - lv_connaissance_1_0=(Token)match(input,RULE_ID,FOLLOW_2); - - newLeafNode(lv_connaissance_1_0, grammarAccess.getConditionConnaissanceAccess().getConnaissanceIDTerminalRuleCall_1_0()); - if (current==null) { current = createModelElement(grammarAccess.getConditionConnaissanceRule()); } - setWithLastConsumed( - current, - "connaissance", - lv_connaissance_1_0, - "org.eclipse.xtext.common.Terminals.ID"); + + otherlv_1=(Token)match(input,RULE_ID,FOLLOW_2); + + newLeafNode(otherlv_1, grammarAccess.getConditionConnaissanceAccess().getConnaissanceConnaissanceCrossReference_1_0()); } @@ -4971,7 +4966,7 @@ public class InternalGameParser extends AbstractInternalAntlrParser { // $ANTLR start "entryRuleConditionObjet" - // InternalGame.g:2194:1: entryRuleConditionObjet returns [EObject current=null] : iv_ruleConditionObjet= ruleConditionObjet EOF ; + // InternalGame.g:2189:1: entryRuleConditionObjet returns [EObject current=null] : iv_ruleConditionObjet= ruleConditionObjet EOF ; public final EObject entryRuleConditionObjet() throws RecognitionException { EObject current = null; @@ -4979,8 +4974,8 @@ public class InternalGameParser extends AbstractInternalAntlrParser { try { - // InternalGame.g:2194:55: (iv_ruleConditionObjet= ruleConditionObjet EOF ) - // InternalGame.g:2195:2: iv_ruleConditionObjet= ruleConditionObjet EOF + // InternalGame.g:2189:55: (iv_ruleConditionObjet= ruleConditionObjet EOF ) + // InternalGame.g:2190:2: iv_ruleConditionObjet= ruleConditionObjet EOF { newCompositeNode(grammarAccess.getConditionObjetRule()); pushFollow(FOLLOW_1); @@ -5007,11 +5002,11 @@ public class InternalGameParser extends AbstractInternalAntlrParser { // $ANTLR start "ruleConditionObjet" - // InternalGame.g:2201:1: ruleConditionObjet returns [EObject current=null] : ( ( (lv_objet_0_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) ; + // InternalGame.g:2196:1: ruleConditionObjet returns [EObject current=null] : ( ( (otherlv_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) ; public final EObject ruleConditionObjet() throws RecognitionException { EObject current = null; - Token lv_objet_0_0=null; + Token otherlv_0=null; Token lv_comparateur_1_0=null; Token lv_nombre_2_0=null; @@ -5019,31 +5014,26 @@ public class InternalGameParser extends AbstractInternalAntlrParser { enterRule(); try { - // InternalGame.g:2207:2: ( ( ( (lv_objet_0_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) ) - // InternalGame.g:2208:2: ( ( (lv_objet_0_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) + // InternalGame.g:2202:2: ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) ) + // InternalGame.g:2203:2: ( ( (otherlv_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) { - // InternalGame.g:2208:2: ( ( (lv_objet_0_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) - // InternalGame.g:2209:3: ( (lv_objet_0_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) + // InternalGame.g:2203:2: ( ( (otherlv_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) ) + // InternalGame.g:2204:3: ( (otherlv_0= RULE_ID ) ) ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) ( (lv_nombre_2_0= RULE_INT ) ) { - // InternalGame.g:2209:3: ( (lv_objet_0_0= RULE_ID ) ) - // InternalGame.g:2210:4: (lv_objet_0_0= RULE_ID ) + // InternalGame.g:2204:3: ( (otherlv_0= RULE_ID ) ) + // InternalGame.g:2205:4: (otherlv_0= RULE_ID ) { - // InternalGame.g:2210:4: (lv_objet_0_0= RULE_ID ) - // InternalGame.g:2211:5: lv_objet_0_0= RULE_ID + // InternalGame.g:2205:4: (otherlv_0= RULE_ID ) + // InternalGame.g:2206:5: otherlv_0= RULE_ID { - lv_objet_0_0=(Token)match(input,RULE_ID,FOLLOW_43); - - newLeafNode(lv_objet_0_0, grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0()); - if (current==null) { current = createModelElement(grammarAccess.getConditionObjetRule()); } - setWithLastConsumed( - current, - "objet", - lv_objet_0_0, - "org.eclipse.xtext.common.Terminals.ID"); + + otherlv_0=(Token)match(input,RULE_ID,FOLLOW_43); + + newLeafNode(otherlv_0, grammarAccess.getConditionObjetAccess().getObjetObjetCrossReference_0_0()); } @@ -5051,11 +5041,11 @@ public class InternalGameParser extends AbstractInternalAntlrParser { } - // InternalGame.g:2227:3: ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) - // InternalGame.g:2228:4: (lv_comparateur_1_0= RULE_COMPARATEUR ) + // InternalGame.g:2217:3: ( (lv_comparateur_1_0= RULE_COMPARATEUR ) ) + // InternalGame.g:2218:4: (lv_comparateur_1_0= RULE_COMPARATEUR ) { - // InternalGame.g:2228:4: (lv_comparateur_1_0= RULE_COMPARATEUR ) - // InternalGame.g:2229:5: lv_comparateur_1_0= RULE_COMPARATEUR + // InternalGame.g:2218:4: (lv_comparateur_1_0= RULE_COMPARATEUR ) + // InternalGame.g:2219:5: lv_comparateur_1_0= RULE_COMPARATEUR { lv_comparateur_1_0=(Token)match(input,RULE_COMPARATEUR,FOLLOW_12); @@ -5077,11 +5067,11 @@ public class InternalGameParser extends AbstractInternalAntlrParser { } - // InternalGame.g:2245:3: ( (lv_nombre_2_0= RULE_INT ) ) - // InternalGame.g:2246:4: (lv_nombre_2_0= RULE_INT ) + // InternalGame.g:2235:3: ( (lv_nombre_2_0= RULE_INT ) ) + // InternalGame.g:2236:4: (lv_nombre_2_0= RULE_INT ) { - // InternalGame.g:2246:4: (lv_nombre_2_0= RULE_INT ) - // InternalGame.g:2247:5: lv_nombre_2_0= RULE_INT + // InternalGame.g:2236:4: (lv_nombre_2_0= RULE_INT ) + // InternalGame.g:2237:5: lv_nombre_2_0= RULE_INT { lv_nombre_2_0=(Token)match(input,RULE_INT,FOLLOW_2); diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/serializer/GameSemanticSequencer.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/serializer/GameSemanticSequencer.java index 24386e6..e3e4de6 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/serializer/GameSemanticSequencer.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/serializer/GameSemanticSequencer.java @@ -171,7 +171,7 @@ public class GameSemanticSequencer extends AbstractDelegatingSemanticSequencer { * ConditionConnaissance returns ConditionConnaissance * * Constraint: - * (negation='!'? connaissance=ID) + * (negation='!'? connaissance=[Connaissance|ID]) */ protected void sequence_ConditionConnaissance(ISerializationContext context, ConditionConnaissance semanticObject) { genericSequencer.createSequence(context, semanticObject); @@ -196,7 +196,7 @@ public class GameSemanticSequencer extends AbstractDelegatingSemanticSequencer { * ConditionObjet returns ConditionObjet * * Constraint: - * (objet=ID comparateur=COMPARATEUR nombre=INT) + * (objet=[Objet|ID] comparateur=COMPARATEUR nombre=INT) */ protected void sequence_ConditionObjet(ISerializationContext context, ConditionObjet semanticObject) { if (errorAcceptor != null) { @@ -208,7 +208,7 @@ public class GameSemanticSequencer extends AbstractDelegatingSemanticSequencer { errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.CONDITION_OBJET__NOMBRE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); - feeder.accept(grammarAccess.getConditionObjetAccess().getObjetIDTerminalRuleCall_0_0(), semanticObject.getObjet()); + feeder.accept(grammarAccess.getConditionObjetAccess().getObjetObjetIDTerminalRuleCall_0_0_1(), semanticObject.eGet(GamePackage.Literals.CONDITION_OBJET__OBJET, false)); feeder.accept(grammarAccess.getConditionObjetAccess().getComparateurCOMPARATEURTerminalRuleCall_1_0(), semanticObject.getComparateur()); feeder.accept(grammarAccess.getConditionObjetAccess().getNombreINTTerminalRuleCall_2_0(), semanticObject.getNombre()); feeder.finish(); diff --git a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/services/GameGrammarAccess.java b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/services/GameGrammarAccess.java index 5e77df6..7c82662 100644 --- a/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/services/GameGrammarAccess.java +++ b/workspace/fr.n7.game.xtext/src-gen/fr/n7/game/xtext/services/GameGrammarAccess.java @@ -1564,13 +1564,14 @@ public class GameGrammarAccess extends AbstractElementFinder.AbstractGrammarElem private final Assignment cNegationAssignment_0 = (Assignment)cGroup.eContents().get(0); private final Keyword cNegationExclamationMarkKeyword_0_0 = (Keyword)cNegationAssignment_0.eContents().get(0); private final Assignment cConnaissanceAssignment_1 = (Assignment)cGroup.eContents().get(1); - private final RuleCall cConnaissanceIDTerminalRuleCall_1_0 = (RuleCall)cConnaissanceAssignment_1.eContents().get(0); + private final CrossReference cConnaissanceConnaissanceCrossReference_1_0 = (CrossReference)cConnaissanceAssignment_1.eContents().get(0); + private final RuleCall cConnaissanceConnaissanceIDTerminalRuleCall_1_0_1 = (RuleCall)cConnaissanceConnaissanceCrossReference_1_0.eContents().get(1); //ConditionConnaissance: - // negation='!'? connaissance=ID; + // negation='!'? connaissance=[Connaissance]; @Override public ParserRule getRule() { return rule; } - //negation='!'? connaissance=ID + //negation='!'? connaissance=[Connaissance] public Group getGroup() { return cGroup; } //negation='!'? @@ -1579,34 +1580,41 @@ public class GameGrammarAccess extends AbstractElementFinder.AbstractGrammarElem //'!' public Keyword getNegationExclamationMarkKeyword_0_0() { return cNegationExclamationMarkKeyword_0_0; } - //connaissance=ID + //connaissance=[Connaissance] public Assignment getConnaissanceAssignment_1() { return cConnaissanceAssignment_1; } + //[Connaissance] + public CrossReference getConnaissanceConnaissanceCrossReference_1_0() { return cConnaissanceConnaissanceCrossReference_1_0; } + //ID - public RuleCall getConnaissanceIDTerminalRuleCall_1_0() { return cConnaissanceIDTerminalRuleCall_1_0; } + public RuleCall getConnaissanceConnaissanceIDTerminalRuleCall_1_0_1() { return cConnaissanceConnaissanceIDTerminalRuleCall_1_0_1; } } public class ConditionObjetElements extends AbstractParserRuleElementFinder { private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "fr.n7.game.xtext.Game.ConditionObjet"); private final Group cGroup = (Group)rule.eContents().get(1); private final Assignment cObjetAssignment_0 = (Assignment)cGroup.eContents().get(0); - private final RuleCall cObjetIDTerminalRuleCall_0_0 = (RuleCall)cObjetAssignment_0.eContents().get(0); + private final CrossReference cObjetObjetCrossReference_0_0 = (CrossReference)cObjetAssignment_0.eContents().get(0); + private final RuleCall cObjetObjetIDTerminalRuleCall_0_0_1 = (RuleCall)cObjetObjetCrossReference_0_0.eContents().get(1); private final Assignment cComparateurAssignment_1 = (Assignment)cGroup.eContents().get(1); private final RuleCall cComparateurCOMPARATEURTerminalRuleCall_1_0 = (RuleCall)cComparateurAssignment_1.eContents().get(0); private final Assignment cNombreAssignment_2 = (Assignment)cGroup.eContents().get(2); private final RuleCall cNombreINTTerminalRuleCall_2_0 = (RuleCall)cNombreAssignment_2.eContents().get(0); //ConditionObjet: - // objet=ID comparateur=COMPARATEUR nombre=INT; + // objet=[Objet] comparateur=COMPARATEUR nombre=INT; @Override public ParserRule getRule() { return rule; } - //objet=ID comparateur=COMPARATEUR nombre=INT + //objet=[Objet] comparateur=COMPARATEUR nombre=INT public Group getGroup() { return cGroup; } - //objet=ID + //objet=[Objet] public Assignment getObjetAssignment_0() { return cObjetAssignment_0; } + //[Objet] + public CrossReference getObjetObjetCrossReference_0_0() { return cObjetObjetCrossReference_0_0; } + //ID - public RuleCall getObjetIDTerminalRuleCall_0_0() { return cObjetIDTerminalRuleCall_0_0; } + public RuleCall getObjetObjetIDTerminalRuleCall_0_0_1() { return cObjetObjetIDTerminalRuleCall_0_0_1; } //comparateur=COMPARATEUR public Assignment getComparateurAssignment_1() { return cComparateurAssignment_1; } @@ -1911,7 +1919,7 @@ public class GameGrammarAccess extends AbstractElementFinder.AbstractGrammarElem } //ConditionConnaissance: - // negation='!'? connaissance=ID; + // negation='!'? connaissance=[Connaissance]; public ConditionConnaissanceElements getConditionConnaissanceAccess() { return pConditionConnaissance; } @@ -1921,7 +1929,7 @@ public class GameGrammarAccess extends AbstractElementFinder.AbstractGrammarElem } //ConditionObjet: - // objet=ID comparateur=COMPARATEUR nombre=INT; + // objet=[Objet] comparateur=COMPARATEUR nombre=INT; public ConditionObjetElements getConditionObjetAccess() { return pConditionObjet; } diff --git a/workspace/fr.n7.game.xtext/src/fr/n7/game/xtext/Game.xtext b/workspace/fr.n7.game.xtext/src/fr/n7/game/xtext/Game.xtext index 80a548e..28534fa 100644 --- a/workspace/fr.n7.game.xtext/src/fr/n7/game/xtext/Game.xtext +++ b/workspace/fr.n7.game.xtext/src/fr/n7/game/xtext/Game.xtext @@ -99,33 +99,33 @@ Description: ; Condition: - condition+=ConditionEt ('||' condition+=ConditionEt)* + condition+=ConditionEt ('||' condition+=ConditionEt)* ; ConditionEt: - conditionTest+=ConditionTest ('&&' conditionTest+=ConditionTest)* + conditionTest+=ConditionTest ('&&' conditionTest+=ConditionTest)* ; ConditionTest: - ConditionBoolean | ConditionConnaissance | ConditionObjet + ConditionBoolean | ConditionConnaissance | ConditionObjet ; ConditionBoolean: - valeur=BOOLEAN + valeur=BOOLEAN ; ConditionConnaissance: - (negation='!')? connaissance=ID + (negation='!')? connaissance=[Connaissance] ; ConditionObjet: - objet=ID comparateur=COMPARATEUR nombre=INT + objet=[Objet] comparateur=COMPARATEUR nombre=INT ; terminal COMPARATEUR: - '<' | '>' | '==' | '<=' | '>=' | '!=' + '<' | '>' | '==' | '<=' | '>=' | '!=' ; terminal BOOLEAN: - 'true' | 'false' + 'true' | 'false' ; From d6fcff5297787850442e518b501d349e938e43b1 Mon Sep 17 00:00:00 2001 From: Guillotin Damien Date: Tue, 18 Jan 2022 19:36:32 +0100 Subject: [PATCH 3/3] feat: :fire: toTLT fait --- .../fr.n7.game.examples/src-gen/Prototype.ltl | 3 + .../fr.n7.game.examples/src-gen/jeu.scn | 0 .../src-gen/.nfs0000000001ae00dc00000007 | 15 - .../src-gen/.nfs0000000001ae00dd00000022 | 15 - .../fr.n7.petrinet.examples/src-gen/jeu.ktz | Bin 0 -> 360 bytes workspace/fr.n7.game.toLTL.ui/.classpath | 7 + workspace/fr.n7.game.toLTL.ui/.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 6 + .../fr.n7.game.toLTL.ui/META-INF/MANIFEST.MF | 20 + .../fr.n7.game.toLTL.ui/build.properties | 7 + .../fr.n7.game.toLTL.ui/icons/default.gif | Bin 0 -> 534 bytes workspace/fr.n7.game.toLTL.ui/plugin.xml | 22 + .../src/fr/n7/game/toLTL/ui/Activator.java | 66 +++ .../n7/game/toLTL/ui/common/GenerateAll.java | 86 ++++ .../AcceleoGenerateToLTLAction.java | 116 +++++ workspace/fr.n7.game.toLTL/.classpath | 7 + workspace/fr.n7.game.toLTL/.project | 50 +++ .../fr.n7.game.toLTL/META-INF/MANIFEST.MF | 23 + workspace/fr.n7.game.toLTL/bin/.gitignore | 1 + workspace/fr.n7.game.toLTL/build.properties | 5 + .../src/fr/n7/game/toLTL/Activator.java | 66 +++ .../src/fr/n7/game/toLTL/main/ToLTL.java | 412 ++++++++++++++++++ .../src/fr/n7/game/toLTL/main/toLTL.mtl | 21 + workspace/fr.n7.game.toLTL/tasks/toLTL.xml | 66 +++ .../fr.n7.game.toLTL/tasks/toLTLTarget.xml | 19 + 25 files changed, 1031 insertions(+), 30 deletions(-) create mode 100644 runtime-workspace/fr.n7.game.examples/src-gen/Prototype.ltl create mode 100644 runtime-workspace/fr.n7.game.examples/src-gen/jeu.scn delete mode 100644 runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 delete mode 100644 runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 create mode 100644 runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.ktz create mode 100644 workspace/fr.n7.game.toLTL.ui/.classpath create mode 100644 workspace/fr.n7.game.toLTL.ui/.project create mode 100644 workspace/fr.n7.game.toLTL.ui/.settings/org.eclipse.jdt.core.prefs create mode 100644 workspace/fr.n7.game.toLTL.ui/META-INF/MANIFEST.MF create mode 100644 workspace/fr.n7.game.toLTL.ui/build.properties create mode 100644 workspace/fr.n7.game.toLTL.ui/icons/default.gif create mode 100644 workspace/fr.n7.game.toLTL.ui/plugin.xml create mode 100644 workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/Activator.java create mode 100644 workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/common/GenerateAll.java create mode 100644 workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/popupMenus/AcceleoGenerateToLTLAction.java create mode 100644 workspace/fr.n7.game.toLTL/.classpath create mode 100644 workspace/fr.n7.game.toLTL/.project create mode 100644 workspace/fr.n7.game.toLTL/META-INF/MANIFEST.MF create mode 100644 workspace/fr.n7.game.toLTL/bin/.gitignore create mode 100644 workspace/fr.n7.game.toLTL/build.properties create mode 100644 workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/Activator.java create mode 100644 workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/ToLTL.java create mode 100644 workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/toLTL.mtl create mode 100644 workspace/fr.n7.game.toLTL/tasks/toLTL.xml create mode 100644 workspace/fr.n7.game.toLTL/tasks/toLTLTarget.xml diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.ltl b/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.ltl new file mode 100644 index 0000000..647837f --- /dev/null +++ b/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.ltl @@ -0,0 +1,3 @@ +op finished = lieu_Succes \/ lieu_Echec; +[] (finished => dead); +[] <> finished ; diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/jeu.scn b/runtime-workspace/fr.n7.game.examples/src-gen/jeu.scn new file mode 100644 index 0000000..e69de29 diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 b/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 deleted file mode 100644 index a8d10bf..0000000 --- a/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dc00000007 +++ /dev/null @@ -1,15 +0,0 @@ -net jeu -pl taille (0) -pl objet_tentative (3) -pl objet_tentative_neg (0) -pl connaissance_Reussite (0) -pl connaissance_Reussite_neg (1) -pl personne_Sphinx (0) -pl lieu_Enigme (1) -pl lieu_Succes (0) -pl lieu_Echec (0) -tr chemin_Win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 -tr chemin_Loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 -tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 -tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 -tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 b/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 deleted file mode 100644 index a8d10bf..0000000 --- a/runtime-workspace/fr.n7.petrinet.examples/src-gen/.nfs0000000001ae00dd00000022 +++ /dev/null @@ -1,15 +0,0 @@ -net jeu -pl taille (0) -pl objet_tentative (3) -pl objet_tentative_neg (0) -pl connaissance_Reussite (0) -pl connaissance_Reussite_neg (1) -pl personne_Sphinx (0) -pl lieu_Enigme (1) -pl lieu_Succes (0) -pl lieu_Echec (0) -tr chemin_Win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 -tr chemin_Loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 -tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 -tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 -tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.ktz b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.ktz new file mode 100644 index 0000000000000000000000000000000000000000..b5bb021181be50c38e6c1930c0eaa60a03fcb362 GIT binary patch literal 360 zcmV-u0hj(CiwFP!0000018tB?OT$1Eh3C<{nmz<^A#Uaulq42WcOqS=MZ^?bhIG8N zQ_@LECPn|fcg(mchIyUy&AE5T%PLQjG$s8var+o2JMrvJ-PyZ&Y@jsoDOMeb=TeLG zR-||L8ID9`NtTKAw^%*BK8PbUt*W)Sp3P@-#&^&$x+IjhQqr767qZs6RBc;o3B@~f zZL17i{_7SRHp5CmS1jZfWZWOM+U%h}=be<$PV4m!OkqHq(x@YxpJ-cVdcbF44=D1( zR_QO_l&Y$L(gpF(N@?)L*!EEC7K-%L$R^l+uXM4jYm~{z$q$^#mC^7;^8IqX>~&7$S9f&*uLEwn9KH;sN0i + + + + + + diff --git a/workspace/fr.n7.game.toLTL.ui/.project b/workspace/fr.n7.game.toLTL.ui/.project new file mode 100644 index 0000000..f432184 --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/.project @@ -0,0 +1,28 @@ + + + fr.n7.game.toLTL.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/workspace/fr.n7.game.toLTL.ui/.settings/org.eclipse.jdt.core.prefs b/workspace/fr.n7.game.toLTL.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d1c0bf9 --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/workspace/fr.n7.game.toLTL.ui/META-INF/MANIFEST.MF b/workspace/fr.n7.game.toLTL.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..255fd49 --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Acceleo ToLTL Module IDE Plug-in +Bundle-SymbolicName: fr.n7.game.toLTL.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: fr.n7.game.toLTL.ui.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources, + fr.n7.game.toLTL, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.ocl, + org.eclipse.ocl.ecore, + org.eclipse.acceleo.model, + org.eclipse.acceleo.engine +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true diff --git a/workspace/fr.n7.game.toLTL.ui/build.properties b/workspace/fr.n7.game.toLTL.ui/build.properties new file mode 100644 index 0000000..d0a0e71 --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/ + diff --git a/workspace/fr.n7.game.toLTL.ui/icons/default.gif b/workspace/fr.n7.game.toLTL.ui/icons/default.gif new file mode 100644 index 0000000000000000000000000000000000000000..6a04c491b290f805a98268a5aa363be0fccf128f GIT binary patch literal 534 zcmZ?wbhEHb6krfwI2OaeTA#w%m?qeoBi~)3+Fz+Yp~`Mnm+QPf-^G*tmP~4$vaxIW zx`-7s`(~_)S~a_S=C;_?^QO#R)<1XWgt*sjqB#@TGzg3UCW+ztxdak>|Niq zdwoaKp6%N<%sjZEZpMzy2RAm(+_9~7-}c>`rXJf=HE-vZ&i#9*96mPX$k7wKCLGy4 zXWG%@NB7J=zGueqJu^@4opEH}%DE>_%{zH!{>ii34qe-M`0Ab`m-ijJxcuzp1IN#w zI&=KYnPX?p9^G=~_SP%6wqCit + + + + + + + + + + + diff --git a/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/Activator.java b/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/Activator.java new file mode 100644 index 0000000..c5a412b --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/Activator.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.game.toLTL.ui; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "fr.n7.game.toLTL.ui"; + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The constructor. + */ + public Activator() { + } + + /**{@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) + * @generated + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /**{@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + * @generated + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance. + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/common/GenerateAll.java b/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/common/GenerateAll.java new file mode 100644 index 0000000..8bb347b --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/common/GenerateAll.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.game.toLTL.ui.common; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.BasicMonitor; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.URI; + + +/** + * Main entry point of the 'ToLTL' generation module. + */ +public class GenerateAll { + + /** + * The model URI. + */ + private URI modelURI; + + /** + * The output folder. + */ + private IContainer targetFolder; + + /** + * The other arguments. + */ + List arguments; + + /** + * Constructor. + * + * @param modelURI + * is the URI of the model. + * @param targetFolder + * is the output folder + * @param arguments + * are the other arguments + * @throws IOException + * Thrown when the output cannot be saved. + * @generated + */ + public GenerateAll(URI modelURI, IContainer targetFolder, List arguments) { + this.modelURI = modelURI; + this.targetFolder = targetFolder; + this.arguments = arguments; + } + + /** + * Launches the generation. + * + * @param monitor + * This will be used to display progress information to the user. + * @throws IOException + * Thrown when the output cannot be saved. + * @generated + */ + public void doGenerate(IProgressMonitor monitor) throws IOException { + if (!targetFolder.getLocation().toFile().exists()) { + targetFolder.getLocation().toFile().mkdirs(); + } + + monitor.subTask("Loading..."); + fr.n7.game.toLTL.main.ToLTL gen0 = new fr.n7.game.toLTL.main.ToLTL(modelURI, targetFolder.getLocation().toFile(), arguments); + monitor.worked(1); + String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("fr.n7.game.toLTL", "fr.n7.game.toLTL.main.ToLTL", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList()); + gen0.setGenerationID(generationID); + gen0.doGenerate(BasicMonitor.toMonitor(monitor)); + + + } + +} diff --git a/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/popupMenus/AcceleoGenerateToLTLAction.java b/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/popupMenus/AcceleoGenerateToLTLAction.java new file mode 100644 index 0000000..86ce659 --- /dev/null +++ b/workspace/fr.n7.game.toLTL.ui/src/fr/n7/game/toLTL/ui/popupMenus/AcceleoGenerateToLTLAction.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.game.toLTL.ui.popupMenus; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.List; +import java.util.ArrayList; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import fr.n7.game.toLTL.ui.Activator; +import fr.n7.game.toLTL.ui.common.GenerateAll; +import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionDelegate; + +/** + * ToLTL code generation. + */ +public class AcceleoGenerateToLTLAction extends ActionDelegate implements IActionDelegate { + + /** + * Selected model files. + */ + protected List files; + + /**{@inheritDoc} + * + * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + * @generated + */ + @SuppressWarnings("unchecked") + public void selectionChanged(IAction action, ISelection selection) { + if (selection instanceof IStructuredSelection) { + files = ((IStructuredSelection) selection).toList(); + } + } + + /**{@inheritDoc} + * + * @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction) + * @generated + */ + public void run(IAction action) { + if (files != null) { + IRunnableWithProgress operation = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + try { + Iterator filesIt = files.iterator(); + while (filesIt.hasNext()) { + IFile model = (IFile)filesIt.next(); + URI modelURI = URI.createPlatformResourceURI(model.getFullPath().toString(), true); + IContainer targetFolder = null; + try { + IContainer target = model.getProject().getFolder("src-gen"); + targetFolder = target; + GenerateAll generator = new GenerateAll(modelURI, targetFolder, getArguments()); + generator.doGenerate(monitor); + } catch (IOException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } finally { + if (targetFolder != null) { + targetFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor); + } + } + } + } catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } + } + }; + try { + PlatformUI.getWorkbench().getProgressService().run(true, true, operation); + } catch (InvocationTargetException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } catch (InterruptedException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } + } + } + + /** + * Computes the arguments of the generator. + * + * @return the arguments + * @generated + */ + protected List getArguments() { + return new ArrayList(); + } + +} \ No newline at end of file diff --git a/workspace/fr.n7.game.toLTL/.classpath b/workspace/fr.n7.game.toLTL/.classpath new file mode 100644 index 0000000..16c89a3 --- /dev/null +++ b/workspace/fr.n7.game.toLTL/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.game.toLTL/.project b/workspace/fr.n7.game.toLTL/.project new file mode 100644 index 0000000..2a6b756 --- /dev/null +++ b/workspace/fr.n7.game.toLTL/.project @@ -0,0 +1,50 @@ + + + fr.n7.game.toLTL + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.acceleo.ide.ui.acceleoBuilder + + + compilation.kind + compilation.platform.resource + + + compliance + pragmatic + + + resource.kind + xmi + + + trim-position + false + + + + + + org.eclipse.acceleo.ide.ui.acceleoNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workspace/fr.n7.game.toLTL/META-INF/MANIFEST.MF b/workspace/fr.n7.game.toLTL/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e94e920 --- /dev/null +++ b/workspace/fr.n7.game.toLTL/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Acceleo ToLTL Module Runtime Plug-in +Bundle-SymbolicName: fr.n7.game.toLTL +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: fr.n7.game.toLTL.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.ocl, + org.eclipse.ocl.ecore, + org.eclipse.acceleo.common;bundle-version="3.3.0", + org.eclipse.acceleo.model;bundle-version="3.3.0", + org.eclipse.acceleo.profiler;bundle-version="3.3.0", + org.eclipse.acceleo.engine;bundle-version="3.3.0", + com.google.guava +Bundle-RequiredExecutionEnvironment: JavaSE-12 +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true +Export-Package: fr.n7.game.toLTL.main + diff --git a/workspace/fr.n7.game.toLTL/bin/.gitignore b/workspace/fr.n7.game.toLTL/bin/.gitignore new file mode 100644 index 0000000..44fde90 --- /dev/null +++ b/workspace/fr.n7.game.toLTL/bin/.gitignore @@ -0,0 +1 @@ +/fr/ diff --git a/workspace/fr.n7.game.toLTL/build.properties b/workspace/fr.n7.game.toLTL/build.properties new file mode 100644 index 0000000..3028e3c --- /dev/null +++ b/workspace/fr.n7.game.toLTL/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . +jre.compilation.profile = JavaSE-12 diff --git a/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/Activator.java b/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/Activator.java new file mode 100644 index 0000000..dd179e0 --- /dev/null +++ b/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/Activator.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2008, 2011 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.game.toLTL; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends Plugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "fr.n7.game.toLTL"; + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance. + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/ToLTL.java b/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/ToLTL.java new file mode 100644 index 0000000..9a9efbf --- /dev/null +++ b/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/ToLTL.java @@ -0,0 +1,412 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.game.toLTL.main; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener; +import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy; +import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator; +import org.eclipse.emf.common.util.BasicMonitor; +import org.eclipse.emf.common.util.Monitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; + +/** + * Entry point of the 'ToLTL' generation module. + * + * @generated + */ +public class ToLTL extends AbstractAcceleoGenerator { + /** + * The name of the module. + * + * @generated + */ + public static final String MODULE_FILE_NAME = "/fr/n7/game/toLTL/main/toLTL"; + + /** + * The name of the templates that are to be generated. + * + * @generated + */ + public static final String[] TEMPLATE_NAMES = { "generateElement" }; + + /** + * The list of properties files from the launch parameters (Launch configuration). + * + * @generated + */ + private List propertiesFiles = new ArrayList(); + + /** + * Allows the public constructor to be used. Note that a generator created + * this way cannot be used to launch generations before one of + * {@link #initialize(EObject, File, List)} or + * {@link #initialize(URI, File, List)} is called. + *

+ * The main reason for this constructor is to allow clients of this + * generation to call it from another Java file, as it allows for the + * retrieval of {@link #getProperties()} and + * {@link #getGenerationListeners()}. + *

+ * + * @generated + */ + public ToLTL() { + // Empty implementation + } + + /** + * This allows clients to instantiates a generator with all required information. + * + * @param modelURI + * URI where the model on which this generator will be used is located. + * @param targetFolder + * This will be used as the output folder for this generation : it will be the base path + * against which all file block URLs will be resolved. + * @param arguments + * If the template which will be called requires more than one argument taken from the model, + * pass them here. + * @throws IOException + * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or + * the model cannot be loaded. + * @generated + */ + public ToLTL(URI modelURI, File targetFolder, + List arguments) throws IOException { + initialize(modelURI, targetFolder, arguments); + } + + /** + * This allows clients to instantiates a generator with all required information. + * + * @param model + * We'll iterate over the content of this element to find Objects matching the first parameter + * of the template we need to call. + * @param targetFolder + * This will be used as the output folder for this generation : it will be the base path + * against which all file block URLs will be resolved. + * @param arguments + * If the template which will be called requires more than one argument taken from the model, + * pass them here. + * @throws IOException + * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded. + * @generated + */ + public ToLTL(EObject model, File targetFolder, + List arguments) throws IOException { + initialize(model, targetFolder, arguments); + } + + /** + * This can be used to launch the generation from a standalone application. + * + * @param args + * Arguments of the generation. + * @generated + */ + public static void main(String[] args) { + try { + if (args.length < 2) { + System.out.println("Arguments not valid : {model, folder}."); + } else { + URI modelURI = URI.createFileURI(args[0]); + File folder = new File(args[1]); + + List arguments = new ArrayList(); + + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * Add in this list all the arguments used by the starting point of the generation + * If your main template is called on an element of your model and a String, you can + * add in "arguments" this "String" attribute. + */ + + ToLTL generator = new ToLTL(modelURI, folder, arguments); + + /* + * Add the properties from the launch arguments. + * If you want to programmatically add new properties, add them in "propertiesFiles" + * You can add the absolute path of a properties files, or even a project relative path. + * If you want to add another "protocol" for your properties files, please override + * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. + * The behavior of the properties loader service is explained in the Acceleo documentation + * (Help -> Help Contents). + */ + + for (int i = 2; i < args.length; i++) { + generator.addPropertiesFile(args[i]); + } + + generator.doGenerate(new BasicMonitor()); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Launches the generation described by this instance. + * + * @param monitor + * This will be used to display progress information to the user. + * @throws IOException + * This will be thrown if any of the output files cannot be saved to disk. + * @generated + */ + @Override + public void doGenerate(Monitor monitor) throws IOException { + /* + * TODO if you wish to change the generation as a whole, override this. The default behavior should + * be sufficient in most cases. If you want to change the content of this method, do NOT forget to + * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag, + * any compilation of the Acceleo module with the main template that has caused the creation of this + * class will revert your modifications. If you encounter a problem with an unresolved proxy during the + * generation, you can remove the comments in the following instructions to check for problems. Please + * note that those instructions may have a significant impact on the performances. + */ + + //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model); + + /* + * If you want to check for potential errors in your models before the launch of the generation, you + * use the code below. + */ + + //if (model != null && model.eResource() != null) { + // List errors = model.eResource().getErrors(); + // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) { + // System.err.println(diagnostic.toString()); + // } + //} + + super.doGenerate(monitor); + } + + /** + * If this generator needs to listen to text generation events, listeners can be returned from here. + * + * @return List of listeners that are to be notified when text is generated through this launch. + * @generated + */ + @Override + public List getGenerationListeners() { + List listeners = super.getGenerationListeners(); + /* + * TODO if you need to listen to generation event, add listeners to the list here. If you want to change + * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method + * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template + * that has caused the creation of this class will revert your modifications. + */ + return listeners; + } + + /** + * If you need to change the way files are generated, this is your entry point. + *

+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates + * files on the fly. If you only need to preview the results, return a new + * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of + * the running Eclipse and can be used standalone. + *

+ *

+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna + * override files that are under clear case or any other VCS that could forbid the overriding), then + * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}. + * Note, however, that this cannot be used standalone. + *

+ *

+ * All three of these default strategies support merging through JMerge. + *

+ * + * @return The generation strategy that is to be used for generations launched through this launcher. + * @generated + */ + @Override + public IAcceleoGenerationStrategy getGenerationStrategy() { + return super.getGenerationStrategy(); + } + + /** + * This will be called in order to find and load the module that will be launched through this launcher. + * We expect this name not to contain file extension, and the module to be located beside the launcher. + * + * @return The name of the module that is to be launched. + * @generated + */ + @Override + public String getModuleName() { + return MODULE_FILE_NAME; + } + + /** + * If the module(s) called by this launcher require properties files, return their qualified path from + * here.Take note that the first added properties files will take precedence over subsequent ones if they + * contain conflicting keys. + * + * @return The list of properties file we need to add to the generation context. + * @see java.util.ResourceBundle#getBundle(String) + * @generated + */ + @Override + public List getProperties() { + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * TODO if your generation module requires access to properties files, add their qualified path to the list here. + * + * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse + * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties + * files to the "propertiesFiles" list: + * + * final String prefix = "platform:/plugin/"; + * final String pluginName = "org.eclipse.acceleo.module.sample"; + * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/"; + * final String fileName = "default.properties"; + * propertiesFiles.add(prefix + pluginName + packagePath + fileName); + * + * With this mechanism, you can load properties files from your plugin or from another plugin. + * + * You may want to load properties files from the file system, for that you need to add the absolute path of the file: + * + * propertiesFiles.add("C:\Users\MyName\MyFile.properties"); + * + * If you want to let your users add properties files located in the same folder as the model: + * + * if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) { + * propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource())); + * } + * + * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents). + */ + return propertiesFiles; + } + + /** + * Adds a properties file in the list of properties files. + * + * @param propertiesFile + * The properties file to add. + * @generated + * @since 3.1 + */ + @Override + public void addPropertiesFile(String propertiesFile) { + this.propertiesFiles.add(propertiesFile); + } + + /** + * This will be used to get the list of templates that are to be launched by this launcher. + * + * @return The list of templates to call on the module {@link #getModuleName()}. + * @generated + */ + @Override + public String[] getTemplateNames() { + return TEMPLATE_NAMES; + } + + /** + * This can be used to update the resource set's package registry with all needed EPackages. + * + * @param resourceSet + * The resource set which registry has to be updated. + * @generated + */ + @Override + public void registerPackages(ResourceSet resourceSet) { + super.registerPackages(resourceSet); + + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * If you need additional package registrations, you can register them here. The following line + * (in comment) is an example of the package registration for UML. + * + * You can use the method "isInWorkspace(Class c)" to check if the package that you are about to + * register is in the workspace. + * + * To register a package properly, please follow the following conventions: + * + * If the package is located in another plug-in, already installed in Eclipse. The following content should + * have been generated at the beginning of this method. Do not register the package using this mechanism if + * the metamodel is located in the workspace. + * + * if (!isInWorkspace(UMLPackage.class)) { + * // The normal package registration if your metamodel is in a plugin. + * resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); + * } + * + * If the package is located in another project in your workspace, the plugin containing the package has not + * been register by EMF and Acceleo should register it automatically. If you want to use the generator in + * stand alone, the regular registration (seen a couple lines before) is needed. + * + * To learn more about Package Registration, have a look at the Acceleo documentation (Help -> Help Contents). + */ + } + + /** + * This can be used to update the resource set's resource factory registry with all needed factories. + * + * @param resourceSet + * The resource set which registry has to be updated. + * @generated + */ + @Override + public void registerResourceFactories(ResourceSet resourceSet) { + super.registerResourceFactories(resourceSet); + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * TODO If you need additional resource factories registrations, you can register them here. the following line + * (in comment) is an example of the resource factory registration. + * + * If you want to use the generator in stand alone, the resource factory registration will be required. + * + * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents). + */ + + // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(XyzResource.FILE_EXTENSION, XyzResource.Factory.INSTANCE); + + /* + * Some metamodels require a very complex setup for standalone usage. For example, if you want to use a generator + * targetting UML models in standalone, you NEED to use the following: + */ + // UMLResourcesUtil.init(resourceSet) + } + +} diff --git a/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/toLTL.mtl b/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/toLTL.mtl new file mode 100644 index 0000000..e7fb3d5 --- /dev/null +++ b/workspace/fr.n7.game.toLTL/src/fr/n7/game/toLTL/main/toLTL.mtl @@ -0,0 +1,21 @@ +[comment encoding = UTF-8 /] +[module toLTL('http://www.n7.fr/game/xtext/Game')] + + +[template public generateElement(aJeu : Jeu)] +[comment @main/] +[file ('Prototype.ltl', false, 'UTF-8')] +[let lieux : OrderedSet(Lieu) = aJeu.getLieuxFinaux() ] +[for (lieux) before ('op finished = ') separator (' \\/ ') after (';')]['lieu_' + self.name/][/for] +[/let] +['[] (finished => dead);'/] +['[] <> finished ;'/] +[/file] +[/template] + +[query public getLieuxFinaux(j : Jeu) : OrderedSet(Lieu) = + j.territoire.lieux + ->select(l | l.fin.condition->first().conditionTest->first().oclIsKindOf(ConditionBoolean) + and l.fin.condition->first().conditionTest->first().oclAsType(ConditionBoolean).valeur = 'true') + ->asOrderedSet() +/] \ No newline at end of file diff --git a/workspace/fr.n7.game.toLTL/tasks/toLTL.xml b/workspace/fr.n7.game.toLTL/tasks/toLTL.xml new file mode 100644 index 0000000..d55051b --- /dev/null +++ b/workspace/fr.n7.game.toLTL/tasks/toLTL.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspace/fr.n7.game.toLTL/tasks/toLTLTarget.xml b/workspace/fr.n7.game.toLTL/tasks/toLTLTarget.xml new file mode 100644 index 0000000..f07291d --- /dev/null +++ b/workspace/fr.n7.game.toLTL/tasks/toLTLTarget.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + +