Skip to content
Snippets Groups Projects
Commit 73be2f2d authored by Andrea Enrici's avatar Andrea Enrici
Browse files

corrected a bug in parsing the fork-join

parent c67be792
No related branches found
No related tags found
No related merge requests found
...@@ -524,8 +524,6 @@ void parseReferenceToDiagram( TMLCP mainCP ): ...@@ -524,8 +524,6 @@ void parseReferenceToDiagram( TMLCP mainCP ):
} }
} }
//Modify the data structure of the activity diagram as TMLCPElement is an abstract class, so it is not possible to instantiate an
//ArrayList<TMLCPElement> to be returned after parsing the fork-join
void parseForkJoin( TMLCP mainCP ): void parseForkJoin( TMLCP mainCP ):
{ {
String name; String name;
...@@ -541,6 +539,7 @@ void parseForkJoin( TMLCP mainCP ): ...@@ -541,6 +539,7 @@ void parseForkJoin( TMLCP mainCP ):
fork1.addNextElement( currentElement ); //the next element of Fork is only the first element of the sequence fork1.addNextElement( currentElement ); //the next element of Fork is only the first element of the sequence
globalAD.addElement( currentElement ); globalAD.addElement( currentElement );
previousElement = currentElement; previousElement = currentElement;
TraceManager.addDev( "Je me plante apres" );
} }
// from now on is like parsing a normal sequence, in the sense that I ignore the fact of being inside a fork-join // from now on is like parsing a normal sequence, in the sense that I ignore the fact of being inside a fork-join
( (
...@@ -555,15 +554,27 @@ void parseForkJoin( TMLCP mainCP ): ...@@ -555,15 +554,27 @@ void parseForkJoin( TMLCP mainCP ):
)* )*
"}" // end of the first branch "}" // end of the first branch
{ previousElement.addNextElement( join1 ); } { previousElement.addNextElement( join1 ); }
// then one or more branches
( "*" "{" parseReferenceToDiagram( mainCP ) ( "*" "{" parseReferenceToDiagram( mainCP )
{ {
fork1.addNextElement( currentElement ); fork1.addNextElement( currentElement );
globalAD.addElement( currentElement ); globalAD.addElement( currentElement );
previousElement = currentElement; previousElement = currentElement;
} }
"}" // from now on is like parsing a normal sequence, in the sense that I ignore the fact of being inside a fork-join
(
<SEQUENCING_OP> parseReferenceToDiagram( mainCP )
{
if( currentElement != null ) {
previousElement.addNextElement( currentElement );
globalAD.addElement( currentElement );
previousElement = currentElement;
}
}
)*
"}" // end of a branch
{ previousElement.addNextElement( join1 ); } { previousElement.addNextElement( join1 ); }
)+ "};" )+ "};" // end of a whole fork-join
{ {
globalAD.addElement( fork1 ); globalAD.addElement( fork1 );
globalAD.addElement( join1 ); globalAD.addElement( join1 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment