Updates for issue #514:
Parser did not accept infinite loops. 1) Updated test to expose issue 2) Updated parser to allow for infinite loops
This commit is contained in:
parent
fa5acc0794
commit
f7b4aae56e
|
|
@ -172,18 +172,32 @@
|
|||
42 |
|
||||
<class 'vsg.parser.blank_line'>
|
||||
--------------------------------------------------------------------------------
|
||||
43 |
|
||||
43 | FOR_LABEL : loop
|
||||
<class 'vsg.token.loop_statement.loop_label'>
|
||||
<class 'vsg.token.loop_statement.label_colon'>
|
||||
<class 'vsg.token.loop_statement.loop_keyword'>
|
||||
--------------------------------------------------------------------------------
|
||||
44 | null;
|
||||
<class 'vsg.token.null_statement.null_keyword'>
|
||||
<class 'vsg.token.null_statement.semicolon'>
|
||||
--------------------------------------------------------------------------------
|
||||
45 | end loop;
|
||||
<class 'vsg.token.loop_statement.end_keyword'>
|
||||
<class 'vsg.token.loop_statement.end_loop_keyword'>
|
||||
<class 'vsg.token.loop_statement.semicolon'>
|
||||
--------------------------------------------------------------------------------
|
||||
46 |
|
||||
<class 'vsg.parser.blank_line'>
|
||||
--------------------------------------------------------------------------------
|
||||
44 | end process;
|
||||
47 | end process;
|
||||
<class 'vsg.token.process_statement.end_keyword'>
|
||||
<class 'vsg.token.process_statement.end_process_keyword'>
|
||||
<class 'vsg.token.process_statement.semicolon'>
|
||||
--------------------------------------------------------------------------------
|
||||
45 |
|
||||
48 |
|
||||
<class 'vsg.parser.blank_line'>
|
||||
--------------------------------------------------------------------------------
|
||||
46 | end architecture RTL;
|
||||
49 | end architecture RTL;
|
||||
<class 'vsg.token.architecture_body.end_keyword'>
|
||||
<class 'vsg.token.architecture_body.end_architecture_keyword'>
|
||||
<class 'vsg.token.architecture_body.architecture_simple_name'>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ begin
|
|||
|
||||
end loop;
|
||||
|
||||
FOR_LABEL : loop
|
||||
null;
|
||||
end loop;
|
||||
|
||||
end process;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,23 +15,19 @@ def detect(iToken, lObjects):
|
|||
sequence_of_statements
|
||||
end loop [ loop_label ] ;
|
||||
'''
|
||||
|
||||
if utils.find_in_next_n_tokens(':', 2, iToken, lObjects):
|
||||
iCurrent = utils.find_next_token(iToken, lObjects)
|
||||
iCurrent += 1
|
||||
iCurrent = utils.find_next_token(iToken, lObjects)
|
||||
iCurrent = utils.find_next_token(iCurrent, lObjects)
|
||||
iCurrent += 1
|
||||
if iteration_scheme.detect(iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
if utils.is_next_token('loop', iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
return iToken
|
||||
else:
|
||||
if iteration_scheme.detect(iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
if utils.is_next_token('loop', iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
return iToken
|
||||
iCurrent = iToken
|
||||
|
||||
if iteration_scheme.detect(iCurrent, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
if utils.is_next_token('loop', iCurrent, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
|
||||
return iToken
|
||||
|
||||
|
||||
|
|
@ -41,7 +37,7 @@ def classify(iToken, lObjects):
|
|||
|
||||
iCurrent = iteration_scheme.classify(iCurrent, lObjects)
|
||||
|
||||
iCurrent = utils.assign_next_token_required('loop', token.loop_keyword, iToken, lObjects)
|
||||
iCurrent = utils.assign_next_token_required('loop', token.loop_keyword, iCurrent, lObjects)
|
||||
|
||||
iCurrent = sequence_of_statements.detect(iCurrent, lObjects)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue