From 87062feedb09cfdba71d4648e69b05a2e32e542c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Marussy?= Date: Mon, 4 Nov 2024 02:05:30 +0100 Subject: [PATCH] refactor(language): make opposite and subsets contextual keywords --- subprojects/frontend/src/language/problem.grammar | 8 +++++--- .../src/main/java/tools/refinery/language/Problem.xtext | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar index 1af17c36..254029cd 100644 --- a/subprojects/frontend/src/language/problem.grammar +++ b/subprojects/frontend/src/language/problem.grammar @@ -54,7 +54,7 @@ statement { PredicateDefinition { ((kw<"error"> | kw<"partial"> | ckw<"shadow">)* kw<"pred"> | kw<"error">) RelationName ParameterList? - (kw<"subsets"> sep1<",", RelationName>)* + (ckw<"subsets"> sep1<",", RelationName>)* PredicateBody { ("<->" sep)? "." } } | // FunctionDefinition { @@ -91,8 +91,10 @@ FeatureDeclaration { ("[" Multiplicity? "]")? RelationName ( - kw<"opposite"> RelationName | - kw<"subsets"> sep1<",", RelationName> + !feature RelationOptions[@dynamicPrecedence=1] { + ckw<"opposite"> RelationName | + ckw<"subsets"> sep1<",", RelationName> + } )* ";"? } 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 4e266b18..283afae2 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext +++ b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext @@ -301,7 +301,7 @@ NonContainmentQualifiedName hidden(): (NonContainmentIdentifier | "::" Identifier) (QUALIFIED_NAME_SEPARATOR Identifier)*; Identifier: - NonContainmentIdentifier | "contains" | "container"; + NonContainmentIdentifier | "contains" | "container" | "opposite" | "subsets"; NonContainmentIdentifier: ID | QUOTED_ID | "atom" | "multi" | "problem" | "module" |