diff options
author | 2020-05-08 21:02:33 +0200 | |
---|---|---|
committer | 2020-05-08 21:02:33 +0200 | |
commit | 771e3773bb7ebbf6712724cb2b248467c9cc2e3c (patch) | |
tree | b1724af24b9c583b2780c7a2fe76e76fd174359d /Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext | |
parent | Update solver language grammar (diff) | |
download | VIATRA-Generator-771e3773bb7ebbf6712724cb2b248467c9cc2e3c.tar.gz VIATRA-Generator-771e3773bb7ebbf6712724cb2b248467c9cc2e3c.tar.zst VIATRA-Generator-771e3773bb7ebbf6712724cb2b248467c9cc2e3c.zip |
Synthetic tokens for solver language
Diffstat (limited to 'Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext')
-rw-r--r-- | Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext b/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext index 5abeb891..1306b626 100644 --- a/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext +++ b/Application/org.eclipse.viatra.solver.language/src/org/eclipse/viatra/solver/language/SolverLanguage.xtext | |||
@@ -9,7 +9,7 @@ Statement: | |||
9 | ( | 9 | ( |
10 | AssertionOrDefinition | PredicateDefinition | UnnamedErrorPrediateDefinition | DefaultDefinition | ExternPredicateDefinition | | 10 | AssertionOrDefinition | PredicateDefinition | UnnamedErrorPrediateDefinition | DefaultDefinition | ExternPredicateDefinition | |
11 | MetricDefinition | ExternMetricDefinition | ClassDefinition | ScopeDefinition | ObjectiveDefinition | 11 | MetricDefinition | ExternMetricDefinition | ClassDefinition | ScopeDefinition | ObjectiveDefinition |
12 | ) DOT; | 12 | ) FULL_STOP; |
13 | 13 | ||
14 | AssertionOrDefinition returns Statement: | 14 | AssertionOrDefinition returns Statement: |
15 | Expression ( | 15 | Expression ( |
@@ -28,7 +28,7 @@ DefaultDefinition: | |||
28 | "default" head=Call ":" range=Expression; | 28 | "default" head=Call ":" range=Expression; |
29 | 29 | ||
30 | ExternPredicateDefinition: | 30 | ExternPredicateDefinition: |
31 | "extern" head=Call "."; | 31 | "extern" head=Call; |
32 | 32 | ||
33 | enum MetricType: | 33 | enum MetricType: |
34 | INT="int" | REAL="real"; | 34 | INT="int" | REAL="real"; |
@@ -103,10 +103,10 @@ Aggregation: | |||
103 | op=AggregationOp "{" body=Expression "|" condition=Expression "}"; | 103 | op=AggregationOp "{" body=Expression "|" condition=Expression "}"; |
104 | 104 | ||
105 | AtomicExpression returns Expression: | 105 | AtomicExpression returns Expression: |
106 | Reference ({Call.functor=current} -> argumentList=ArgumentList)? | Interval | Literal | "(" Expression ")"; | 106 | Reference | Call | Interval | Literal | "(" Expression ")"; |
107 | 107 | ||
108 | Call: | 108 | Call: |
109 | functor=Reference (transitiveClosure?=STAR | reflexiveTransitiveClosure?=PLUS)? argumentList=ArgumentList; | 109 | functor=Reference (transitiveClosure?=TRANSITIVE_CLOSURE | reflexiveTransitiveClosure?=REFLEXIVE_TRANSITIVE_CLOSURE)? argumentList=ArgumentList; |
110 | 110 | ||
111 | ArgumentList: | 111 | ArgumentList: |
112 | {ArgumentList} "(" (arguments+=Argument ("," arguments+=Argument)*)? ")"; | 112 | {ArgumentList} "(" (arguments+=Argument ("," arguments+=Argument)*)? ")"; |
@@ -153,7 +153,7 @@ EmptyIntervalLiteral: | |||
153 | StringLiteral: | 153 | StringLiteral: |
154 | value=STRING; | 154 | value=STRING; |
155 | 155 | ||
156 | ClassDefinition returns Statement: | 156 | ClassDefinition: |
157 | abstract?="abstract"? "class" name=ID ("extends" superclasses+=[NamedElement|QualifiedName] ("," superclasses+=[NamedElement|QualifiedName])*)? | 157 | abstract?="abstract"? "class" name=ID ("extends" superclasses+=[NamedElement|QualifiedName] ("," superclasses+=[NamedElement|QualifiedName])*)? |
158 | "{" members+=MemberDefinition* "}"; | 158 | "{" members+=MemberDefinition* "}"; |
159 | 159 | ||
@@ -182,13 +182,13 @@ BoundedScopeDefinition: | |||
182 | "scope" ( | 182 | "scope" ( |
183 | (lowerBound=INT "<=")? type=[NamedElement|QualifiedName] "<=" upperBound=INT | | 183 | (lowerBound=INT "<=")? type=[NamedElement|QualifiedName] "<=" upperBound=INT | |
184 | upperBound=INT ">=" type=[NamedElement|QualifiedName] (">=" lowerBound=INT)? | 184 | upperBound=INT ">=" type=[NamedElement|QualifiedName] (">=" lowerBound=INT)? |
185 | ) "."; | 185 | ); |
186 | 186 | ||
187 | LowerBoundedScopeDefinition: | 187 | LowerBoundedScopeDefinition: |
188 | "scope" ( | 188 | "scope" ( |
189 | lowerBound=INT "<=" type=[NamedElement|QualifiedName] | | 189 | lowerBound=INT "<=" type=[NamedElement|QualifiedName] | |
190 | type=[NamedElement|QualifiedName] ">=" lowerBound=INT | 190 | type=[NamedElement|QualifiedName] ">=" lowerBound=INT |
191 | ) "."; | 191 | ); |
192 | 192 | ||
193 | enum ObjectiveKind: | 193 | enum ObjectiveKind: |
194 | MINIMIZE="minimize" | MAXIMIZE="maximize"; | 194 | MINIMIZE="minimize" | MAXIMIZE="maximize"; |
@@ -209,17 +209,21 @@ QualifiedName hidden(): | |||
209 | terminal STRING returns ecore::EString: | 209 | terminal STRING returns ecore::EString: |
210 | '"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'"') )* '"'; | 210 | '"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'"') )* '"'; |
211 | 211 | ||
212 | terminal QUOTED_ID returns ecore::EString: | 212 | terminal QUOTED_ID: |
213 | '\'' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'\'') )* '\''; | 213 | '\'' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'\'') )* '\''; |
214 | 214 | ||
215 | terminal PLUS: | 215 | @Override |
216 | "synthetic::plus"; | 216 | terminal SL_COMMENT: |
217 | ('%' | '//') !('\n'|'\r')* ('\r'? '\n')?; | ||
218 | |||
219 | terminal TRANSITIVE_CLOSURE: | ||
220 | "synthetic:TRANSITIVE_CLOSURE"; | ||
217 | 221 | ||
218 | terminal STAR: | 222 | terminal REFLEXIVE_TRANSITIVE_CLOSURE: |
219 | "synthetic::star"; | 223 | "synthetic:REFLEXIVE_TRANSITIVE_CLOSURE"; |
220 | 224 | ||
221 | terminal DOT: | 225 | terminal FULL_STOP: |
222 | "synthetic::dot"; | 226 | "synthetic:FULL_STOP"; |
223 | 227 | ||
224 | NamedElement: | 228 | NamedElement: |
225 | name=QualifiedName; | 229 | name=QualifiedName; |