diff options
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.xtext | 32 |
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 | |||
9 | import "https://refinery.tools/emf/2021/Problem" | 9 | import "https://refinery.tools/emf/2021/Problem" |
10 | 10 | ||
11 | Problem: | 11 | Problem: |
12 | ("problem" name=Identifier ".")? | 12 | (kind=ModuleKind name=QualifiedName? ".")? |
13 | statements+=Statement*; | 13 | statements+=Statement*; |
14 | 14 | ||
15 | enum ModuleKind: | ||
16 | PROBLEM="problem" | MODULE="module"; | ||
17 | |||
15 | Statement: | 18 | Statement: |
16 | Assertion | ClassDeclaration | EnumDeclaration | | 19 | ImportStatement | Assertion | ClassDeclaration | EnumDeclaration | |
17 | PredicateDefinition | /* FunctionDefinition | RuleDefinition | */ | 20 | PredicateDefinition | /* FunctionDefinition | RuleDefinition | */ |
18 | ScopeDeclaration | IndividualDeclaration; | 21 | ScopeDeclaration | NodeDeclaration; |
22 | |||
23 | ImportStatement: | ||
24 | "import" importedModule=[Problem|QualifiedName] ("as" alias=ID)? "."; | ||
19 | 25 | ||
20 | ClassDeclaration: | 26 | ClassDeclaration: |
21 | abstract?="abstract"? "class" | 27 | abstract?="abstract"? "class" |
@@ -252,23 +258,28 @@ RangeMultiplicity: | |||
252 | ExactMultiplicity: | 258 | ExactMultiplicity: |
253 | exactValue=INT; | 259 | exactValue=INT; |
254 | 260 | ||
255 | IndividualDeclaration: | 261 | NodeDeclaration: |
256 | "indiv" nodes+=EnumLiteral ("," nodes+=EnumLiteral)* "."; | 262 | ("declare" | "declare"? kind=NodeKind) |
263 | nodes+=EnumLiteral ("," nodes+=EnumLiteral)* "."; | ||
264 | |||
265 | enum NodeKind: | ||
266 | ATOM="atom" | MULTI="multi"; | ||
257 | 267 | ||
258 | UpperBound returns ecore::EInt: | 268 | UpperBound returns ecore::EInt: |
259 | INT | "*"; | 269 | INT | "*"; |
260 | 270 | ||
261 | QualifiedName hidden(): | 271 | QualifiedName hidden(): |
262 | Identifier ("::" Identifier)*; | 272 | "::"? Identifier (QUALIFIED_NAME_SEPARATOR Identifier)*; |
263 | 273 | ||
264 | NonContainmentQualifiedName hidden(): | 274 | NonContainmentQualifiedName hidden(): |
265 | NonContainmentIdentifier ("::" Identifier)*; | 275 | (NonContainmentIdentifier | "::" Identifier) (QUALIFIED_NAME_SEPARATOR Identifier)*; |
266 | 276 | ||
267 | Identifier: | 277 | Identifier: |
268 | NonContainmentIdentifier | "contains" | "container"; | 278 | NonContainmentIdentifier | "contains" | "container"; |
269 | 279 | ||
270 | NonContainmentIdentifier: | 280 | NonContainmentIdentifier: |
271 | ID | "contained" | "sum" | "prod" | "min" | "max"; | 281 | ID | "atom" | "multi" | "contained" | |
282 | "sum" | "prod" | "min" | "max" | "problem" | "module"; | ||
272 | 283 | ||
273 | Real returns ecore::EDouble: | 284 | Real returns ecore::EDouble: |
274 | EXPONENTIAL | INT "." (INT | EXPONENTIAL); | 285 | EXPONENTIAL | INT "." (INT | EXPONENTIAL); |
@@ -276,6 +287,9 @@ Real returns ecore::EDouble: | |||
276 | terminal TRANSITIVE_CLOSURE: | 287 | terminal TRANSITIVE_CLOSURE: |
277 | "synthetic:TRANSITIVE_CLOSURE"; | 288 | "synthetic:TRANSITIVE_CLOSURE"; |
278 | 289 | ||
290 | terminal QUALIFIED_NAME_SEPARATOR: | ||
291 | "synthetic::QUALIFIED_NAME_SEPARATOR"; | ||
292 | |||
279 | @Override | 293 | @Override |
280 | terminal ID: | 294 | terminal ID: |
281 | ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*; | 295 | ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*; |