Updates for issue #819 (#822)

Constraints with parenthesis would not properly classify.

  1)  Updated test to expose issue
  2)  Updated constraint classifer to properly handle parenthesis
This commit is contained in:
Jeremiah Leary 2022-09-22 08:23:29 -05:00 committed by GitHub
parent a2f23bd638
commit 76a0201f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 12 deletions

View File

@ -330,13 +330,33 @@
43 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
44 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
44 | signal sig9 : integer range (0) to (31) := 20;
<class 'vsg.token.signal_declaration.signal_keyword'>
<class 'vsg.token.signal_declaration.identifier'>
<class 'vsg.token.signal_declaration.colon'>
<class 'vsg.token.ieee.std_logic_1164.types.integer'>
<class 'vsg.token.range_constraint.range_keyword'>
<class 'vsg.parser.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.parser.close_parenthesis'>
<class 'vsg.token.direction.to'>
<class 'vsg.parser.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.parser.close_parenthesis'>
<class 'vsg.token.signal_declaration.assignment_operator'>
<class 'vsg.parser.todo'>
<class 'vsg.token.signal_declaration.semicolon'>
--------------------------------------------------------------------------------
45 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
46 | end architecture rtl;
46 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
--------------------------------------------------------------------------------
47 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
48 | 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'>

View File

@ -41,6 +41,8 @@ signal sig8 : record_type_3(
signal sig9 : integer range 0 to 31 := 20;
signal sig9 : integer range (0) to (31) := 20;
begin
end architecture rtl;

View File

@ -22,16 +22,10 @@ def classify(iToken, lObjects):
iParenCnt = 0
while not utils.is_next_token_one_of([';', 'units', ':='], iCurrent, lObjects):
if unmatched_closing_paren_found(iCurrent, lObjects, iParenCnt):
iCurrent = utils.find_next_token(iCurrent, lObjects)
iParenCnt = utils.update_paren_counter(iCurrent, lObjects, iParenCnt)
if iParenCnt == -1:
break
iCurrent = utils.assign_next_token(parser.todo, iCurrent, lObjects)
return iCurrent
def unmatched_closing_paren_found(iCurrent, lObjects, iParenCnt):
iCurrent = utils.find_next_token(iCurrent, lObjects)
iParenCnt = utils.update_paren_counter(iCurrent, lObjects, iParenCnt)
if iParenCnt == -1:
return True
return False