Issue#1366: Added subprogram instantiation structure rules.
This commit is contained in:
parent
9f9dca03f8
commit
9087f795c8
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
|
|
@ -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."
|
||||
|
|
@ -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."
|
||||
|
|
@ -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."
|
||||
|
|
@ -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."
|
||||
Loading…
Reference in New Issue