コード例 #1
0
def detect(iToken, lObjects):
    '''
    procedure_call_statement ::=
        [ label : ] procedure_call ;
    '''

    iCurrent = iToken
    # Move past label if it exists
    if utils.find_in_next_n_tokens(':', 2, iCurrent, lObjects):
        iCurrent = utils.find_next_token(iCurrent, lObjects)
        iCurrent += 1
        iCurrent = utils.find_next_token(iCurrent, lObjects)
        iCurrent += 1
    # Check if next token is keyword
    iCurrent = utils.find_next_token(iCurrent, lObjects)
    if lObjects[iCurrent].get_value().lower() in lKeywords:
        return iToken
    # Check if signal assignment operator exists
    if utils.find_in_range('<=', iCurrent, ';', lObjects):
        return iToken
    # Check if variable assignment operator exists
    if utils.find_in_range(':=', iCurrent, ';', lObjects):
        return iToken
    # Otherwise it must be a procedure_call_statement
    return classify(iToken, lObjects)
コード例 #2
0
def detect(iToken, lObjects):
    '''
    simple_force_assignment ::=
        target <= force [ force_mode ] expression ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken,
                                  lObjects):
        return False
    if utils.find_in_range('<=', iToken, ';', lObjects):
        if utils.find_in_range('force', iToken, ';', lObjects):
            return classify(iToken, lObjects)
    return iToken
コード例 #3
0
def detect(iToken, lObjects):
    '''
    selected_waveform_assignment ::=
        with expression select [ ? ]
            target <= [delay_machanism] selected_waveforms ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken, lObjects):
        return False
    if utils.find_in_range('<=', iToken, ';', lObjects):
        if not utils.find_in_range('force', iToken, ';', lObjects):
            return classify(iToken, lObjects)
    return iToken
コード例 #4
0
def detect(iToken, lObjects):
    '''
    conditional_waveform_assignment ::=
        target <= [ delay_mechanism ] conditional_waveforms ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken,
                                  lObjects):
        return False
    if utils.find_in_range('<=', iToken, ';', lObjects):  #
        if not utils.find_in_range('force', iToken, ';', lObjects):
            return classify(iToken, lObjects)
    return iToken
コード例 #5
0
def detect(iToken, lObjects):
    '''
    selected_force_assignment ::= [§ 10.5.4]
        with expression select [ ? ]
            target <= force [ force_mode ] selected_expressions ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken,
                                  lObjects):
        return False
    if utils.find_in_range('<=', iToken, ';', lObjects):
        if utils.find_in_range('force', iToken, ';', lObjects):
            return classify(iToken, lObjects)
    return iToken
コード例 #6
0
def detect(iToken, lObjects):
    '''
    selected_variable_assignment ::=
        with expression select [ ? ]
           target := selected_expressions ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken, lObjects):
        return False
    if utils.find_in_range(':=', iToken, ';', lObjects):
        if utils.find_in_range('with', iToken, ';', lObjects):
            return True
        return False
    return False
コード例 #7
0
def detect(iToken, lObjects):
    '''
    conditional_variable_assignment ::=
        target := conditional_expressions ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken,
                                  lObjects):
        return False
    if utils.find_in_range(':=', iToken, ';', lObjects):
        if not utils.find_in_range('with', iToken, ';', lObjects):
            if utils.find_in_range('when', iToken, ';', lObjects):
                return True
    return False
コード例 #8
0
def detect(iToken, lObjects):
    '''
    simple_waveform_assignment ::=
        target <= [ delay_mechanism ] waveform ;
    '''

    if utils.is_next_token_one_of(['when', 'if', 'elsif', 'else'], iToken,
                                  lObjects):
        return False
    if utils.find_in_range('<=', iToken, ';', lObjects):
        if utils.find_in_range('force', iToken, ';', lObjects):
            return iToken
        if utils.find_in_range('release', iToken, ';', lObjects):
            return iToken
    return classify(iToken, lObjects)
コード例 #9
0
def detect(iToken, lObjects):
    '''
    conditional_signal_assignment ::=
        conditional_waveform_assignment
      | conditional_force_assignment
    '''

    if utils.is_next_token('when', iToken, lObjects):
        return False
    if utils.find_in_next_n_tokens('if', 3, iToken, lObjects):
        return False
    if utils.find_in_range('<=', iToken, ';', lObjects):
        if utils.find_in_range('when', iToken, ';', lObjects):
            return True
    return False
コード例 #10
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
コード例 #11
0
def detect(iToken, lObjects):
    '''
    simple_release_assignment ::=
        target <= release [ force_mode ] ;
    '''

    if utils.find_in_range('release', iToken, ';', lObjects):
        return classify(iToken, lObjects)
    return iToken
コード例 #12
0
def detect(iCurrent, lObjects):
    '''
    instantiated_unit ::=
        [ component ] component_name
      | entity entity_name [ ( *architecture*_identifier ) ]
      | configuration configuration_name
    '''
    iToken = iCurrent
    if utils.is_next_token_one_of(['component', 'entity', 'configuration'],
                                  iToken, lObjects):
        return True
    if utils.find_in_next_n_tokens(';', 2, iToken, lObjects):
        return True
    # Check if this is a signal assignment
    if utils.find_in_range('<=', iToken, ';', lObjects):
        return False
    if utils.find_in_range('generate', iToken, ';', lObjects):
        return False
    return True
コード例 #13
0
def detect(iToken, lObjects):
    '''
    selected_signal_assignment ::=
        selected_waveform_assignment
      | selected_force_assignment
    '''

    if utils.find_in_range('<=', iToken, ';', lObjects):
        if utils.find_in_next_n_tokens('with', 3, iToken, lObjects):
            return True
        if utils.find_in_next_n_tokens('if', 3, iToken, lObjects):
            return True
    return False
コード例 #14
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