diff options
Diffstat (limited to 'language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext')
-rw-r--r-- | language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext b/language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext index 9e032a13..d4fa6f35 100644 --- a/language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext +++ b/language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext | |||
@@ -8,7 +8,8 @@ Problem: | |||
8 | statements+=Statement*; | 8 | statements+=Statement*; |
9 | 9 | ||
10 | Statement: | 10 | Statement: |
11 | ClassDeclaration | EnumDeclaration | PredicateDefinition | Assertion | NodeValueAssertion | ScopeDeclaration; | 11 | ClassDeclaration | EnumDeclaration | PredicateDefinition | Assertion | NodeValueAssertion | ScopeDeclaration | |
12 | UniqueDeclaration; | ||
12 | 13 | ||
13 | ClassDeclaration: | 14 | ClassDeclaration: |
14 | abstract?="abstract"? "class" | 15 | abstract?="abstract"? "class" |
@@ -25,7 +26,7 @@ EnumLiteral returns Node: | |||
25 | name=Identifier; | 26 | name=Identifier; |
26 | 27 | ||
27 | ReferenceDeclaration: | 28 | ReferenceDeclaration: |
28 | (containment?="contains" | "refers")? | 29 | (-> (containment?="contains" | "refers"))? |
29 | referenceType=[Relation|QualifiedName] | 30 | referenceType=[Relation|QualifiedName] |
30 | ("[" multiplicity=Multiplicity "]")? | 31 | ("[" multiplicity=Multiplicity "]")? |
31 | name=Identifier | 32 | name=Identifier |
@@ -35,7 +36,7 @@ PredicateDefinition: | |||
35 | (error?="error" "pred"? | "pred") | 36 | (error?="error" "pred"? | "pred") |
36 | name=Identifier | 37 | name=Identifier |
37 | "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" | 38 | "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" |
38 | ("<=>" bodies+=Conjunction (";" bodies+=Conjunction)*)? | 39 | ("<->" bodies+=Conjunction (";" bodies+=Conjunction)*)? |
39 | "."; | 40 | "."; |
40 | 41 | ||
41 | Parameter: | 42 | Parameter: |
@@ -65,6 +66,7 @@ ConstantArgument: | |||
65 | constant=Constant; | 66 | constant=Constant; |
66 | 67 | ||
67 | Assertion: | 68 | Assertion: |
69 | default?="default"? | ||
68 | (relation=[Relation|QualifiedName] | 70 | (relation=[Relation|QualifiedName] |
69 | "(" (arguments+=AssertionArgument ("," arguments+=AssertionArgument)*)? ")" | 71 | "(" (arguments+=AssertionArgument ("," arguments+=AssertionArgument)*)? ")" |
70 | ":" value=LogicValue | | 72 | ":" value=LogicValue | |
@@ -74,16 +76,19 @@ Assertion: | |||
74 | "."; | 76 | "."; |
75 | 77 | ||
76 | AssertionArgument: | 78 | AssertionArgument: |
77 | NodeAssertionArgument | ConstantAssertionArgument; | 79 | NodeAssertionArgument | WildcardAssertionArgument | ConstantAssertionArgument; |
78 | 80 | ||
79 | NodeAssertionArgument: | 81 | NodeAssertionArgument: |
80 | node=[Node|QualifiedName]; | 82 | node=[Node|QualifiedName]; |
81 | 83 | ||
84 | WildcardAssertionArgument: | ||
85 | {WildcardAssertionArgument} "*"; | ||
86 | |||
82 | ConstantAssertionArgument: | 87 | ConstantAssertionArgument: |
83 | constant=Constant; | 88 | constant=Constant; |
84 | 89 | ||
85 | enum LogicValue: | 90 | enum LogicValue: |
86 | TRUE="true" | FALSE="false" | UNKNOWN="unknown"; | 91 | TRUE="true" | FALSE="false" | UNKNOWN="unknown" | ERROR="error"; |
87 | 92 | ||
88 | enum ShortLogicValue returns LogicValue: | 93 | enum ShortLogicValue returns LogicValue: |
89 | FALSE="!" | UNKNOWN="?"; | 94 | FALSE="!" | UNKNOWN="?"; |
@@ -126,14 +131,18 @@ RangeMultiplicity: | |||
126 | ExactMultiplicity: | 131 | ExactMultiplicity: |
127 | exactValue=INT; | 132 | exactValue=INT; |
128 | 133 | ||
134 | UniqueDeclaration: | ||
135 | "unique" nodes+=EnumLiteral ("," nodes+=EnumLiteral)* "."; | ||
136 | |||
129 | UpperBound returns ecore::EInt: | 137 | UpperBound returns ecore::EInt: |
130 | INT | "*"; | 138 | INT | "*"; |
131 | 139 | ||
132 | QualifiedName hidden(): | 140 | QualifiedName hidden(): |
133 | QUOTED_ID | Identifier ("::" Identifier)*; | 141 | Identifier ("::" Identifier)*; |
134 | 142 | ||
135 | Identifier: | 143 | Identifier: |
136 | ID | "true" | "false"; | 144 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | "pred" | "scope" | |
145 | "unique" | "default" | "problem" | "contains" | "refers"; | ||
137 | 146 | ||
138 | Integer returns ecore::EInt hidden(): | 147 | Integer returns ecore::EInt hidden(): |
139 | "-"? INT; | 148 | "-"? INT; |
@@ -143,18 +152,11 @@ Real returns ecore::EDouble: | |||
143 | 152 | ||
144 | @Override | 153 | @Override |
145 | terminal ID: | 154 | terminal ID: |
146 | ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; | 155 | ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*; |
147 | 156 | ||
148 | terminal EXPONENTIAL: | 157 | terminal EXPONENTIAL: |
149 | INT ("e" | "E") ("+" | "-")? INT; | 158 | INT ("e" | "E") ("+" | "-")? INT; |
150 | 159 | ||
151 | @Override | 160 | @Override |
152 | terminal STRING: | ||
153 | '"' ('\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\' | '"'))* '"'; | ||
154 | |||
155 | terminal QUOTED_ID: | ||
156 | "'" ('\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\' | "'"))* "'"; | ||
157 | |||
158 | @Override | ||
159 | terminal SL_COMMENT: | 161 | terminal SL_COMMENT: |
160 | ('%' | '//') !('\n' | '\r')* ('\r'? '\n')?; | 162 | ('%' | '//') !('\n' | '\r')* ('\r'? '\n')?; |