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 20:57:15 +00:00
|
|
|
'"Explorateur"' ':' explorateur=Explorateur ','
|
|
|
|
'"Territoire"' ':' territoire=Territoire ','
|
|
|
|
'"Objets"' ':' '[' objets+=Objet* ']' ','
|
|
|
|
'"Connaissances"' ':' '[' connaissances+=Connaissance* ']' ','
|
|
|
|
'"Personnes"' ':' '[' personnes+=Personne* ']' ','
|
|
|
|
'"Transformations"' ':' '[' transformations+=Transformation* ']'
|
2021-11-30 20:50:41 +00:00
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Explorateur:
|
2021-11-30 20:57:15 +00:00
|
|
|
'{'
|
2021-11-30 20:50:41 +00:00
|
|
|
'"taille"' ':' tailleInventaire=INT ','
|
2021-12-01 07:58:07 +00:00
|
|
|
'"connaissances"' ':' '[' (connaissances+=Nom (',' connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets"' ':' '[' (objets+=Nom (',' objets+=Nom)*)? ']'
|
2021-11-30 20:50:41 +00:00
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Territoire:
|
2021-11-30 20:57:15 +00:00
|
|
|
'{'
|
2021-12-01 07:58:07 +00:00
|
|
|
'"Lieux"' ':' '[' (lieux+=Lieu (lieux+=Lieu)*)? ']' ','
|
2021-11-30 20:50:41 +00:00
|
|
|
'"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)+ ']' ','
|
2021-12-01 07:58:07 +00:00
|
|
|
'"objets"' ':' '[' (objets+=Nom (objets+=Nom)*)? ']' ','
|
2021-11-30 20:50:41 +00:00
|
|
|
'"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 ','
|
2021-11-30 22:02:55 +00:00
|
|
|
'"ouvert"' ':' ouvert=Condition ','
|
2021-11-30 20:50:41 +00:00
|
|
|
'"visible"' ':' visible=Condition ','
|
|
|
|
'"obligatoire"' ':' obligatoire=Condition ','
|
2021-12-01 07:58:07 +00:00
|
|
|
'"connaissances"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets_recus"' ':' '[' (objetsRecus+=Nom (objetsRecus+=Nom)*)? ']' ','
|
2021-11-30 20:50:41 +00:00
|
|
|
'"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:
|
2021-11-30 20:57:15 +00:00
|
|
|
'{'
|
|
|
|
'"visible"' ':' visible=Condition ','
|
2021-12-01 07:58:07 +00:00
|
|
|
'"connaissances"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets_recus"' ':' '[' (objetsRecus+=Nom (objetsRecus+=Nom)*)? ']' ','
|
2021-11-30 20:57:15 +00:00
|
|
|
'"actions"' ':' '[' (actions+=Action)+ ']' ','
|
|
|
|
'}'
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
Action:
|
2021-11-30 20:50:41 +00:00
|
|
|
'{'
|
|
|
|
'"visible"' ':' visible=Condition ','
|
2021-12-01 07:58:07 +00:00
|
|
|
'"connaissances"' ':' '[' (connaissances+=Nom (connaissances+=Nom)*)? ']' ','
|
|
|
|
'"objets_recus"' ':' '[' (objetsRecus+=Nom (objetsRecus+=Nom)*)? ']' ','
|
2021-11-30 20:50:41 +00:00
|
|
|
'"objets_conso"' ':' '[' (objetsConso+=Nom (objetsConso+=Nom)*)? ']' ','
|
2021-12-01 07:58:07 +00:00
|
|
|
'"fin_interraction"' ':' 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
|
|
|
;
|
|
|
|
|
2021-11-30 20:57:15 +00:00
|
|
|
NOTConditionConnaissance:
|
2021-11-30 20:50:41 +00:00
|
|
|
'!' 'connaissance_' connaissance=Nom
|
2021-11-29 19:29:53 +00:00
|
|
|
;
|
|
|
|
|
2021-12-01 07:58:07 +00:00
|
|
|
ConditionObjet:
|
2021-11-30 20:50:41 +00:00
|
|
|
'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 '"'
|
|
|
|
;
|