Issue#928: Fixing classification of discrete_subtype_indication. (#930)

This commit is contained in:
Jeremiah Leary 2023-04-04 06:11:16 -05:00 committed by GitHub
parent 27ba5318cd
commit 2d356c4a16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 5 deletions

View File

@ -84,13 +84,26 @@
13 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
14 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
14 | signal slv : std_logic_vector(integer_range_subtype);
<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.std_logic_vector'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.token.index_constraint.close_parenthesis'>
<class 'vsg.token.signal_declaration.semicolon'>
--------------------------------------------------------------------------------
15 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
16 | end architecture RTL;
16 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
--------------------------------------------------------------------------------
17 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
18 | 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

@ -11,6 +11,8 @@ architecture RTL of FIFO is
signal fifo_rd : fifo_wr'subtype;
signal slv : std_logic_vector(integer_range_subtype);
begin
end architecture RTL;

View File

@ -29,7 +29,6 @@ def classify(iToken, lObjects):
if utils.is_next_token(':', iCurrent, lObjects):
iCurrent = utils.assign_next_token_required(':', token.colon, iCurrent, lObjects)
iCurrent = subtype_indication.classify(iCurrent, lObjects)
iCurrent = utils.assign_next_token_required('is', token.is_keyword, iCurrent, lObjects)
iCurrent = name.classify_until([';', '['], iCurrent, lObjects)

View File

@ -21,6 +21,11 @@ def detect(iToken, lObjects):
return iToken
def detect_discrete_subtype_indication(iToken, lObjects):
if utils.is_next_token('(', iToken, lObjects):
return index_constraint.classify(iToken, lObjects)
return iToken
def classify(iToken, lObjects):
iCurrent = utils.find_next_token(iToken, lObjects)
@ -41,3 +46,8 @@ def open_detected(iToken, lObjects):
if utils.find_in_next_n_tokens('open', 2, iToken, lObjects):
return True
return False
def classify_index_constraint(iToken, lObjects):
print('--> classify_index_constraint')
return index_constraint.classify(iToken, lObjects)

View File

@ -24,4 +24,8 @@ def detect(iToken, lObjects):
if iReturn != iToken:
return iReturn
iReturn = array_constraint.detect_discrete_subtype_indication(iToken, lObjects)
if iReturn != iToken:
return iReturn
return iToken

View File

@ -19,7 +19,6 @@ def detect(iToken, lObjects):
def classify(iToken, lObjects):
iCurrent = utils.assign_next_token_required('(', token.open_parenthesis, iToken, lObjects)
while not utils.is_next_token(')', iCurrent, lObjects):