diff options
Diffstat (limited to 'subprojects/language')
-rw-r--r-- | subprojects/language/src/main/java/tools/refinery/language/Problem.xtext | 52 | ||||
-rw-r--r-- | subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java | 29 |
2 files changed, 33 insertions, 48 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 2a5af628..f514e96c 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext +++ b/subprojects/language/src/main/java/tools/refinery/language/Problem.xtext | |||
@@ -8,7 +8,7 @@ Problem: | |||
8 | statements+=Statement*; | 8 | statements+=Statement*; |
9 | 9 | ||
10 | Statement: | 10 | Statement: |
11 | ClassDeclaration | EnumDeclaration | PredicateDefinition | RuleDefinition | Assertion | NodeValueAssertion | | 11 | ClassDeclaration | EnumDeclaration | PredicateDefinition | /* RuleDefinition | */ Assertion | NodeValueAssertion | |
12 | ScopeDeclaration | | 12 | ScopeDeclaration | |
13 | IndividualDeclaration; | 13 | IndividualDeclaration; |
14 | 14 | ||
@@ -48,13 +48,13 @@ PredicateDefinition: | |||
48 | ("<->" bodies+=Conjunction (";" bodies+=Conjunction)*)? | 48 | ("<->" bodies+=Conjunction (";" bodies+=Conjunction)*)? |
49 | "."; | 49 | "."; |
50 | 50 | ||
51 | RuleDefinition: | 51 | //RuleDefinition: |
52 | "rule" | 52 | // "rule" |
53 | name=Identifier | 53 | // name=Identifier |
54 | "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" | 54 | // "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" |
55 | (":" bodies+=Conjunction (";" bodies+=Conjunction)* | 55 | // (":" bodies+=Conjunction (";" bodies+=Conjunction)* |
56 | "==>" consequents+=Consequent (";" consequents+=Consequent)*)? | 56 | // "==>" consequents+=Consequent (";" consequents+=Consequent)*)? |
57 | "."; | 57 | // "."; |
58 | 58 | ||
59 | Parameter: | 59 | Parameter: |
60 | (modality=Modality? parameterType=[Relation|QualifiedName])? name=Identifier; | 60 | (modality=Modality? parameterType=[Relation|QualifiedName])? name=Identifier; |
@@ -62,8 +62,8 @@ Parameter: | |||
62 | Conjunction: | 62 | Conjunction: |
63 | literals+=Literal ("," literals+=Literal)*; | 63 | literals+=Literal ("," literals+=Literal)*; |
64 | 64 | ||
65 | Consequent: | 65 | //Consequent: |
66 | actions+=Action ("," actions+=Action)*; | 66 | // actions+=Action ("," actions+=Action)*; |
67 | 67 | ||
68 | Literal: | 68 | Literal: |
69 | Atom | NegativeLiteral | CountLiteral; | 69 | Atom | NegativeLiteral | CountLiteral; |
@@ -77,21 +77,21 @@ enum ComparisonOp: | |||
77 | CountLiteral: | 77 | CountLiteral: |
78 | modality=Modality? "count" atom=Atom op=ComparisonOp threshold=INT; | 78 | modality=Modality? "count" atom=Atom op=ComparisonOp threshold=INT; |
79 | 79 | ||
80 | Action: | 80 | //Action: |
81 | AssertionAction | DeleteAction | NewAction; | 81 | // AssertionAction | DeleteAction | NewAction; |
82 | 82 | // | |
83 | AssertionAction: | 83 | //AssertionAction: |
84 | value=ShortLogicValue? atom=Atom | | 84 | // value=ShortLogicValue? atom=Atom | |
85 | atom=Atom (overwrite?=":=" | "<:") value=LogicValue; | 85 | // atom=Atom (overwrite?=":=" | "<:") value=LogicValue; |
86 | 86 | // | |
87 | DeleteAction: | 87 | //DeleteAction: |
88 | "delete" variableOrNode=[VariableOrNode|QualifiedName]; | 88 | // "delete" variableOrNode=[VariableOrNode|QualifiedName]; |
89 | 89 | // | |
90 | NewAction: | 90 | //NewAction: |
91 | "new" variable=NewVariable ("<:" parent=[VariableOrNode|QualifiedName])?; | 91 | // "new" variable=NewVariable ("<:" parent=[VariableOrNode|QualifiedName])?; |
92 | 92 | // | |
93 | NewVariable: | 93 | //NewVariable: |
94 | name=Identifier; | 94 | // name=Identifier; |
95 | 95 | ||
96 | enum Modality: | 96 | enum Modality: |
97 | MAY="may" | MUST="must" | CURRENT="current"; | 97 | MAY="may" | MUST="must" | CURRENT="current"; |
@@ -191,7 +191,7 @@ QualifiedName hidden(): | |||
191 | 191 | ||
192 | NonRelationKindIdentifier: | 192 | NonRelationKindIdentifier: |
193 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | | 193 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | |
194 | "pred" | "indiv" | "problem" | "new" | "delete" | "rule" | "may" | "must" | "current" | | 194 | "pred" | "indiv" | "problem" | /* "new" | "delete" | "rule" | */ "may" | "must" | "current" | |
195 | "count" | "default" | "scope" | "contained" | "containment"; | 195 | "count" | "default" | "scope" | "contained" | "containment"; |
196 | 196 | ||
197 | Identifier: | 197 | Identifier: |
diff --git a/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java b/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java index 87cce1f3..a386db7f 100644 --- a/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java +++ b/subprojects/language/src/main/java/tools/refinery/language/utils/SymbolCollector.java | |||
@@ -1,32 +1,15 @@ | |||
1 | package tools.refinery.language.utils; | 1 | package tools.refinery.language.utils; |
2 | 2 | ||
3 | import java.util.LinkedHashMap; | 3 | import com.google.inject.Inject; |
4 | import java.util.List; | ||
5 | import java.util.Map; | ||
6 | |||
7 | import org.eclipse.emf.ecore.EObject; | 4 | import org.eclipse.emf.ecore.EObject; |
8 | import org.eclipse.emf.ecore.util.EcoreUtil; | 5 | import org.eclipse.emf.ecore.util.EcoreUtil; |
9 | import org.eclipse.xtext.naming.IQualifiedNameConverter; | 6 | import org.eclipse.xtext.naming.IQualifiedNameConverter; |
10 | import org.eclipse.xtext.naming.IQualifiedNameProvider; | 7 | import org.eclipse.xtext.naming.IQualifiedNameProvider; |
8 | import tools.refinery.language.model.problem.*; | ||
11 | 9 | ||
12 | import com.google.inject.Inject; | 10 | import java.util.LinkedHashMap; |
13 | 11 | import java.util.List; | |
14 | import tools.refinery.language.model.problem.Assertion; | 12 | import java.util.Map; |
15 | import tools.refinery.language.model.problem.ClassDeclaration; | ||
16 | import tools.refinery.language.model.problem.ConstantAssertionArgument; | ||
17 | import tools.refinery.language.model.problem.EnumDeclaration; | ||
18 | import tools.refinery.language.model.problem.IndividualDeclaration; | ||
19 | import tools.refinery.language.model.problem.IntConstant; | ||
20 | import tools.refinery.language.model.problem.LogicValue; | ||
21 | import tools.refinery.language.model.problem.Node; | ||
22 | import tools.refinery.language.model.problem.NodeValueAssertion; | ||
23 | import tools.refinery.language.model.problem.PredicateDefinition; | ||
24 | import tools.refinery.language.model.problem.PredicateKind; | ||
25 | import tools.refinery.language.model.problem.Problem; | ||
26 | import tools.refinery.language.model.problem.ProblemFactory; | ||
27 | import tools.refinery.language.model.problem.RealConstant; | ||
28 | import tools.refinery.language.model.problem.Relation; | ||
29 | import tools.refinery.language.model.problem.StringConstant; | ||
30 | 13 | ||
31 | class SymbolCollector { | 14 | class SymbolCollector { |
32 | @Inject | 15 | @Inject |
@@ -64,6 +47,8 @@ class SymbolCollector { | |||
64 | collectClass(classDeclaration); | 47 | collectClass(classDeclaration); |
65 | } else if (statement instanceof EnumDeclaration enumDeclaration) { | 48 | } else if (statement instanceof EnumDeclaration enumDeclaration) { |
66 | collectEnum(enumDeclaration); | 49 | collectEnum(enumDeclaration); |
50 | } else if (statement instanceof RuleDefinition) { | ||
51 | throw new UnsupportedOperationException("Rules are not currently supported"); | ||
67 | } | 52 | } |
68 | } | 53 | } |
69 | } | 54 | } |