Exemplo n.º 1
0
def path3():
    a = Behaviour('a', Dispatch)
    b = Behaviour('b', Dispatch)
    c = Behaviour('c', Subprocess)
    new = Path()
    new.data = [a, b, c]
    return new
Exemplo n.º 2
0
def path2():
    a = Behaviour('a', Dispatch)
    b = Behaviour('b', Dispatch)
    c = Behaviour('f', Dispatch)
    new = Path()
    new.data = [a, b, c]
    return new
Exemplo n.º 3
0
def p_subprocess(p):
    """
    subprocess : BR_OPEN IDENTIFIER repeat BR_CLOSE
               | BR_OPEN IDENTIFIER BR_CLOSE
    """
    name, *number = p[2:-1]
    number = number[-1] if number else None
    action = Behaviour(name, Subprocess)
    action.repeat = number
    p.parser.process.actions.add_process_action(action, name)
    p[0] = action
Exemplo n.º 4
0
def p_condition(p):
    """
    condition : DIM_OPEN IDENTIFIER repeat DIM_CLOSE
              | DIM_OPEN IDENTIFIER DIM_CLOSE
    """
    name, *number = p[2:-1]
    number = number[-1] if number else None
    action = Behaviour(name, Block)
    action.repeat = number
    p.parser.process.actions.add_process_action(action, name)
    p[0] = action
Exemplo n.º 5
0
def p_receive(p):
    """
    receive : PAR_OPEN RS IDENTIFIER repeat PAR_CLOSE
            | PAR_OPEN IDENTIFIER repeat PAR_CLOSE
            | PAR_OPEN RS IDENTIFIER PAR_CLOSE
            | PAR_OPEN IDENTIFIER PAR_CLOSE
    """
    context = p[2:-1]
    if not isinstance(context[0], str) and context[0]:
        # We have replicative symbol at the very beginning
        _, name, *number = context
        replicative = True
    else:
        # We have ordinary receive
        name, *number = context
        replicative = False
    number = number[-1] if number else None
    action = Behaviour(name, Receive)
    action.repeat = number
    action.specific_attributes.append(('replicative', replicative))
    p.parser.process.actions.add_process_action(action, name)
    p[0] = action
Exemplo n.º 6
0
def p_dispatch(p):
    """
    dispatch : SBR_OPEN BS IDENTIFIER repeat SBR_CLOSE
             | SBR_OPEN IDENTIFIER repeat SBR_CLOSE
             | SBR_OPEN BS IDENTIFIER SBR_CLOSE
             | SBR_OPEN IDENTIFIER SBR_CLOSE
    """
    context = p[2:-1]
    if not isinstance(context[0], str) and context[0]:
        # We have broadcast symbol at the very beginning
        _, name, *number = context
        broadcast = True
    else:
        # We have ordinary dispatch
        name, *number = context
        broadcast = False
    number = number[-1] if number else None

    action = Behaviour(name, Dispatch)
    action.repeat = number
    action.specific_attributes.append(('broadcast', broadcast))
    p.parser.process.actions.add_process_action(action, name)
    p[0] = action