コード例 #1
0
def logic_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    return events
コード例 #2
0
def recAtBuyer_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Invoice', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Invoice', 'Seller'))
    return events
コード例 #3
0
ファイル: test_fsm_processing.py プロジェクト: pkediyal/pyon
def main_auction_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Invoice',
                                           'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'OK', 'Buyer'))
    return events
コード例 #4
0
ファイル: test_fsm_processing.py プロジェクト: pkediyal/pyon
def parallelAtSeller1_events():
    events = []
    events.append(TransitionFactory.create(LocalType.RESV, 'Order', 'Buyer'))
    events.append(
        TransitionFactory.create(LocalType.SEND, 'Confirmation', 'Buyer'))
    events.append(TransitionFactory.create(LocalType.SEND, 'OK', 'Buyer'))
    return events
コード例 #5
0
ファイル: test_fsm_processing.py プロジェクト: pkediyal/pyon
def logic_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    return events
コード例 #6
0
def Interrupt_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Help', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'MoreHelp', 'Seller'))
    return events
コード例 #7
0
def locateChoiceAtBuyer_events():
    events = []
    events.append(TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'OK', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'OutOfStock', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'OutOfStock', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'OutOfStock', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Finish', 'Seller'))
    return events
コード例 #8
0
ファイル: test_fsm_processing.py プロジェクト: pkediyal/pyon
def Interrupt_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Help', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.SEND, 'MoreHelp', 'Seller'))
    return events
コード例 #9
0
ファイル: test_fsm_processing.py プロジェクト: pkediyal/pyon
def locateChoiceAtBuyer_events():
    events = []
    events.append(
        TransitionFactory.create(LocalType.RESV, 'Confirmation', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'OK', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'OutOfStock', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'OutOfStock', 'Seller'))
    events.append(
        TransitionFactory.create(LocalType.RESV, 'OutOfStock', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Finish', 'Seller'))
    return events
コード例 #10
0
ファイル: BuildFSM.py プロジェクト: pkediyal/pyon
    def activityDef(self, ):

        rlabel = None
        val = None
        vtype = None
        role = None
        assertion = None
        slabel = None
        label = None
        labelID = None

        try:
            try:
                # src/SavedFSM/BuildFSM.g:109:12: ( ^( RESV (rlabel= ID )? ( ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* ) ) role= ID ( ^( ASSERT (assertion= ASSERTION )? ) ) ) | ^( SEND (slabel= ID )? ( ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* ) ) role= ID ( ^( ASSERT (assertion= ASSERTION )? ) ) ) | ^( 'choice' ( ^( BRANCH ( activityDef )+ ) )+ ) | ^( PARALLEL ( ^( BRANCH ( activityDef )+ ) )+ ) | ^( 'repeat' ( ^( BRANCH ( activityDef )+ ) ) ) | ^( 'rec' label= ID ( ^( BRANCH ( activityDef )+ ) ) ) | ^( 'RECLABEL' labelID= ID ) | ^( GLOBAL_ESCAPE ( ^( 'do' ( ( activityDef )+ ) ) ) ( ^( 'interrupt' roleName ( ( activityDef )+ ) ) ) ) )
                alt19 = 8
                LA19 = self.input.LA(1)
                if LA19 == RESV:
                    alt19 = 1
                elif LA19 == SEND:
                    alt19 = 2
                elif LA19 == 49:
                    alt19 = 3
                elif LA19 == PARALLEL:
                    alt19 = 4
                elif LA19 == 51:
                    alt19 = 5
                elif LA19 == 52:
                    alt19 = 6
                elif LA19 == RECLABEL:
                    alt19 = 7
                elif LA19 == GLOBAL_ESCAPE:
                    alt19 = 8
                else:
                    nvae = NoViableAltException("", 19, 0, self.input)

                    raise nvae

                if alt19 == 1:
                    # src/SavedFSM/BuildFSM.g:110:2: ^( RESV (rlabel= ID )? ( ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* ) ) role= ID ( ^( ASSERT (assertion= ASSERTION )? ) ) )
                    pass 
                    self.match(self.input, RESV, self.FOLLOW_RESV_in_activityDef85)

                    #action start
                             
                    local_context = []
                    label = ''
                    #action end

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:113:5: (rlabel= ID )?
                    alt3 = 2
                    LA3_0 = self.input.LA(1)

                    if (LA3_0 == ID) :
                        alt3 = 1
                    if alt3 == 1:
                        # src/SavedFSM/BuildFSM.g:113:6: rlabel= ID
                        pass 
                        rlabel=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef98)
                        #action start
                                          
                        if (rlabel is not None): label = rlabel.text
                        self.memory.append('before setting the label:' +  label)
                        #action end



                    # src/SavedFSM/BuildFSM.g:116:5: ( ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* ) )
                    # src/SavedFSM/BuildFSM.g:116:6: ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* )
                    pass 
                    self.match(self.input, VALUE, self.FOLLOW_VALUE_in_activityDef110)

                    if self.input.LA(1) == DOWN:
                        self.match(self.input, DOWN, None)
                        # src/SavedFSM/BuildFSM.g:116:14: ( (val= ID (vtype= ( INT | STRING ) )? ) )*
                        while True: #loop5
                            alt5 = 2
                            LA5_0 = self.input.LA(1)

                            if (LA5_0 == ID) :
                                alt5 = 1


                            if alt5 == 1:
                                # src/SavedFSM/BuildFSM.g:116:15: (val= ID (vtype= ( INT | STRING ) )? )
                                pass 
                                # src/SavedFSM/BuildFSM.g:116:15: (val= ID (vtype= ( INT | STRING ) )? )
                                # src/SavedFSM/BuildFSM.g:116:16: val= ID (vtype= ( INT | STRING ) )?
                                pass 
                                val=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef116)
                                # src/SavedFSM/BuildFSM.g:116:28: (vtype= ( INT | STRING ) )?
                                alt4 = 2
                                LA4_0 = self.input.LA(1)

                                if ((INT <= LA4_0 <= STRING)) :
                                    alt4 = 1
                                if alt4 == 1:
                                    # src/SavedFSM/BuildFSM.g:116:28: vtype= ( INT | STRING )
                                    pass 
                                    vtype = self.input.LT(1)
                                    if (INT <= self.input.LA(1) <= STRING):
                                        self.input.consume()
                                        self._state.errorRecovery = False

                                    else:
                                        mse = MismatchedSetException(None, self.input)
                                        raise mse








                                #action start
                                if ((val is not None) and (vtype is not None)): local_context.append((val.text, vtype.text))
                                #action end


                            else:
                                break #loop5

                        self.match(self.input, UP, None)




                    role=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef141)
                    #action start
                    if not(role.text in self.roles): self.roles.append(role.text)
                    #action end
                    # src/SavedFSM/BuildFSM.g:118:5: ( ^( ASSERT (assertion= ASSERTION )? ) )
                    # src/SavedFSM/BuildFSM.g:118:6: ^( ASSERT (assertion= ASSERTION )? )
                    pass 
                    self.match(self.input, ASSERT, self.FOLLOW_ASSERT_in_activityDef151)

                    if self.input.LA(1) == DOWN:
                        self.match(self.input, DOWN, None)
                        # src/SavedFSM/BuildFSM.g:118:15: (assertion= ASSERTION )?
                        alt6 = 2
                        LA6_0 = self.input.LA(1)

                        if (LA6_0 == ASSERTION) :
                            alt6 = 1
                        if alt6 == 1:
                            # src/SavedFSM/BuildFSM.g:118:16: assertion= ASSERTION
                            pass 
                            assertion=self.match(self.input, ASSERTION, self.FOLLOW_ASSERTION_in_activityDef156)




                        self.match(self.input, UP, None)





                    self.match(self.input, UP, None)
                    #action start
                      
                    self.memory.append('label is:' +  label);
                    self.current_fsm.add_transition(TransitionFactory.create(LocalType.RESV, label, role), assertion, local_context)
                    	
                    #action end


                elif alt19 == 2:
                    # src/SavedFSM/BuildFSM.g:123:3: ^( SEND (slabel= ID )? ( ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* ) ) role= ID ( ^( ASSERT (assertion= ASSERTION )? ) ) )
                    pass 
                    self.match(self.input, SEND, self.FOLLOW_SEND_in_activityDef169)

                    #action start
                              
                    local_context = []
                    label = ''
                    #action end

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:126:5: (slabel= ID )?
                    alt7 = 2
                    LA7_0 = self.input.LA(1)

                    if (LA7_0 == ID) :
                        alt7 = 1
                    if alt7 == 1:
                        # src/SavedFSM/BuildFSM.g:126:6: slabel= ID
                        pass 
                        slabel=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef182)
                        #action start
                                          
                        self.memory.append('send' + slabel.text)
                        if (slabel is not None): label = slabel.text
                        #action end



                    # src/SavedFSM/BuildFSM.g:129:12: ( ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* ) )
                    # src/SavedFSM/BuildFSM.g:129:13: ^( VALUE ( (val= ID (vtype= ( INT | STRING ) )? ) )* )
                    pass 
                    self.match(self.input, VALUE, self.FOLLOW_VALUE_in_activityDef201)

                    if self.input.LA(1) == DOWN:
                        self.match(self.input, DOWN, None)
                        # src/SavedFSM/BuildFSM.g:129:21: ( (val= ID (vtype= ( INT | STRING ) )? ) )*
                        while True: #loop9
                            alt9 = 2
                            LA9_0 = self.input.LA(1)

                            if (LA9_0 == ID) :
                                alt9 = 1


                            if alt9 == 1:
                                # src/SavedFSM/BuildFSM.g:129:22: (val= ID (vtype= ( INT | STRING ) )? )
                                pass 
                                # src/SavedFSM/BuildFSM.g:129:22: (val= ID (vtype= ( INT | STRING ) )? )
                                # src/SavedFSM/BuildFSM.g:129:23: val= ID (vtype= ( INT | STRING ) )?
                                pass 
                                val=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef207)
                                # src/SavedFSM/BuildFSM.g:129:35: (vtype= ( INT | STRING ) )?
                                alt8 = 2
                                LA8_0 = self.input.LA(1)

                                if ((INT <= LA8_0 <= STRING)) :
                                    alt8 = 1
                                if alt8 == 1:
                                    # src/SavedFSM/BuildFSM.g:129:35: vtype= ( INT | STRING )
                                    pass 
                                    vtype = self.input.LT(1)
                                    if (INT <= self.input.LA(1) <= STRING):
                                        self.input.consume()
                                        self._state.errorRecovery = False

                                    else:
                                        mse = MismatchedSetException(None, self.input)
                                        raise mse








                                #action start
                                if ((val is not None) and (vtype is not None)): local_context.append((val.text, vtype.text))
                                #action end


                            else:
                                break #loop9

                        self.match(self.input, UP, None)




                    role=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef236)
                    #action start
                    if not(role.text in self.roles): self.roles.append(role.text)
                    #action end
                    # src/SavedFSM/BuildFSM.g:131:5: ( ^( ASSERT (assertion= ASSERTION )? ) )
                    # src/SavedFSM/BuildFSM.g:131:6: ^( ASSERT (assertion= ASSERTION )? )
                    pass 
                    self.match(self.input, ASSERT, self.FOLLOW_ASSERT_in_activityDef246)

                    if self.input.LA(1) == DOWN:
                        self.match(self.input, DOWN, None)
                        # src/SavedFSM/BuildFSM.g:131:15: (assertion= ASSERTION )?
                        alt10 = 2
                        LA10_0 = self.input.LA(1)

                        if (LA10_0 == ASSERTION) :
                            alt10 = 1
                        if alt10 == 1:
                            # src/SavedFSM/BuildFSM.g:131:16: assertion= ASSERTION
                            pass 
                            assertion=self.match(self.input, ASSERTION, self.FOLLOW_ASSERTION_in_activityDef251)




                        self.match(self.input, UP, None)





                    self.match(self.input, UP, None)
                    #action start
                    self.memory.append('In SEND assertion')
                    #action end
                    #action start
                      
                    self.current_fsm.add_transition(TransitionFactory.create(LocalType.SEND, label, role), assertion, local_context)
                    	
                    #action end


                elif alt19 == 3:
                    # src/SavedFSM/BuildFSM.g:136:3: ^( 'choice' ( ^( BRANCH ( activityDef )+ ) )+ )
                    pass 
                    self.match(self.input, 49, self.FOLLOW_49_in_activityDef270)

                    #action start
                    self.memory.append('enter choice state')
                    self.current_fsm.choice_start_state.append(self.current_fsm.get_current_state())
                    self.current_fsm.choice_end_state.append(self.current_fsm.state_gen.next())
                    	
                    #action end

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:141:2: ( ^( BRANCH ( activityDef )+ ) )+
                    cnt12 = 0
                    while True: #loop12
                        alt12 = 2
                        LA12_0 = self.input.LA(1)

                        if (LA12_0 == BRANCH) :
                            alt12 = 1


                        if alt12 == 1:
                            # src/SavedFSM/BuildFSM.g:141:3: ^( BRANCH ( activityDef )+ )
                            pass 
                            self.match(self.input, BRANCH, self.FOLLOW_BRANCH_in_activityDef280)

                            #action start
                              
                            self.memory.append('enter choice branch and save the current state')

                            self.current_fsm.move_current_state(self.current_fsm.choice_start_state[-1])
                            	
                            #action end

                            self.match(self.input, DOWN, None)
                            # src/SavedFSM/BuildFSM.g:146:4: ( activityDef )+
                            cnt11 = 0
                            while True: #loop11
                                alt11 = 2
                                LA11_0 = self.input.LA(1)

                                if ((RESV <= LA11_0 <= SEND) or (RECLABEL <= LA11_0 <= PARALLEL) or LA11_0 == GLOBAL_ESCAPE or LA11_0 == 49 or (51 <= LA11_0 <= 52)) :
                                    alt11 = 1


                                if alt11 == 1:
                                    # src/SavedFSM/BuildFSM.g:146:4: activityDef
                                    pass 
                                    self._state.following.append(self.FOLLOW_activityDef_in_activityDef286)
                                    self.activityDef()

                                    self._state.following.pop()


                                else:
                                    if cnt11 >= 1:
                                        break #loop11

                                    eee = EarlyExitException(11, self.input)
                                    raise eee

                                cnt11 += 1

                            self.match(self.input, UP, None)
                            #action start
                              
                            self.memory.append('exit choice branch and set the current state to the end state for the choice')
                            self.current_fsm.fsm.add_transition(self.current_fsm.fsm.EMPTY_TRANSITION, self.current_fsm.get_current_state(), self.current_fsm.choice_end_state[-1])
                            	
                            #action end


                        else:
                            if cnt12 >= 1:
                                break #loop12

                            eee = EarlyExitException(12, self.input)
                            raise eee

                        cnt12 += 1

                    self.match(self.input, UP, None)
                    #action start
                      
                    self.memory.append('set the current state to be equal to the end state for the choice')
                    self.current_fsm.move_current_state(self.current_fsm.choice_end_state[-1])
                    self.current_fsm.choice_end_state.pop()
                    self.current_fsm.choice_start_state.pop()
                    	
                    #action end


                elif alt19 == 4:
                    # src/SavedFSM/BuildFSM.g:158:4: ^( PARALLEL ( ^( BRANCH ( activityDef )+ ) )+ )
                    pass 
                    self.match(self.input, PARALLEL, self.FOLLOW_PARALLEL_in_activityDef305)

                    #action start
                             
                    self.memory.append('enter parallel state')
                    self.parallel_root = self.current_fsm
                            
                    #action end

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:163:2: ( ^( BRANCH ( activityDef )+ ) )+
                    cnt14 = 0
                    while True: #loop14
                        alt14 = 2
                        LA14_0 = self.input.LA(1)

                        if (LA14_0 == BRANCH) :
                            alt14 = 1


                        if alt14 == 1:
                            # src/SavedFSM/BuildFSM.g:163:3: ^( BRANCH ( activityDef )+ )
                            pass 
                            self.match(self.input, BRANCH, self.FOLLOW_BRANCH_in_activityDef322)

                            #action start
                              
                            self.memory.append('enter parallel branch')
                            nested_fsm = FSMBuilderState(self.parallel_root)
                            self.parallel_root.fsm.add_fsm_to_memory(self.parallel_root.get_current_state(), nested_fsm.fsm)
                            self.current_fsm = nested_fsm	
                            	
                            #action end

                            self.match(self.input, DOWN, None)
                            # src/SavedFSM/BuildFSM.g:170:2: ( activityDef )+
                            cnt13 = 0
                            while True: #loop13
                                alt13 = 2
                                LA13_0 = self.input.LA(1)

                                if ((RESV <= LA13_0 <= SEND) or (RECLABEL <= LA13_0 <= PARALLEL) or LA13_0 == GLOBAL_ESCAPE or LA13_0 == 49 or (51 <= LA13_0 <= 52)) :
                                    alt13 = 1


                                if alt13 == 1:
                                    # src/SavedFSM/BuildFSM.g:170:3: activityDef
                                    pass 
                                    self._state.following.append(self.FOLLOW_activityDef_in_activityDef331)
                                    self.activityDef()

                                    self._state.following.pop()


                                else:
                                    if cnt13 >= 1:
                                        break #loop13

                                    eee = EarlyExitException(13, self.input)
                                    raise eee

                                cnt13 += 1

                            self.match(self.input, UP, None)
                            #action start
                              
                            self.memory.append('exit parallel branch')
                            self.current_fsm.add_transition(self.current_fsm.fsm.END_PAR_TRANSITION)
                            	
                            #action end


                        else:
                            if cnt14 >= 1:
                                break #loop14

                            eee = EarlyExitException(14, self.input)
                            raise eee

                        cnt14 += 1

                    self.match(self.input, UP, None)
                    #action start
                    self.memory.append('exit parallel state')
                    self.current_fsm = self.current_fsm.parent
                    self.current_fsm.fsm.add_transition(self.current_fsm.fsm.EMPTY_TRANSITION, self.current_fsm.get_current_state(), self.current_fsm.move_current_state())
                    	
                    #action end


                elif alt19 == 5:
                    # src/SavedFSM/BuildFSM.g:180:3: ^( 'repeat' ( ^( BRANCH ( activityDef )+ ) ) )
                    pass 
                    self.match(self.input, 51, self.FOLLOW_51_in_activityDef352)

                    #action start
                    self.memory.append('enter repeat state')
                    #action end

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:182:2: ( ^( BRANCH ( activityDef )+ ) )
                    # src/SavedFSM/BuildFSM.g:182:3: ^( BRANCH ( activityDef )+ )
                    pass 
                    self.match(self.input, BRANCH, self.FOLLOW_BRANCH_in_activityDef361)

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:182:12: ( activityDef )+
                    cnt15 = 0
                    while True: #loop15
                        alt15 = 2
                        LA15_0 = self.input.LA(1)

                        if ((RESV <= LA15_0 <= SEND) or (RECLABEL <= LA15_0 <= PARALLEL) or LA15_0 == GLOBAL_ESCAPE or LA15_0 == 49 or (51 <= LA15_0 <= 52)) :
                            alt15 = 1


                        if alt15 == 1:
                            # src/SavedFSM/BuildFSM.g:182:13: activityDef
                            pass 
                            self._state.following.append(self.FOLLOW_activityDef_in_activityDef364)
                            self.activityDef()

                            self._state.following.pop()
                            #action start
                            self.memory.append('repeat statement')
                            #action end


                        else:
                            if cnt15 >= 1:
                                break #loop15

                            eee = EarlyExitException(15, self.input)
                            raise eee

                        cnt15 += 1

                    self.match(self.input, UP, None)




                    self.match(self.input, UP, None)
                    #action start
                    self.memory.append('exit repeat state')
                    #action end


                elif alt19 == 6:
                    # src/SavedFSM/BuildFSM.g:185:10: ^( 'rec' label= ID ( ^( BRANCH ( activityDef )+ ) ) )
                    pass 
                    self.match(self.input, 52, self.FOLLOW_52_in_activityDef388)

                    self.match(self.input, DOWN, None)
                    label=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef394)
                    #action start
                    self.memory.append('enter rec state ' + label.text + str(self.current_fsm.get_current_state()))
                    self.current_fsm.recursions_states.setdefault(label.text, (self.current_fsm.format_state_name(self.current_fsm.get_current_state()), True))
                            
                    #action end
                    # src/SavedFSM/BuildFSM.g:189:2: ( ^( BRANCH ( activityDef )+ ) )
                    # src/SavedFSM/BuildFSM.g:189:3: ^( BRANCH ( activityDef )+ )
                    pass 
                    self.match(self.input, BRANCH, self.FOLLOW_BRANCH_in_activityDef410)

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:189:12: ( activityDef )+
                    cnt16 = 0
                    while True: #loop16
                        alt16 = 2
                        LA16_0 = self.input.LA(1)

                        if ((RESV <= LA16_0 <= SEND) or (RECLABEL <= LA16_0 <= PARALLEL) or LA16_0 == GLOBAL_ESCAPE or LA16_0 == 49 or (51 <= LA16_0 <= 52)) :
                            alt16 = 1


                        if alt16 == 1:
                            # src/SavedFSM/BuildFSM.g:189:13: activityDef
                            pass 
                            self._state.following.append(self.FOLLOW_activityDef_in_activityDef413)
                            self.activityDef()

                            self._state.following.pop()
                            #action start
                            self.memory.append('rec statement')
                            #action end


                        else:
                            if cnt16 >= 1:
                                break #loop16

                            eee = EarlyExitException(16, self.input)
                            raise eee

                        cnt16 += 1

                    self.match(self.input, UP, None)




                    self.match(self.input, UP, None)
                    #action start
                      
                    (start_state, isActive) = self.current_fsm.recursions_states.get(label.text)
                    self.memory.append('exit rec state ' + label.text + 'start_state' + str(start_state))
                    self.current_fsm.recursions_states[label.text] = (start_state, False)	 
                    	
                    #action end


                elif alt19 == 7:
                    # src/SavedFSM/BuildFSM.g:196:3: ^( 'RECLABEL' labelID= ID )
                    pass 
                    self.match(self.input, RECLABEL, self.FOLLOW_RECLABEL_in_activityDef431)

                    self.match(self.input, DOWN, None)
                    labelID=self.match(self.input, ID, self.FOLLOW_ID_in_activityDef438)
                    #action start
                      
                    	
                    (start_rec_state, isActive) = self.current_fsm.recursions_states.get(labelID.text)
                    self.memory.append('rec label:' + labelID.text + 'starts from state:' + str(start_rec_state))
                    if isActive:
                    	self.current_fsm.fsm.add_transition(self.current_fsm.fsm.EMPTY_TRANSITION, 
                    					    self.current_fsm.format_state_name(self.current_fsm.get_current_state()), 
                    					    start_rec_state)
                    	# Generate unreachable state for the choice construct						    
                    	self.current_fsm.move_current_state()	
                    else: raise ExceptionFSM('Calling a recusrion label from a recursion that is not valid')
                    	
                    #action end

                    self.match(self.input, UP, None)
                    #action start
                      
                    # Do not need it for no
                           #self.current_fsm.fsm.copy_transitions(self.current_fsm.recursions_states[labelID.text], self.current_fsm.get_current_state())
                    	
                    #action end


                elif alt19 == 8:
                    # src/SavedFSM/BuildFSM.g:213:3: ^( GLOBAL_ESCAPE ( ^( 'do' ( ( activityDef )+ ) ) ) ( ^( 'interrupt' roleName ( ( activityDef )+ ) ) ) )
                    pass 
                    self.match(self.input, GLOBAL_ESCAPE, self.FOLLOW_GLOBAL_ESCAPE_in_activityDef452)

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:214:5: ( ^( 'do' ( ( activityDef )+ ) ) )
                    # src/SavedFSM/BuildFSM.g:214:6: ^( 'do' ( ( activityDef )+ ) )
                    pass 
                    self.match(self.input, 58, self.FOLLOW_58_in_activityDef461)

                    self.match(self.input, DOWN, None)
                    # src/SavedFSM/BuildFSM.g:214:13: ( ( activityDef )+ )
                    # src/SavedFSM/BuildFSM.g:214:14: ( activityDef )+
                    pass 
                    # src/SavedFSM/BuildFSM.g:214:14: ( activityDef )+
                    cnt17 = 0
                    while True: #loop17
                        alt17 = 2
                        LA17_0 = self.input.LA(1)

                        if ((RESV <= LA17_0 <= SEND) or (RECLABEL <= LA17_0 <= PARALLEL) or LA17_0 == GLOBAL_ESCAPE or LA17_0 == 49 or (51 <= LA17_0 <= 52)) :
                            alt17 = 1


                        if alt17 == 1:
                            # src/SavedFSM/BuildFSM.g:214:14: activityDef
                            pass 
                            self._state.following.append(self.FOLLOW_activityDef_in_activityDef464)
                            self.activityDef()

                            self._state.following.pop()


                        else:
                            if cnt17 >= 1:
                                break #loop17

                            eee = EarlyExitException(17, self.input)
                            raise eee

                        cnt17 += 1



                    #action start
                    self.current_fsm.fsm.final_state = self.current_fsm.get_current_state()
                    #action end

                    self.match(self.input, UP, None)



                    # src/SavedFSM/BuildFSM.g:215:5: ( ^( 'interrupt' roleName ( ( activityDef )+ ) ) )
                    # src/SavedFSM/BuildFSM.g:215:6: ^( 'interrupt' roleName ( ( activityDef )+ ) )
                    pass 
                    self.match(self.input, 59, self.FOLLOW_59_in_activityDef477)

                    self.match(self.input, DOWN, None)
                    self._state.following.append(self.FOLLOW_roleName_in_activityDef479)
                    self.roleName()

                    self._state.following.pop()
                    #action start
                    self.memory.append('before setting interrupt_transition to True')
                    self.current_fsm.interrupt_start_state = self.current_fsm.move_current_state()
                    self.current_fsm.set_interrupt_transition = True
                    #action end
                    # src/SavedFSM/BuildFSM.g:218:56: ( ( activityDef )+ )
                    # src/SavedFSM/BuildFSM.g:218:57: ( activityDef )+
                    pass 
                    # src/SavedFSM/BuildFSM.g:218:57: ( activityDef )+
                    cnt18 = 0
                    while True: #loop18
                        alt18 = 2
                        LA18_0 = self.input.LA(1)

                        if ((RESV <= LA18_0 <= SEND) or (RECLABEL <= LA18_0 <= PARALLEL) or LA18_0 == GLOBAL_ESCAPE or LA18_0 == 49 or (51 <= LA18_0 <= 52)) :
                            alt18 = 1


                        if alt18 == 1:
                            # src/SavedFSM/BuildFSM.g:218:57: activityDef
                            pass 
                            self._state.following.append(self.FOLLOW_activityDef_in_activityDef488)
                            self.activityDef()

                            self._state.following.pop()


                        else:
                            if cnt18 >= 1:
                                break #loop18

                            eee = EarlyExitException(18, self.input)
                            raise eee

                        cnt18 += 1




                    self.match(self.input, UP, None)




                    self.match(self.input, UP, None)



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass
        return 
コード例 #11
0
def parallelAtSeller1_events():
    events = []
    events.append(TransitionFactory.create(LocalType.RESV, 'Order', 'Buyer'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Confirmation', 'Buyer'))
    events.append(TransitionFactory.create(LocalType.SEND, 'OK', 'Buyer'))
    return events
コード例 #12
0
def recAndChoice_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Stop', 'Seller'))
    return events
コード例 #13
0
ファイル: test_fsm_processing.py プロジェクト: pkediyal/pyon
def recAndChoice_events():
    events = []
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.SEND, 'Order', 'Seller'))
    events.append(TransitionFactory.create(LocalType.RESV, 'Stop', 'Seller'))
    return events