Ejemplo n.º 1
0
def detect(iCurrent, lObjects):
    '''
    context_reference ::=
        context selected_name { , selected_name } ;
    '''
    if utils.object_value_is(lObjects, iCurrent, 'context'):
        if not utils.find_in_range('is', iCurrent, ';', lObjects):
            return classify(iCurrent, lObjects)
    return iCurrent
Ejemplo n.º 2
0
def detect(iToken, lObjects):
    '''
    context_declaration ::=
        context identifier is
            context_clause
        end [ context ] [ context_simple_name ] ;
    '''

    iCurrent = utils.find_next_token(iToken, lObjects)
    if utils.object_value_is(lObjects, iCurrent, 'context'):
        if utils.find_in_range('is', iCurrent, ';', lObjects):
            return classify(iCurrent, lObjects)
    return iToken
def detect(iToken, lObjects):
    '''
    interface_subprogram_declaration ::=
        interface_subprogram_specification [ is interface_subprogram_default ]
    '''
    iCurrent = utils.find_next_token(iToken, lObjects)
    iLast = iCurrent
    iCurrent = interface_subprogram_specification.detect(iCurrent, lObjects)
    if iLast != iCurrent:
        iCurrent = utils.find_next_token(iToken, lObjects)
        if utils.object_value_is(lObjects, iCurrent, 'is'):
            return classify(iCurrent, lObjects)
    return iToken
def detect(iToken, lObjects):
    '''

    [ label : ] [ postponed ] concurrent_conditional_signal_assignment

    concurrent_conditional_signal_assignment ::=
        target <= [ guarded ] [ delay_mechanism ] conditional_waveforms ;

    conditional_waveforms ::=
        waveform when condition
        { else waveform when condition }
        [ else waveform ]

    The key to detecting this is looking for an assignment <= followed by the keyword **when** before a semicolon.
    '''

    iCurrent = iToken
    bAssignmentFound = False

    while lObjects[iCurrent].get_value() != ';':
        if utils.is_item(lObjects, iCurrent):
            if bAssignmentFound:
                if utils.object_value_is(lObjects, iCurrent, 'when'):
                    return True
            else:
                if utils.object_value_is(lObjects, iCurrent, 'when'):
                    return False
                if utils.object_value_is(lObjects, iCurrent, 'with'):
                    return False

            if utils.object_value_is(lObjects, iCurrent,
                                     '<=') and not bAssignmentFound:
                bAssignmentFound = True
        iCurrent += 1

    return False
def detect(iToken, lObjects):
    '''
    component_instantiation_statement ::=
        instantiation_label :
            instantiated_unit
                [ generic_map_aspect ]
                [ port_map_aspect ] ;
    '''
    iCurrent = utils.find_next_token(iToken, lObjects)
    iCurrent = utils.increment_token_count(iCurrent)
    iCurrent = utils.find_next_token(iCurrent, lObjects)
    if not utils.object_value_is(lObjects, iCurrent, ':'):
        return iToken
    iCurrent = utils.increment_token_count(iCurrent)
    if instantiated_unit.detect(iCurrent, lObjects):
        return classify(iToken, lObjects)
    return iToken
def detect(iToken, lObjects):
    '''
    package_declaration ::=
        package identifier is
            package_header
            package_declarative_part
        end [ package ] [ package_simple_name ] ;
    '''

    iCurrent = utils.find_next_token(iToken, lObjects)
    if utils.object_value_is(lObjects, iCurrent, 'package'):
        if not utils.find_in_next_n_tokens('body', 5, iCurrent, lObjects):
            if not utils.find_in_next_n_tokens('new', 5, iCurrent, lObjects):
                return classify(iToken, lObjects)
        else:
            return iToken

    return iToken
Ejemplo n.º 7
0
def detect(iToken, lObjects):
    '''
    [ label : ] [ postponed ] concurrent_simple_signal_assignment

    concurrent_simple_signal_assignment ::=
        target <= [ guarded ] [ delay_mechanism ] waveform ;

    The key to detecting this is looking for an assignment <= followed by a semicolon.
    This will be the default if the other types are not found.
    '''

    iCurrent = iToken

    while lObjects[iCurrent].get_value() != ';':
        if utils.is_item(lObjects, iCurrent):
            if utils.object_value_is(lObjects, iCurrent, 'when'):
                return False
            if lObjects[iCurrent].get_value() == '<=':
                return True
        iCurrent += 1

    return False