Commit a3370dc0 authored by Arnaud Dieumegard's avatar Arnaud Dieumegard

Factorization of Link type grammar rule. Regenerated code.

parent fd7c2de5
......@@ -70,8 +70,8 @@ public class PatternParser extends AbstractContentAssistParser {
put(grammarAccess.getPatternPortAccess().getCardinalityElementAssignment_2_1_1(), "rule__PatternPort__CardinalityElementAssignment_2_1_1");
put(grammarAccess.getCardinalityElementAccess().getNameAssignment(), "rule__CardinalityElement__NameAssignment");
put(grammarAccess.getPatternLinkAccess().getSrcAssignment_0(), "rule__PatternLink__SrcAssignment_0");
put(grammarAccess.getPatternLinkAccess().getLinkTypeAssignment_1(), "rule__PatternLink__LinkTypeAssignment_1");
put(grammarAccess.getPatternLinkAccess().getDstAssignment_2(), "rule__PatternLink__DstAssignment_2");
put(grammarAccess.getPatternLinkAccess().getLinkTypeAssignment_2(), "rule__PatternLink__LinkTypeAssignment_2");
put(grammarAccess.getPatternLinkAccess().getDstAssignment_4(), "rule__PatternLink__DstAssignment_4");
}
};
}
......
......@@ -355,73 +355,73 @@ rule__LinkType__Alternatives
:
(
{ before(grammarAccess.getLinkTypeAccess().getTRANSPOSEEnumLiteralDeclaration_0()); }
('-{Transpose}->')
('Transpose')
{ after(grammarAccess.getLinkTypeAccess().getTRANSPOSEEnumLiteralDeclaration_0()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getIDENTITYEnumLiteralDeclaration_1()); }
('-{Identity}->')
('Identity')
{ after(grammarAccess.getLinkTypeAccess().getIDENTITYEnumLiteralDeclaration_1()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getFIRSTEnumLiteralDeclaration_2()); }
('-{First}->')
('First')
{ after(grammarAccess.getLinkTypeAccess().getFIRSTEnumLiteralDeclaration_2()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getROTATEEnumLiteralDeclaration_3()); }
('-{Rotate}->')
('Rotate')
{ after(grammarAccess.getLinkTypeAccess().getROTATEEnumLiteralDeclaration_3()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getSHIFTCEnumLiteralDeclaration_4()); }
('-{ShiftC}->')
('ShiftC')
{ after(grammarAccess.getLinkTypeAccess().getSHIFTCEnumLiteralDeclaration_4()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getSHIFTPEnumLiteralDeclaration_5()); }
('-{ShiftP}->')
('ShiftP')
{ after(grammarAccess.getLinkTypeAccess().getSHIFTPEnumLiteralDeclaration_5()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getFLATTENCEnumLiteralDeclaration_6()); }
('-{FlattenC}->')
('FlattenC')
{ after(grammarAccess.getLinkTypeAccess().getFLATTENCEnumLiteralDeclaration_6()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getFORKCEnumLiteralDeclaration_7()); }
('-{ForkC}->')
('ForkC')
{ after(grammarAccess.getLinkTypeAccess().getFORKCEnumLiteralDeclaration_7()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getFORKPEnumLiteralDeclaration_8()); }
('-{ForkP}->')
('ForkP')
{ after(grammarAccess.getLinkTypeAccess().getFORKPEnumLiteralDeclaration_8()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getJOINCEnumLiteralDeclaration_9()); }
('-{JoinC}->')
('JoinC')
{ after(grammarAccess.getLinkTypeAccess().getJOINCEnumLiteralDeclaration_9()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getJOINPEnumLiteralDeclaration_10()); }
('-{JoinP}->')
('JoinP')
{ after(grammarAccess.getLinkTypeAccess().getJOINPEnumLiteralDeclaration_10()); }
)
|
(
{ before(grammarAccess.getLinkTypeAccess().getLASTEnumLiteralDeclaration_11()); }
('-{Last}->')
('Last')
{ after(grammarAccess.getLinkTypeAccess().getLASTEnumLiteralDeclaration_11()); }
)
;
......@@ -1446,9 +1446,9 @@ rule__PatternLink__Group__1__Impl
}
:
(
{ before(grammarAccess.getPatternLinkAccess().getLinkTypeAssignment_1()); }
(rule__PatternLink__LinkTypeAssignment_1)
{ after(grammarAccess.getPatternLinkAccess().getLinkTypeAssignment_1()); }
{ before(grammarAccess.getPatternLinkAccess().getHyphenMinusHyphenMinusLeftCurlyBracketKeyword_1()); }
'--{'
{ after(grammarAccess.getPatternLinkAccess().getHyphenMinusHyphenMinusLeftCurlyBracketKeyword_1()); }
)
;
finally {
......@@ -1461,6 +1461,7 @@ rule__PatternLink__Group__2
}
:
rule__PatternLink__Group__2__Impl
rule__PatternLink__Group__3
;
finally {
restoreStackSize(stackSize);
......@@ -1472,9 +1473,62 @@ rule__PatternLink__Group__2__Impl
}
:
(
{ before(grammarAccess.getPatternLinkAccess().getDstAssignment_2()); }
(rule__PatternLink__DstAssignment_2)
{ after(grammarAccess.getPatternLinkAccess().getDstAssignment_2()); }
{ before(grammarAccess.getPatternLinkAccess().getLinkTypeAssignment_2()); }
(rule__PatternLink__LinkTypeAssignment_2)
{ after(grammarAccess.getPatternLinkAccess().getLinkTypeAssignment_2()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__PatternLink__Group__3
@init {
int stackSize = keepStackSize();
}
:
rule__PatternLink__Group__3__Impl
rule__PatternLink__Group__4
;
finally {
restoreStackSize(stackSize);
}
rule__PatternLink__Group__3__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getPatternLinkAccess().getRightCurlyBracketHyphenMinusGreaterThanSignKeyword_3()); }
'}->'
{ after(grammarAccess.getPatternLinkAccess().getRightCurlyBracketHyphenMinusGreaterThanSignKeyword_3()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__PatternLink__Group__4
@init {
int stackSize = keepStackSize();
}
:
rule__PatternLink__Group__4__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__PatternLink__Group__4__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getPatternLinkAccess().getDstAssignment_4()); }
(rule__PatternLink__DstAssignment_4)
{ after(grammarAccess.getPatternLinkAccess().getDstAssignment_4()); }
)
;
finally {
......@@ -1872,34 +1926,34 @@ finally {
restoreStackSize(stackSize);
}
rule__PatternLink__LinkTypeAssignment_1
rule__PatternLink__LinkTypeAssignment_2
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_1_0()); }
{ before(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_2_0()); }
ruleLinkType
{ after(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_1_0()); }
{ after(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_2_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__PatternLink__DstAssignment_2
rule__PatternLink__DstAssignment_4
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getPatternLinkAccess().getDstPatternPortCrossReference_2_0()); }
{ before(grammarAccess.getPatternLinkAccess().getDstPatternPortCrossReference_4_0()); }
(
{ before(grammarAccess.getPatternLinkAccess().getDstPatternPortQualifiedIDParserRuleCall_2_0_1()); }
{ before(grammarAccess.getPatternLinkAccess().getDstPatternPortQualifiedIDParserRuleCall_4_0_1()); }
ruleQualifiedID
{ after(grammarAccess.getPatternLinkAccess().getDstPatternPortQualifiedIDParserRuleCall_2_0_1()); }
{ after(grammarAccess.getPatternLinkAccess().getDstPatternPortQualifiedIDParserRuleCall_4_0_1()); }
)
{ after(grammarAccess.getPatternLinkAccess().getDstPatternPortCrossReference_2_0()); }
{ after(grammarAccess.getPatternLinkAccess().getDstPatternPortCrossReference_4_0()); }
)
;
finally {
......
'('=28
')'=29
','=30
'-{First}->'=17
'-{FlattenC}->'=21
'-{ForkC}->'=22
'-{ForkP}->'=23
'-{Identity}->'=16
'-{JoinC}->'=24
'-{JoinP}->'=25
'-{Last}->'=26
'-{Rotate}->'=18
'-{ShiftC}->'=19
'-{ShiftP}->'=20
'-{Transpose}->'=15
'.'=36
'--{'=36
'.'=38
'First'=17
'FlattenC'=21
'ForkC'=22
'ForkP'=23
'Identity'=16
'JoinC'=24
'JoinP'=25
'Last'=26
'Rotate'=18
'ShiftC'=19
'ShiftP'=20
'Transpose'=15
'['=34
']'=35
'component'=33
......@@ -24,6 +25,7 @@
'unspec'=11
'{'=31
'}'=32
'}->'=37
RULE_ANY_OTHER=10
RULE_ID=4
RULE_INT=5
......@@ -57,3 +59,5 @@ T__33=33
T__34=34
T__35=35
T__36=36
T__37=37
T__38=38
......@@ -564,12 +564,16 @@ rulePatternLink returns [EObject current=null]
}
)
)
otherlv_1='--{'
{
newLeafNode(otherlv_1, grammarAccess.getPatternLinkAccess().getHyphenMinusHyphenMinusLeftCurlyBracketKeyword_1());
}
(
(
{
newCompositeNode(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_1_0());
newCompositeNode(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_2_0());
}
lv_linkType_1_0=ruleLinkType
lv_linkType_2_0=ruleLinkType
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPatternLinkRule());
......@@ -577,12 +581,16 @@ rulePatternLink returns [EObject current=null]
set(
$current,
"linkType",
lv_linkType_1_0,
lv_linkType_2_0,
"com.irtsaintexupery.xtext.pseim.Pattern.LinkType");
afterParserOrEnumRuleCall();
}
)
)
otherlv_3='}->'
{
newLeafNode(otherlv_3, grammarAccess.getPatternLinkAccess().getRightCurlyBracketHyphenMinusGreaterThanSignKeyword_3());
}
(
(
{
......@@ -591,7 +599,7 @@ rulePatternLink returns [EObject current=null]
}
}
{
newCompositeNode(grammarAccess.getPatternLinkAccess().getDstPatternPortCrossReference_2_0());
newCompositeNode(grammarAccess.getPatternLinkAccess().getDstPatternPortCrossReference_4_0());
}
ruleQualifiedID
{
......@@ -695,7 +703,7 @@ ruleLinkType returns [Enumerator current=null]
}:
(
(
enumLiteral_0='-{Transpose}->'
enumLiteral_0='Transpose'
{
$current = grammarAccess.getLinkTypeAccess().getTRANSPOSEEnumLiteralDeclaration_0().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_0, grammarAccess.getLinkTypeAccess().getTRANSPOSEEnumLiteralDeclaration_0());
......@@ -703,7 +711,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_1='-{Identity}->'
enumLiteral_1='Identity'
{
$current = grammarAccess.getLinkTypeAccess().getIDENTITYEnumLiteralDeclaration_1().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_1, grammarAccess.getLinkTypeAccess().getIDENTITYEnumLiteralDeclaration_1());
......@@ -711,7 +719,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_2='-{First}->'
enumLiteral_2='First'
{
$current = grammarAccess.getLinkTypeAccess().getFIRSTEnumLiteralDeclaration_2().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_2, grammarAccess.getLinkTypeAccess().getFIRSTEnumLiteralDeclaration_2());
......@@ -719,7 +727,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_3='-{Rotate}->'
enumLiteral_3='Rotate'
{
$current = grammarAccess.getLinkTypeAccess().getROTATEEnumLiteralDeclaration_3().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_3, grammarAccess.getLinkTypeAccess().getROTATEEnumLiteralDeclaration_3());
......@@ -727,7 +735,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_4='-{ShiftC}->'
enumLiteral_4='ShiftC'
{
$current = grammarAccess.getLinkTypeAccess().getSHIFTCEnumLiteralDeclaration_4().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_4, grammarAccess.getLinkTypeAccess().getSHIFTCEnumLiteralDeclaration_4());
......@@ -735,7 +743,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_5='-{ShiftP}->'
enumLiteral_5='ShiftP'
{
$current = grammarAccess.getLinkTypeAccess().getSHIFTPEnumLiteralDeclaration_5().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_5, grammarAccess.getLinkTypeAccess().getSHIFTPEnumLiteralDeclaration_5());
......@@ -743,7 +751,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_6='-{FlattenC}->'
enumLiteral_6='FlattenC'
{
$current = grammarAccess.getLinkTypeAccess().getFLATTENCEnumLiteralDeclaration_6().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_6, grammarAccess.getLinkTypeAccess().getFLATTENCEnumLiteralDeclaration_6());
......@@ -751,7 +759,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_7='-{ForkC}->'
enumLiteral_7='ForkC'
{
$current = grammarAccess.getLinkTypeAccess().getFORKCEnumLiteralDeclaration_7().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_7, grammarAccess.getLinkTypeAccess().getFORKCEnumLiteralDeclaration_7());
......@@ -759,7 +767,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_8='-{ForkP}->'
enumLiteral_8='ForkP'
{
$current = grammarAccess.getLinkTypeAccess().getFORKPEnumLiteralDeclaration_8().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_8, grammarAccess.getLinkTypeAccess().getFORKPEnumLiteralDeclaration_8());
......@@ -767,7 +775,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_9='-{JoinC}->'
enumLiteral_9='JoinC'
{
$current = grammarAccess.getLinkTypeAccess().getJOINCEnumLiteralDeclaration_9().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_9, grammarAccess.getLinkTypeAccess().getJOINCEnumLiteralDeclaration_9());
......@@ -775,7 +783,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_10='-{JoinP}->'
enumLiteral_10='JoinP'
{
$current = grammarAccess.getLinkTypeAccess().getJOINPEnumLiteralDeclaration_10().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_10, grammarAccess.getLinkTypeAccess().getJOINPEnumLiteralDeclaration_10());
......@@ -783,7 +791,7 @@ ruleLinkType returns [Enumerator current=null]
)
|
(
enumLiteral_11='-{Last}->'
enumLiteral_11='Last'
{
$current = grammarAccess.getLinkTypeAccess().getLASTEnumLiteralDeclaration_11().getEnumLiteral().getInstance();
newLeafNode(enumLiteral_11, grammarAccess.getLinkTypeAccess().getLASTEnumLiteralDeclaration_11());
......
'('=12
')'=14
','=13
'-{First}->'=27
'-{FlattenC}->'=31
'-{ForkC}->'=32
'-{ForkP}->'=33
'-{Identity}->'=26
'-{JoinC}->'=34
'-{JoinP}->'=35
'-{Last}->'=36
'-{Rotate}->'=28
'-{ShiftC}->'=29
'-{ShiftP}->'=30
'-{Transpose}->'=25
'.'=20
'--{'=20
'.'=22
'First'=29
'FlattenC'=33
'ForkC'=34
'ForkP'=35
'Identity'=28
'JoinC'=36
'JoinP'=37
'Last'=38
'Rotate'=30
'ShiftC'=31
'ShiftP'=32
'Transpose'=27
'['=18
']'=19
'component'=17
'in'=22
'inout'=24
'out'=23
'in'=24
'inout'=26
'out'=25
'pattern'=11
'unspec'=21
'unspec'=23
'{'=15
'}'=16
'}->'=21
RULE_ANY_OTHER=10
RULE_ID=4
RULE_INT=5
......@@ -57,3 +59,5 @@ T__33=33
T__34=34
T__35=35
T__36=36
T__37=37
T__38=38
......@@ -111,8 +111,8 @@ public class PatternSemanticSequencer extends AbstractDelegatingSemanticSequence
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getPatternLinkAccess().getSrcPatternPortQualifiedIDParserRuleCall_0_0_1(), semanticObject.eGet(SeimPackage.Literals.LINK__SRC, false));
feeder.accept(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_1_0(), semanticObject.getLinkType());
feeder.accept(grammarAccess.getPatternLinkAccess().getDstPatternPortQualifiedIDParserRuleCall_2_0_1(), semanticObject.eGet(SeimPackage.Literals.LINK__DST, false));
feeder.accept(grammarAccess.getPatternLinkAccess().getLinkTypeLinkTypeEnumRuleCall_2_0(), semanticObject.getLinkType());
feeder.accept(grammarAccess.getPatternLinkAccess().getDstPatternPortQualifiedIDParserRuleCall_4_0_1(), semanticObject.eGet(SeimPackage.Literals.LINK__DST, false));
feeder.finish();
}
......
......@@ -34,13 +34,13 @@ CardinalityElement returns CardinalityElement:
;
PatternLink returns PatternLink:
src=[PatternPort|QualifiedID] linkType=LinkType dst=[PatternPort|QualifiedID]
src=[PatternPort|QualifiedID] '--{' linkType=LinkType '}->' dst=[PatternPort|QualifiedID]
;
enum LinkType returns LinkType:
TRANSPOSE = '-{Transpose}->' | IDENTITY = '-{Identity}->' | FIRST = '-{First}->' | ROTATE = '-{Rotate}->'
| SHIFTC = '-{ShiftC}->' | SHIFTP = '-{ShiftP}->' | FLATTENC = '-{FlattenC}->' | FORKC = '-{ForkC}->' | FORKP = '-{ForkP}->'
| JOINC = '-{JoinC}->' | JOINP = '-{JoinP}->' | LAST = '-{Last}->'
TRANSPOSE = 'Transpose' | IDENTITY = 'Identity' | FIRST = 'First' | ROTATE = 'Rotate'
| SHIFTC = 'ShiftC' | SHIFTP = 'ShiftP' | FLATTENC = 'FlattenC' | FORKC = 'ForkC' | FORKP = 'ForkP'
| JOINC = 'JoinC' | JOINP = 'JoinP' | LAST = 'Last'
;
enum PortDirection returns seim::PortDirection:
......
......@@ -3,6 +3,8 @@
*/
package com.irtsaintexupery.xtext.pseim.validation
import com.irtsaintexupery.pseim.pseim.Pattern
import org.eclipse.xtext.validation.Check
/**
* This class contains custom validation rules.
......@@ -22,4 +24,17 @@ class PatternValidator extends AbstractPatternValidator {
// }
// }
@Check
def checkPattern(Pattern p) {
// Static checking
// Check if there exists a solution for the set of constraints induced by the pattern model (all links + constraints)
// Warning: Two variables are necessarily identical -> Potential error as there is redundancy in the variables
// -> Maybe it is not an error as in creates different interfaces for the pattern
// Global arithmetic constraints may be added to the pattern language (no need for now)
// TODO Dynamic synthesis (in the Mapping MM validator)
// A synthesis tool synthesizes a solution for the mapping
// If there is no solution, then the mapping is not correct
// In both cases, we need a bridge between our model and a solver
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment