Updates for issue #429
Improving error message reporting while parsing generate statements.
This commit is contained in:
parent
72271401ea
commit
e80c16da15
|
|
@ -1453,32 +1453,32 @@
|
|||
{
|
||||
"rule": "generate_002",
|
||||
"linenumber": 357,
|
||||
"solution": "Add 1 space(s) between spi_sck_cpol_0_proc and spi_sck_cpol_0_proc"
|
||||
"solution": "Add 1 space(s) between spi_sck_cpol_0_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "generate_002",
|
||||
"linenumber": 362,
|
||||
"solution": "Add 1 space(s) between spi_sck_cpol_1_proc and spi_sck_cpol_1_proc"
|
||||
"solution": "Add 1 space(s) between spi_sck_cpol_1_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "generate_002",
|
||||
"linenumber": 369,
|
||||
"solution": "Add 1 space(s) between samp_ce_cpha_0_proc and samp_ce_cpha_0_proc"
|
||||
"solution": "Add 1 space(s) between samp_ce_cpha_0_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "generate_002",
|
||||
"linenumber": 374,
|
||||
"solution": "Add 1 space(s) between samp_ce_cpha_1_proc and samp_ce_cpha_1_proc"
|
||||
"solution": "Add 1 space(s) between samp_ce_cpha_1_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "generate_002",
|
||||
"linenumber": 380,
|
||||
"solution": "Add 1 space(s) between fsm_ce_cpha_0_proc and fsm_ce_cpha_0_proc"
|
||||
"solution": "Add 1 space(s) between fsm_ce_cpha_0_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "generate_002",
|
||||
"linenumber": 385,
|
||||
"solution": "Add 1 space(s) between fsm_ce_cpha_1_proc and fsm_ce_cpha_1_proc"
|
||||
"solution": "Add 1 space(s) between fsm_ce_cpha_1_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "generate_003",
|
||||
|
|
@ -2028,12 +2028,12 @@
|
|||
{
|
||||
"rule": "if_015",
|
||||
"linenumber": 443,
|
||||
"solution": "Change spaces between end and end to 1"
|
||||
"solution": "Change spaces between end and if to 1"
|
||||
},
|
||||
{
|
||||
"rule": "if_015",
|
||||
"linenumber": 451,
|
||||
"solution": "Change spaces between end and end to 1"
|
||||
"solution": "Change spaces between end and if to 1"
|
||||
},
|
||||
{
|
||||
"rule": "if_030",
|
||||
|
|
@ -2993,12 +2993,12 @@
|
|||
{
|
||||
"rule": "process_024",
|
||||
"linenumber": 321,
|
||||
"solution": "Add 1 space(s) between spi_2x_ce_gen_proc and spi_2x_ce_gen_proc"
|
||||
"solution": "Add 1 space(s) between spi_2x_ce_gen_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "process_024",
|
||||
"linenumber": 436,
|
||||
"solution": "Add 1 space(s) between in_transfer_proc and in_transfer_proc"
|
||||
"solution": "Add 1 space(s) between in_transfer_proc and :"
|
||||
},
|
||||
{
|
||||
"rule": "process_026",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ from vsg.vhdlFile.classify import case_generate_alternative
|
|||
def detect(iToken, lObjects):
|
||||
if utils.are_next_consecutive_tokens([None, ':', 'case'], iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
if utils.are_next_consecutive_tokens(['case'], iToken, lObjects):
|
||||
iIndex = utils.find_next_token(iToken, lObjects)
|
||||
oToken = token.case_keyword(lObjects[iToken].get_value())
|
||||
utils.print_error_message('generate_label', oToken, iIndex, lObjects)
|
||||
return iToken
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ def detect(iToken, lObjects):
|
|||
|
||||
if utils.are_next_consecutive_tokens([None, ':', 'for'], iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
if utils.are_next_consecutive_tokens(['for'], iToken, lObjects):
|
||||
iIndex = utils.find_next_token(iToken, lObjects)
|
||||
oToken = token.for_keyword(lObjects[iToken].get_value())
|
||||
utils.print_error_message('generate_label', oToken, iIndex, lObjects)
|
||||
return iToken
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ def detect(iToken, lObjects):
|
|||
|
||||
if utils.are_next_consecutive_tokens([None, ':', 'if'], iToken, lObjects):
|
||||
return classify(iToken, lObjects)
|
||||
if utils.are_next_consecutive_tokens(['if'], iToken, lObjects):
|
||||
iIndex = utils.find_next_token(iToken, lObjects)
|
||||
oToken = token.if_keyword(lObjects[iToken].get_value())
|
||||
utils.print_error_message('generate_label', oToken, iIndex, lObjects)
|
||||
return iToken
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -391,8 +391,9 @@ def print_error_message(sToken, token, iToken, lObjects):
|
|||
iLine = calculate_line_number(iToken, lObjects)
|
||||
iColumn = calculate_column(iToken, lObjects)
|
||||
sModuleName = extract_module_name(token)
|
||||
print(f'Error: Unknown token in {sModuleName}({iLine}:{iColumn})')
|
||||
print(f' Expecting {sToken}, found {sFoundToken}')
|
||||
print(f'Error: Unexpected token detected while parsing {sModuleName} @ Line {iLine}, Column {iColumn}')
|
||||
print(f' Expecting : {sToken}')
|
||||
print(f' Found : {sFoundToken}')
|
||||
exit()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue