36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
|
|
from vsg.token import conditional_waveform_assignment as token
|
|
|
|
from vsg.vhdlFile import utils
|
|
|
|
from vsg.vhdlFile.classify import delay_mechanism
|
|
from vsg.vhdlFile.classify import conditional_waveforms
|
|
|
|
|
|
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
|
|
|
|
|
|
def classify(iToken, lObjects):
|
|
|
|
iCurrent = utils.assign_tokens_until('<=', token.target, iToken, lObjects)
|
|
iCurrent = utils.assign_next_token_required('<=', token.assignment, iCurrent, lObjects)
|
|
|
|
iCurrent = delay_mechanism.detect(iCurrent, lObjects)
|
|
|
|
iCurrent = conditional_waveforms.classify_until([';'], iToken, lObjects)
|
|
|
|
iCurrent = utils.assign_next_token_required(';', token.semicolon, iCurrent, lObjects)
|
|
|
|
return iCurrent
|