Issue#966: Updating classifier to handle subtypes within constraints. (#1032)

This commit is contained in:
Jeremiah Leary 2023-11-19 07:49:34 -06:00 committed by GitHub
parent a4fedc7230
commit c3f02ec833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 4 deletions

View File

@ -104,13 +104,56 @@
19 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
20 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
20 | -- Example 4 : subtype in subtype declaration
<class 'vsg.parser.comment'>
--------------------------------------------------------------------------------
21 |
21 | subtype identifier is type_mark(type_mark(blah));
<class 'vsg.token.subtype_declaration.subtype_keyword'>
<class 'vsg.token.subtype_declaration.identifier'>
<class 'vsg.token.subtype_declaration.is_keyword'>
<class 'vsg.token.type_mark.name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.token.type_mark.name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.token.index_constraint.close_parenthesis'>
<class 'vsg.token.index_constraint.close_parenthesis'>
<class 'vsg.token.subtype_declaration.semicolon'>
--------------------------------------------------------------------------------
22 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
22 | end architecture RTL;
23 | subtype identifier is type_mark(type_mark
<class 'vsg.token.subtype_declaration.subtype_keyword'>
<class 'vsg.token.subtype_declaration.identifier'>
<class 'vsg.token.subtype_declaration.is_keyword'>
<class 'vsg.token.type_mark.name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.token.type_mark.name'>
--------------------------------------------------------------------------------
24 | (
<class 'vsg.token.index_constraint.open_parenthesis'>
--------------------------------------------------------------------------------
25 | blah
<class 'vsg.parser.todo'>
--------------------------------------------------------------------------------
26 | )
<class 'vsg.token.index_constraint.close_parenthesis'>
--------------------------------------------------------------------------------
27 | );
<class 'vsg.token.index_constraint.close_parenthesis'>
<class 'vsg.token.subtype_declaration.semicolon'>
--------------------------------------------------------------------------------
28 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
29 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
--------------------------------------------------------------------------------
30 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
31 | 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

@ -17,6 +17,15 @@ architecture RTL of FIFO is
subtype new_std_logic is (resolved) std_ulogic;
-- Example 4 : subtype in subtype declaration
subtype identifier is type_mark(type_mark(blah));
subtype identifier is type_mark(type_mark
(
blah
)
);
begin
end architecture RTL;

View File

@ -4,6 +4,7 @@ from vsg import parser
from vsg.vhdlFile import utils
from vsg.vhdlFile.classify import range
from vsg.vhdlFile.classify import subtype_indication
def detect(iToken, lObjects):
@ -11,6 +12,8 @@ def detect(iToken, lObjects):
discrete_range ::=
*discrete*_subtype_indication | range
'''
if utils.are_next_consecutive_tokens([None, '(', None, ')'], iToken, lObjects):
return subtype_indication.classify(iToken, lObjects)
return range.detect(iToken, lObjects)