From 4772e9949f155502bbbac5594229c4a9669c2c7a Mon Sep 17 00:00:00 2001 From: Jeremiah Leary Date: Mon, 23 Nov 2020 19:01:37 -0600 Subject: [PATCH] Adding indenting for package_body. --- vsg/vhdlFile/indent/package_body.py | 18 ++++++++++++++++++ vsg/vhdlFile/vhdlFile.py | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 vsg/vhdlFile/indent/package_body.py diff --git a/vsg/vhdlFile/indent/package_body.py b/vsg/vhdlFile/indent/package_body.py new file mode 100644 index 00000000..891f7cd9 --- /dev/null +++ b/vsg/vhdlFile/indent/package_body.py @@ -0,0 +1,18 @@ + +from vsg.token import package_body as token + + +def set_indent(iCurrentIndent, bLabelFound, oToken): + + iIndent = iCurrentIndent + bMyLabelFound = bLabelFound + + if isinstance(oToken, token.package_keyword): + oToken.set_indent(iIndent) + iIndent += 1 + + if isinstance(oToken, token.end_keyword): + iIndent -= 1 + oToken.set_indent(iIndent) + + return iIndent, bMyLabelFound diff --git a/vsg/vhdlFile/vhdlFile.py b/vsg/vhdlFile/vhdlFile.py index 86c5c824..7d6e97aa 100644 --- a/vsg/vhdlFile/vhdlFile.py +++ b/vsg/vhdlFile/vhdlFile.py @@ -30,6 +30,7 @@ from vsg.vhdlFile.indent import generate_statement from vsg.vhdlFile.indent import generic_clause from vsg.vhdlFile.indent import port_clause from vsg.vhdlFile.indent import if_statement +from vsg.vhdlFile.indent import package_body from vsg.vhdlFile.indent import package_declaration from vsg.vhdlFile.indent import simple_signal_assignment from vsg.vhdlFile.indent import signal_declaration @@ -382,6 +383,7 @@ class vhdlFile(): iIndent, bLabelFound = generic_clause.set_indent(iIndent, bLabelFound, oToken) iIndent, bLabelFound = port_clause.set_indent(iIndent, bLabelFound, oToken) iIndent, bLabelFound = if_statement.set_indent(iIndent, bLabelFound, oToken) + iIndent, bLabelFound = package_body.set_indent(iIndent, bLabelFound, oToken) iIndent, bLabelFound = package_declaration.set_indent(iIndent, bLabelFound, oToken) iIndent, bLabelFound = simple_signal_assignment.set_indent(iIndent, bLabelFound, oToken) iIndent, bLabelFound = signal_declaration.set_indent(iIndent, bLabelFound, oToken)