Adding process_statement objects.
This commit is contained in:
parent
faf8a50913
commit
eb889f5064
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
architecture RTL of FIFO is
|
||||
|
||||
begin
|
||||
|
||||
process_and_or : process(a,b,d,e) is
|
||||
signal a : std_logic;
|
||||
begin
|
||||
g <= (a and b) or (d and e);
|
||||
end process process_and_or;
|
||||
|
||||
process_and_or : postponed process(a,b,d,e) is
|
||||
signal a : std_logic;
|
||||
begin
|
||||
g <= (a and b) or (d and e);
|
||||
end postponed process process_and_or;
|
||||
|
||||
process_and_or : postponed process is
|
||||
begin
|
||||
end postponed process process_and_or;
|
||||
|
||||
process_and_or : postponed process
|
||||
begin
|
||||
end postponed process process_and_or;
|
||||
|
||||
process_and_or : process
|
||||
begin
|
||||
end process process_and_or;
|
||||
|
||||
process
|
||||
begin
|
||||
end process;
|
||||
|
||||
process is
|
||||
begin
|
||||
end process;
|
||||
|
||||
end architecture RTL;
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
import os
|
||||
|
||||
import unittest
|
||||
|
||||
from vsg import vhdlFile
|
||||
from vsg.tests import utils
|
||||
|
||||
from vsg.token import process_statement as token
|
||||
from vsg.token import procedure_call
|
||||
|
||||
|
||||
lFile = utils.read_vhdlfile(os.path.join(os.path.dirname(__file__),'..','process_statement','classification_test_input.vhd'))
|
||||
oFile = vhdlFile.vhdlFile(lFile)
|
||||
|
||||
|
||||
class test_token(unittest.TestCase):
|
||||
|
||||
def test_label_name(self):
|
||||
lExpected = []
|
||||
lExpected.append((6,1))
|
||||
lExpected.append((12,1))
|
||||
lExpected.append((18,1))
|
||||
lExpected.append((22,1))
|
||||
lExpected.append((26,1))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.label_name)
|
||||
|
||||
def test_label_colon(self):
|
||||
lExpected = []
|
||||
lExpected.append((6,3))
|
||||
lExpected.append((12,3))
|
||||
lExpected.append((18,3))
|
||||
lExpected.append((22,3))
|
||||
lExpected.append((26,3))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.label_colon)
|
||||
|
||||
def test_postponed_keyword(self):
|
||||
lExpected = []
|
||||
lExpected.append((12,5))
|
||||
lExpected.append((18,5))
|
||||
lExpected.append((22,5))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.postponed_keyword)
|
||||
|
||||
def test_keyword(self):
|
||||
lExpected = []
|
||||
lExpected.append((6,5))
|
||||
lExpected.append((12,7))
|
||||
lExpected.append((18,7))
|
||||
lExpected.append((22,7))
|
||||
lExpected.append((26,5))
|
||||
lExpected.append((30,1))
|
||||
lExpected.append((34,1))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.keyword)
|
||||
|
||||
def test_open_parenthesis(self):
|
||||
lExpected = []
|
||||
lExpected.append((6,6))
|
||||
lExpected.append((12,8))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.open_parenthesis)
|
||||
|
||||
def test_close_parenthesis(self):
|
||||
lExpected = []
|
||||
lExpected.append((6,14))
|
||||
lExpected.append((12,16))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.close_parenthesis)
|
||||
|
||||
def test_begin_keyword(self):
|
||||
lExpected = []
|
||||
lExpected.append((8,1))
|
||||
lExpected.append((14,1))
|
||||
lExpected.append((19,1))
|
||||
lExpected.append((23,1))
|
||||
lExpected.append((27,1))
|
||||
lExpected.append((31,1))
|
||||
lExpected.append((35,1))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.begin_keyword)
|
||||
|
||||
def test_end_keyword(self):
|
||||
lExpected = []
|
||||
lExpected.append((10,1))
|
||||
lExpected.append((16,1))
|
||||
lExpected.append((20,1))
|
||||
lExpected.append((24,1))
|
||||
lExpected.append((28,1))
|
||||
lExpected.append((32,1))
|
||||
lExpected.append((36,1))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.end_keyword)
|
||||
|
||||
def test_end_postponed_keyword(self):
|
||||
lExpected = []
|
||||
lExpected.append((16,3))
|
||||
lExpected.append((20,3))
|
||||
lExpected.append((24,3))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.end_postponed_keyword)
|
||||
|
||||
def test_end_process_keyword(self):
|
||||
lExpected = []
|
||||
lExpected.append((10,3))
|
||||
lExpected.append((16,5))
|
||||
lExpected.append((20,5))
|
||||
lExpected.append((24,5))
|
||||
lExpected.append((28,3))
|
||||
lExpected.append((32,3))
|
||||
lExpected.append((36,3))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.end_process_keyword)
|
||||
|
||||
def test_end_process_label_name(self):
|
||||
lExpected = []
|
||||
lExpected.append((10,5))
|
||||
lExpected.append((16,7))
|
||||
lExpected.append((20,7))
|
||||
lExpected.append((24,7))
|
||||
lExpected.append((28,5))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.end_process_label_name)
|
||||
|
||||
def test_semicolon(self):
|
||||
lExpected = []
|
||||
lExpected.append((10,6))
|
||||
lExpected.append((16,8))
|
||||
lExpected.append((20,8))
|
||||
lExpected.append((24,8))
|
||||
lExpected.append((28,6))
|
||||
lExpected.append((32,4))
|
||||
lExpected.append((36,4))
|
||||
|
||||
utils.validate_token(self, oFile, lExpected, token.semicolon)
|
||||
|
||||
|
||||
# def test_debug(self):
|
||||
# utils.print_objects(oFile, True)
|
||||
|
|
@ -2,19 +2,19 @@
|
|||
from vsg import parser
|
||||
|
||||
|
||||
class assert_label(label):
|
||||
class assert_label(parser.label):
|
||||
|
||||
def __init__(self, sString):
|
||||
label.__init__(self, sString)
|
||||
parser.label.__init__(self, sString)
|
||||
|
||||
|
||||
class assert_label_colon(label_colon):
|
||||
class assert_label_colon(parser.label_colon):
|
||||
|
||||
def __init__(self):
|
||||
label_colon.__init__(self)
|
||||
parser.label_colon.__init__(self)
|
||||
|
||||
|
||||
class assert_semicolon(semicolon):
|
||||
class assert_semicolon(parser.semicolon):
|
||||
|
||||
def __init__(self):
|
||||
semicolon.__init__(self)
|
||||
parser.semicolon.__init__(self)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
from vsg import parser
|
||||
|
||||
|
||||
class all_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
from vsg import parser
|
||||
|
||||
|
||||
class label_name(parser.label):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.label.__init__(self, sString)
|
||||
|
||||
|
||||
class label_colon(parser.label_colon):
|
||||
|
||||
def __init__(self):
|
||||
parser.label_colon.__init__(self)
|
||||
|
||||
|
||||
class postponed_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class open_parenthesis(parser.open_parenthesis):
|
||||
|
||||
def __init__(self):
|
||||
parser.open_parenthesis.__init__(self)
|
||||
|
||||
|
||||
class close_parenthesis(parser.close_parenthesis):
|
||||
|
||||
def __init__(self):
|
||||
parser.open_parenthesis.__init__(self)
|
||||
|
||||
|
||||
class is_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class begin_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class end_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class end_postponed_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class end_process_keyword(parser.keyword):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.keyword.__init__(self, sString)
|
||||
|
||||
|
||||
class end_process_label_name(parser.label):
|
||||
|
||||
def __init__(self, sString):
|
||||
parser.label.__init__(self, sString)
|
||||
|
||||
|
||||
class semicolon(parser.semicolon):
|
||||
|
||||
def __init__(self):
|
||||
parser.semicolon.__init__(self)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
from vsg import parser
|
||||
|
||||
|
||||
class comma(parser.comma):
|
||||
|
||||
def __init__(self):
|
||||
parser.comma.__init__(self)
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
from vsg.vhdlFile.classify import concurrent_procedure_call_statement
|
||||
from vsg.vhdlFile.classify import process_statement
|
||||
from vsg.vhdlFile.classify import concurrent_signal_assignment_statement
|
||||
from vsg.vhdlFile.classify import concurrent_assertion_statement
|
||||
|
||||
|
|
@ -20,6 +21,9 @@ def tokenize(oObject, iObject, lObjects, dVars):
|
|||
if concurrent_assertion_statement.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if process_statement.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if not dVars['concurrent_procedure_call_statement']:
|
||||
if concurrent_signal_assignment_statement.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
|
@ -34,3 +38,4 @@ def clear_flags(dVars):
|
|||
concurrent_signal_assignment_statement.clear_flags(dVars)
|
||||
concurrent_assertion_statement.clear_flags(dVars)
|
||||
concurrent_procedure_call_statement.clear_flags(dVars)
|
||||
process_statement.clear_flags(dVars)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
from vsg import parser
|
||||
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
name ::=
|
||||
simple_name
|
||||
| operator_symbol
|
||||
| character_literal
|
||||
| selected_name
|
||||
| indexed_name
|
||||
| slice_name
|
||||
| attribute_name
|
||||
| external_name
|
||||
'''
|
||||
if type(oObject) == parser.item:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
return True
|
||||
|
|
@ -3,11 +3,13 @@ from vsg.vhdlFile.classify import alias_declaration
|
|||
from vsg.vhdlFile.classify import attribute_declaration
|
||||
from vsg.vhdlFile.classify import constant_declaration
|
||||
from vsg.vhdlFile.classify import file_declaration
|
||||
from vsg.vhdlFile.classify import subprogram_declaration
|
||||
from vsg.vhdlFile.classify import subtype_declaration
|
||||
from vsg.vhdlFile.classify import type_declaration
|
||||
from vsg.vhdlFile.classify import use_clause
|
||||
from vsg.vhdlFile.classify import variable_declaration
|
||||
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
process_declarative_item ::=
|
||||
|
|
@ -30,6 +32,9 @@ def tokenize(oObject, iObject, lObjects, dVars):
|
|||
| group_declaration
|
||||
'''
|
||||
|
||||
if subprogram_declaration.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if type_declaration.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
|
|
@ -55,3 +60,15 @@ def tokenize(oObject, iObject, lObjects, dVars):
|
|||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
type_declaration.clear_flags(dVars)
|
||||
subprogram_declaration.clear_flags(dVars)
|
||||
subtype_declaration.clear_flags(dVars)
|
||||
constant_declaration.clear_flags(dVars)
|
||||
variable_declaration.clear_flags(dVars)
|
||||
file_declaration.clear_flags(dVars)
|
||||
alias_declaration.clear_flags(dVars)
|
||||
attribute_declaration.clear_flags(dVars)
|
||||
use_clause.clear_flags(dVars)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
from vsg.vhdlFile.classify import process_declarative_item
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
process_declarative_part ::=
|
||||
{ process_declarative_item }
|
||||
'''
|
||||
if process_declarative_item.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
process_declarative_item.clear_flags(dVars)
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
from vsg.token import process_sensitivity_list as token
|
||||
|
||||
from vsg.vhdlFile.classify import sensitivity_list
|
||||
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
process_sensitivity_list ::=
|
||||
all | sensitivity_list
|
||||
'''
|
||||
|
||||
if classify_all_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if sensitivity_list.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def classify_all_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'all':
|
||||
lObjects[iObject] = token.all_keyword(sValue)
|
||||
return True
|
||||
return False
|
||||
|
||||
def clear_flags(dVars):
|
||||
sensitivity_list.clear(flags)
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
|
||||
from vsg import parser
|
||||
from vsg.token import process_statement as token
|
||||
|
||||
from vsg.vhdlFile.classify import process_declarative_part
|
||||
from vsg.vhdlFile.classify import process_sensitivity_list
|
||||
from vsg.vhdlFile.classify import process_statement_part
|
||||
|
||||
iOpenParenthesis = 0
|
||||
iCloseParenthesis = 0
|
||||
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
process_statement ::=
|
||||
[ process_label : ]
|
||||
[ postponed ] process [ ( process_sensitivity_list ) ] [ is ]
|
||||
process_declarative_part
|
||||
begin
|
||||
process_statement_part
|
||||
end [ postponed ] process [ process_label ] ;
|
||||
'''
|
||||
if not dVars['process_statement']['keyword']:
|
||||
|
||||
if classify_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
else:
|
||||
|
||||
if not dVars['process_statement']['begin']:
|
||||
|
||||
if classify_is_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if classify_begin_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if process_declarative_part.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if not dVars['process_statement']['open_parenthesis']:
|
||||
|
||||
if classify_open_parenthesis(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
else:
|
||||
|
||||
if not dVars['process_statement']['close_parenthesis']:
|
||||
|
||||
update_parenthesis_counts(oObject, iOpenParenthesis, iCloseParenthesis)
|
||||
|
||||
if classify_close_parenthesis(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if process_sensitivity_list.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
else:
|
||||
|
||||
if not dVars['process_statement']['end']:
|
||||
|
||||
if process_statement_part.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if classify_end_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
else:
|
||||
|
||||
if classify_semicolon(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if classify_end_postponed_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if classify_end_process_keyword(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if classify_end_process_label_name(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def classify_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'process':
|
||||
lObjects[iObject] = token.keyword(sValue)
|
||||
dVars['process_statement']['keyword'] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_open_parenthesis(oObject, iObject, lObjects, dVars):
|
||||
if oObject.get_value() == '(':
|
||||
lObjects[iObject] = token.open_parenthesis()
|
||||
iOpenParenthesis = 1
|
||||
iCloseParenthesis = 0
|
||||
dVars['process_statement']['open_parenthesis'] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_close_parenthesis(oObject, iObject, lObjects, dVars):
|
||||
if oObject.get_value() == ')':
|
||||
if iOpenParenthesis == iCloseParenthesis:
|
||||
lObjects[iObject] = token.close_parenthesis()
|
||||
dVars['process_statement']['close_parenthesis'] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_is_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'is':
|
||||
lObjects[iObject] = token.is_keyword(sValue)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_begin_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'begin':
|
||||
lObjects[iObject] = token.begin_keyword(sValue)
|
||||
dVars['process_statement']['begin'] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_end_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'end':
|
||||
lObjects[iObject] = token.end_keyword(sValue)
|
||||
dVars['process_statement']['end'] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_end_postponed_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'postponed':
|
||||
lObjects[iObject] = token.end_postponed_keyword(oObject)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_end_process_keyword(oObject, iObject, lObjects, dVars):
|
||||
sValue = oObject.get_value()
|
||||
if sValue.lower() == 'process':
|
||||
lObjects[iObject] = token.end_process_keyword(oObject)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_end_process_label_name(oObject, iObject, lObjects, dVars):
|
||||
if type(oObject) == parser.item:
|
||||
lObjects[iObject] = token.end_process_label_name(oObject.get_value())
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def classify_semicolon(oObject, iObject, lObjects, dVars):
|
||||
if oObject.get_value() == ';':
|
||||
lObjects[iObject] = token.semicolon()
|
||||
clear_flags(dVars)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
dVars['process_statement']['keyword'] = False
|
||||
dVars['process_statement']['open_parenthesis'] = False
|
||||
dVars['process_statement']['close_parenthesis'] = False
|
||||
dVars['process_statement']['begin'] = False
|
||||
dVars['process_statement']['end'] = False
|
||||
|
||||
|
||||
def update_parenthesis_counts(oObject, iOpenParenthesis, iCloseParenthesis):
|
||||
if oObject.get_value() == '(':
|
||||
iOpenParenthesis += 1
|
||||
if oObject.get_value() == ')':
|
||||
iCloseParenthesis += 1
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
from vsg.vhdlFile.classify import sequential_statement
|
||||
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
process_statement_part ::=
|
||||
{ sequential_statement }
|
||||
'''
|
||||
if sequential_statement.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
sequential_statement.clear_flags(dVars)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
from vsg.token import sensitivity_list as token
|
||||
|
||||
from vsg.vhdlFile.classify import name
|
||||
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
sensitivity_list ::=
|
||||
*signal*_name { , *signal*_name}
|
||||
'''
|
||||
if classify_comma(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
if name.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def classify_comma(oObject, iObject, lObjects, dVars):
|
||||
if oObject.get_value() == ',':
|
||||
lObjects[iObject] = token.comma()
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
name.clear_flags(dVars)
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
from vsg.vhdlFile.classify import assertion_statement
|
||||
|
||||
def tokenize(oObject, iObject, lObjects, dVars):
|
||||
'''
|
||||
sequential_statement ::=
|
||||
wait_statement
|
||||
| assertion_statement
|
||||
| report_statement
|
||||
| signal_assignment_statement
|
||||
| variable_assignment_statement
|
||||
| procedure_call_statement
|
||||
| if_statement
|
||||
| case_statement
|
||||
| loop_statement
|
||||
| next_statement
|
||||
| exit_statement
|
||||
| return_statement
|
||||
| null_statement
|
||||
'''
|
||||
if assertion_statement.tokenize(oObject, iObject, lObjects, dVars):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def clear_flags(dVars):
|
||||
assertion_statement.clear_flags(dVars)
|
||||
|
|
@ -25,6 +25,7 @@ from vsg.token import concurrent_assertion_statement
|
|||
from vsg.token import assertion
|
||||
from vsg.token import concurrent_procedure_call_statement
|
||||
from vsg.token import procedure_call
|
||||
from vsg.token import process_statement
|
||||
|
||||
from vsg import parser
|
||||
|
||||
|
|
@ -235,10 +236,19 @@ class vhdlFile():
|
|||
|
||||
dVars['concurrent_procedure_call_statement'] = False
|
||||
|
||||
dVars['assertion_statement'] = False
|
||||
|
||||
dVars['procedure_call'] = {}
|
||||
dVars['procedure_call']['procedure_name'] = False
|
||||
dVars['procedure_call']['open_parenthesis'] = False
|
||||
|
||||
dVars['process_statement'] = {}
|
||||
dVars['process_statement']['keyword'] = False
|
||||
dVars['process_statement']['open_parenthesis'] = False
|
||||
dVars['process_statement']['close_parenthesis'] = False
|
||||
dVars['process_statement']['begin'] = False
|
||||
dVars['process_statement']['end'] = False
|
||||
|
||||
oLinePrevious = line.blank_line()
|
||||
|
||||
for sLine in self.filecontent:
|
||||
|
|
@ -338,6 +348,7 @@ class vhdlFile():
|
|||
self.classify_concurrent_signal_assignment_labels()
|
||||
self.classify_concurrent_assertion_statement_labels()
|
||||
self.classify_concurrent_procedure_call_statement_labels()
|
||||
self.classify_process_statement_labels()
|
||||
# self.print_debug()
|
||||
|
||||
|
||||
|
|
@ -815,6 +826,54 @@ class vhdlFile():
|
|||
# print('---> trigger')
|
||||
bTrigger = True
|
||||
|
||||
def classify_process_statement_labels(self):
|
||||
'''
|
||||
Assigns the correct objects to labels.
|
||||
'''
|
||||
|
||||
bTrigger = False
|
||||
bColonFound = False
|
||||
bProcedureName = False
|
||||
for iLine, oLine in enumerate(self.lines[::-1]):
|
||||
# print(oLine.line)
|
||||
for iObject, oObject in enumerate(oLine.objects[::-1]):
|
||||
# print(oObject)
|
||||
|
||||
if bTrigger:
|
||||
|
||||
if bColonFound:
|
||||
if type(oObject) == parser.item:
|
||||
iIndex = len(oLine.objects) - iObject - 1
|
||||
oLine.objects[iIndex] = process_statement.label_name(oObject.get_value())
|
||||
bColonFound = False
|
||||
bTrigger = False
|
||||
bProcedureName = False
|
||||
continue
|
||||
|
||||
else:
|
||||
|
||||
if type(oObject) == parser.item and oObject.get_value() == ':':
|
||||
iIndex = len(oLine.objects) - iObject - 1
|
||||
oLine.objects[iIndex] = process_statement.label_colon()
|
||||
bColonFound = True
|
||||
continue
|
||||
|
||||
if type(oObject) == parser.item and oObject.get_value() == 'postponed':
|
||||
iIndex = len(oLine.objects) - iObject - 1
|
||||
oLine.objects[iIndex] = process_statement.postponed_keyword(oObject.get_value())
|
||||
continue
|
||||
|
||||
|
||||
if type(oObject) != parser.comment and type(oObject) != parser.whitespace:
|
||||
# print('---> end <' + '-'*80)
|
||||
bProcedureName = False
|
||||
bColonFound = False
|
||||
bTrigger = False
|
||||
|
||||
if type(oObject) == process_statement.keyword:
|
||||
# print('---> trigger')
|
||||
bTrigger = True
|
||||
|
||||
def print_debug(self):
|
||||
for oLine in self.lines:
|
||||
print(f'{oLine.indentLevel} | {oLine.line}')
|
||||
|
|
|
|||
Loading…
Reference in New Issue