diff --git a/vsg/rules/subprogram_instantiation/__init__.py b/vsg/rules/subprogram_instantiation/__init__.py index 48b48eb1..1bcda457 100644 --- a/vsg/rules/subprogram_instantiation/__init__.py +++ b/vsg/rules/subprogram_instantiation/__init__.py @@ -1,5 +1,10 @@ # -*- coding: utf-8 -*- +from .rule_001 import rule_001 +from .rule_002 import rule_002 +from .rule_003 import rule_003 +from .rule_004 import rule_004 +from .rule_005 import rule_005 from .rule_500 import rule_500 from .rule_501 import rule_501 from .rule_502 import rule_502 diff --git a/vsg/rules/subprogram_instantiation/rule_001.py b/vsg/rules/subprogram_instantiation/rule_001.py new file mode 100644 index 00000000..1f2d18f8 --- /dev/null +++ b/vsg/rules/subprogram_instantiation/rule_001.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from vsg import token +from vsg.rules import move_token_next_to_another_token + + +class rule_001(move_token_next_to_another_token): + """ + This rule checks the new **procedure** keyword is on the same line as the new subprogram identifier. + + **Violation** + + .. code-block:: vhdl + + procedure + my_proc is new my_generic_proc + + **Fix** + + .. code-block:: vhdl + + procedure my_proc is new my_generic_proc + """ + + def __init__(self): + super().__init__(token.subprogram_kind.procedure_keyword, token.subprogram_instantiation_declaration.identifier) + self.solution = "Ensure the *procedure* keyword is on the same line as the new package identifier." diff --git a/vsg/rules/subprogram_instantiation/rule_002.py b/vsg/rules/subprogram_instantiation/rule_002.py new file mode 100644 index 00000000..88361426 --- /dev/null +++ b/vsg/rules/subprogram_instantiation/rule_002.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from vsg import token +from vsg.rules import move_token_next_to_another_token + + +class rule_002(move_token_next_to_another_token): + """ + This rule checks the new **function** keyword is on the same line as the new subprogram identifier. + + **Violation** + + .. code-block:: vhdl + + function + my_func is new my_generic_func + + **Fix** + + .. code-block:: vhdl + + function my_func is new my_generic_func + """ + + def __init__(self): + super().__init__(token.subprogram_kind.function_keyword, token.subprogram_instantiation_declaration.identifier) + self.solution = "Ensure the *function* keyword is on the same line as the new package identifier." diff --git a/vsg/rules/subprogram_instantiation/rule_003.py b/vsg/rules/subprogram_instantiation/rule_003.py new file mode 100644 index 00000000..e334cf56 --- /dev/null +++ b/vsg/rules/subprogram_instantiation/rule_003.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from vsg import token +from vsg.rules import move_token_next_to_another_token + + +class rule_003(move_token_next_to_another_token): + """ + This rule checks the **is** keyword is on the same line as the new subprogram identifier. + + **Violation** + + .. code-block:: vhdl + + procedure my_proc + is new my_generic_proc + + **Fix** + + .. code-block:: vhdl + + procedure my_proc is new my_generic_proc + """ + + def __init__(self): + super().__init__(token.subprogram_instantiation_declaration.identifier, token.subprogram_instantiation_declaration.is_keyword) + self.solution = "Ensure the *is* keyword is on the same line as the new subprogram identifier." diff --git a/vsg/rules/subprogram_instantiation/rule_004.py b/vsg/rules/subprogram_instantiation/rule_004.py new file mode 100644 index 00000000..dd184395 --- /dev/null +++ b/vsg/rules/subprogram_instantiation/rule_004.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from vsg.rules import move_token_next_to_another_token +from vsg.token import subprogram_instantiation_declaration as token + + +class rule_004(move_token_next_to_another_token): + """ + This rule checks the **new** keyword is on the same line as the **is** keyword. + + **Violation** + + .. code-block:: vhdl + + procedure my_proc is + new my_generic_proc + + **Fix** + + .. code-block:: vhdl + + procedure my_proc is new my_generic_proc + """ + + def __init__(self): + super().__init__(token.is_keyword, token.new_keyword) + self.solution = "Ensure the *new* keyword is on the same line as the *is* keyword." diff --git a/vsg/rules/subprogram_instantiation/rule_005.py b/vsg/rules/subprogram_instantiation/rule_005.py new file mode 100644 index 00000000..f9c96d16 --- /dev/null +++ b/vsg/rules/subprogram_instantiation/rule_005.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from vsg.rules import move_token_next_to_another_token +from vsg.token import subprogram_instantiation_declaration as token + + +class rule_005(move_token_next_to_another_token): + """ + This rule checks the uninstantiated subprogram name is on the same line as the **new** keyword. + + **Violation** + + .. code-block:: vhdl + + procedure my_proc is new + my_generic_proc + + **Fix** + + .. code-block:: vhdl + + procedure my_proc is new my_generic_proc + """ + + def __init__(self): + super().__init__(token.new_keyword, token.uninstantiated_subprogram_name) + self.solution = "Ensure the uninstantiated subprogram name is on the same line as the *new* keyword."