2021-11-29 19:29:53 +00:00
|
|
|
grammar xtext.Game with org.eclipse.xtext.common.Terminals
|
|
|
|
|
2021-11-30 20:50:41 +00:00
|
|
|
generate game "http://game"
|
|
|
|
|
|
|
|
// https://gist.github.com/nightscape/629651
|
2021-11-29 19:29:53 +00:00
|
|
|
|
|
|
|
Jeu:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
2021-11-30 17:25:45 +00:00
|
|
|
explorateur=Explorateur
|
|
|
|
territoire=Territoire
|
|
|
|
objets+=Objet*
|
|
|
|
connaissances+=Connaissance*
|
|
|
|
personnes+=Personne*
|
|
|
|
transformations+=Transformation*
|
2021-11-30 20:50:41 +00:00
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Explorateur:
|
2021-11-30 20:50:41 +00:00
|
|
|
'"Explorateur"' ':' '{'
|
|
|
|
'"taille"' ':' tailleInventaire=INT ','
|
|
|
|
'"connaissances"' ':' '[' (connaissance+=Nom (',' connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets"' ':' '[' (objets+=Item (',' objets+=Item)*)? ']'
|
|
|
|
'}'
|
|
|
|
;
|
|
|
|
|
|
|
|
Item:
|
|
|
|
'{'
|
|
|
|
'"nom"' ':' nom=Nom ','
|
|
|
|
'"qty"' ':' qty=INT
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Territoire:
|
2021-11-30 20:50:41 +00:00
|
|
|
'"Territoire"' ':' '{'
|
|
|
|
'"Lieux"' ':' '[' (lieux+=Lieu (lieux+=Lieux)*)? ']' ','
|
|
|
|
'"Chemins"' ':' '[' (chemins+=Chemin (chemins+=Chemin)*)? ']'
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Lieu:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"nom"' ':' nom=Nom ','
|
|
|
|
'"deposable"' ':' deposable=Condition ','
|
|
|
|
'"depart"' ':' depart=Condition ','
|
|
|
|
'"fin"' ':' fin=Condition ','
|
|
|
|
'"personnes"' ':' '[' (personnes+=Nom (personnes+=Nom)*)? ']' ','
|
|
|
|
'"descriptions"' ':' '[' (descriptions+=Description)+ ']' ','
|
|
|
|
'"objets"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"connaissances"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']'
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Chemin:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"lieu_in"' ':' lieuIn=Nom ','
|
|
|
|
'"lieu_out"' ':' lieuOut=Nom ','
|
|
|
|
'"ouver"' ':' ouvert=Condition ','
|
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"obligatoire"' ':' obligatoire=Condition ','
|
|
|
|
'"connaissances_gift"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets_gift"' ':' '[' (objetsGift+=Nom (objetsGift+=Nom)*)? ']' ','
|
|
|
|
'"objets_conso"' ':' '[' (objetsConso+=Nom (objetsConso+=Nom)*)? ']' ','
|
|
|
|
'"descriptions"' ':' '[' (descriptions+=Description)+ ']'
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Objet:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"nom"' ':' nom=Nom ','
|
|
|
|
'"taille"' ':' taille=INT ','
|
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"descriptions"' ':' '[' (descriptions+=Description)+ ']'
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Transformation:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"condition"' ':' condition=Condition ','
|
|
|
|
'"objets_in"' ':' '[' (objetsIn+=Nom (objetsIn+=Nom)*)? ']' ','
|
|
|
|
'"objets_out"' ':' '[' (objetsOut+=Nom (objetsOut+=Nom)*)? ']' ','
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Connaissance:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"nom"' ':' nom=Nom ','
|
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"descriptions"' ':' '[' (descriptions+=Description)+ ']'
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Personne:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"nom"' ':' nom=Nom ','
|
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"obligatoire"' ':' obligatoire=Condition ','
|
|
|
|
'"interactions"' ':' '[' (interactions+=Interaction (interactions+=Interaction)*)? ']'
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
2021-11-30 19:49:01 +00:00
|
|
|
Interaction:
|
|
|
|
'Interaction'
|
2021-11-30 17:25:45 +00:00
|
|
|
'{'
|
2021-11-30 20:50:41 +00:00
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"connaissances_gift"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets_gift"' ':' '[' (objetsGift+=Nom (objetsGift+=Nom)*)? ']' ','
|
|
|
|
'"actions"' ':' '[' (actions+=Action)+ ']' ','
|
2021-11-30 17:25:45 +00:00
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Action:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"connaissances_gift"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets_gift"' ':' '[' (objetsGift+=Nom (objetsGift+=Nom)*)? ']' ','
|
|
|
|
'"objets_conso"' ':' '[' (objetsConso+=Nom (objetsConso+=Nom)*)? ']' ','
|
2021-11-30 17:25:45 +00:00
|
|
|
finInterraction=Condition
|
2021-11-30 20:50:41 +00:00
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Description:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"texte"' ':' texte=STRING ','
|
|
|
|
'"condition"' ':' condition=Condition
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Condition:
|
2021-11-30 20:50:41 +00:00
|
|
|
'(' condition+=ConditionEt ('||' condition+=ConditionEt)* ')'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
ConditionEt:
|
2021-11-30 20:50:41 +00:00
|
|
|
'(' conditionTest+=ConditionTest ('&&' conditonTest+=ConditionTest)* ')'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
ConditionTest:
|
2021-11-30 20:50:41 +00:00
|
|
|
ConditionConnaissance | NOTConditionConnaissance | ConditionObjet | 'true' | 'false'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
ConditionConnaissance:
|
2021-11-30 20:50:41 +00:00
|
|
|
'connaissance_' connaissance=Nom
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
AntiConditionConnaissance:
|
2021-11-30 20:50:41 +00:00
|
|
|
'!' 'connaissance_' connaissance=Nom
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
2021-11-30 20:50:41 +00:00
|
|
|
ConditionConnaissance:
|
|
|
|
'objet_' objet=Nom comparateur=Comparateur nombre=INT
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Comparateur:
|
2021-11-30 20:50:41 +00:00
|
|
|
'<' | '>' | '==' | '<=' | '>=' | '!='
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
2021-11-30 17:25:45 +00:00
|
|
|
|
|
|
|
Nom:
|
2021-11-30 20:50:41 +00:00
|
|
|
'"' STRING '"'
|
|
|
|
;
|