aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/language/src/main/java/tools/refinery/language/Problem.xtext')
-rw-r--r--subprojects/language/src/main/java/tools/refinery/language/Problem.xtext32
1 files changed, 23 insertions, 9 deletions
diff --git a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
index 0fb96954..f0d6c38c 100644
--- a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
+++ b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext
@@ -1,5 +1,5 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> 2 * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/>
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
@@ -9,13 +9,19 @@ import "http://www.eclipse.org/emf/2002/Ecore" as ecore
9import "https://refinery.tools/emf/2021/Problem" 9import "https://refinery.tools/emf/2021/Problem"
10 10
11Problem: 11Problem:
12 ("problem" name=Identifier ".")? 12 (kind=ModuleKind name=QualifiedName? ".")?
13 statements+=Statement*; 13 statements+=Statement*;
14 14
15enum ModuleKind:
16 PROBLEM="problem" | MODULE="module";
17
15Statement: 18Statement:
16 Assertion | ClassDeclaration | EnumDeclaration | 19 ImportStatement | Assertion | ClassDeclaration | EnumDeclaration |
17 PredicateDefinition | /* FunctionDefinition | RuleDefinition | */ 20 PredicateDefinition | /* FunctionDefinition | RuleDefinition | */
18 ScopeDeclaration | IndividualDeclaration; 21 ScopeDeclaration | NodeDeclaration;
22
23ImportStatement:
24 "import" importedModule=[Problem|QualifiedName] ("as" alias=ID)? ".";
19 25
20ClassDeclaration: 26ClassDeclaration:
21 abstract?="abstract"? "class" 27 abstract?="abstract"? "class"
@@ -252,23 +258,28 @@ RangeMultiplicity:
252ExactMultiplicity: 258ExactMultiplicity:
253 exactValue=INT; 259 exactValue=INT;
254 260
255IndividualDeclaration: 261NodeDeclaration:
256 "indiv" nodes+=EnumLiteral ("," nodes+=EnumLiteral)* "."; 262 ("declare" | "declare"? kind=NodeKind)
263 nodes+=EnumLiteral ("," nodes+=EnumLiteral)* ".";
264
265enum NodeKind:
266 ATOM="atom" | MULTI="multi";
257 267
258UpperBound returns ecore::EInt: 268UpperBound returns ecore::EInt:
259 INT | "*"; 269 INT | "*";
260 270
261QualifiedName hidden(): 271QualifiedName hidden():
262 Identifier ("::" Identifier)*; 272 "::"? Identifier (QUALIFIED_NAME_SEPARATOR Identifier)*;
263 273
264NonContainmentQualifiedName hidden(): 274NonContainmentQualifiedName hidden():
265 NonContainmentIdentifier ("::" Identifier)*; 275 (NonContainmentIdentifier | "::" Identifier) (QUALIFIED_NAME_SEPARATOR Identifier)*;
266 276
267Identifier: 277Identifier:
268 NonContainmentIdentifier | "contains" | "container"; 278 NonContainmentIdentifier | "contains" | "container";
269 279
270NonContainmentIdentifier: 280NonContainmentIdentifier:
271 ID | "contained" | "sum" | "prod" | "min" | "max"; 281 ID | "atom" | "multi" | "contained" |
282 "sum" | "prod" | "min" | "max" | "problem" | "module";
272 283
273Real returns ecore::EDouble: 284Real returns ecore::EDouble:
274 EXPONENTIAL | INT "." (INT | EXPONENTIAL); 285 EXPONENTIAL | INT "." (INT | EXPONENTIAL);
@@ -276,6 +287,9 @@ Real returns ecore::EDouble:
276terminal TRANSITIVE_CLOSURE: 287terminal TRANSITIVE_CLOSURE:
277 "synthetic:TRANSITIVE_CLOSURE"; 288 "synthetic:TRANSITIVE_CLOSURE";
278 289
290terminal QUALIFIED_NAME_SEPARATOR:
291 "synthetic::QUALIFIED_NAME_SEPARATOR";
292
279@Override 293@Override
280terminal ID: 294terminal ID:
281 ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*; 295 ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*;