jeremiah-c-leary / vhdl-style-guide

Style guide enforcement for VHDL
GNU General Public License v3.0
192 stars 39 forks source link

VHDL-2008 block comment with `--` prevents fixing #982

Closed el-coder-sb closed 1 year ago

el-coder-sb commented 1 year ago

Environment VHDL Style Guide (VSG) version: 3.16.0 Git commit SHA: 00518a46 on Windows 10

Describe the bug

When adding a VHDL-2008 block comment (to the top of the file) with -- inside, prevents VSG running correctly. It doesn´t fix any issue.

To Reproduce Steps to reproduce the behavior:

  1. Add a VHDL-2008 block comment with -- inside: e.g. `/-----/
  2. run vsg vsg -f main.vhd --fix
  3. Output on cmd window is OK, but it wasn´t fixed anything.

Expected behavior Fix all fixable issues.

Additional context Somewhat related to #806

jeremiah-c-leary commented 1 year ago

Morning @el-coder-sb ,

I tried the following example:

  1 /*
  2  -- Some Comment
  3 */
  4
  5 library   ieee;
  6

and used the --fix option which resulted in the following:

  1 /*
  2  -- Some Comment
  3 */
  4
  5 library ieee;
  6

Could you provide a small code example which shows issue?

Regards,

--Jeremy

el-coder-sb commented 1 year ago

Here you go:

/* --- */

library       ieee;

Looks like /* or */ and -- in one row is a problem.

Regards, Simon

jeremiah-c-leary commented 1 year ago

Morning @el-coder-sb ,

I have pushed a fix for this to the issue-982 branch. When you get a chance could you check it out on your end and let me know if it resolves the issue for you?

Thanks,

--Jeremy

el-coder-sb commented 1 year ago

Thanks for quick reaction!

The above given code runs fine now. However this code crashes:

/*
-- */

Error:

[...] \Python\Python311\Lib\site-packages\vsg-3.16.0.dev10-py3.11.egg\vsg\tokens.py", line 242, in beginning_delimited_comment_after_comment
    iBeginningDelimitedCommentIndex = lTokens.index('/*')
                                      ^^^^^^^^^^^^^^^^^^^
ValueError: '/*' is not in list
jeremiah-c-leary commented 1 year ago

Evening @el-coder-sb ,

I pushed another update to address that condition. Please let me know how the updates works for you.

Thanks,

--Jeremy

el-coder-sb commented 1 year ago

@jeremiah-c-leary This time all of my code is formatted fine by VSG! Looks great. Thanks for that quick fix!

jeremiah-c-leary commented 1 year ago

Morning @el-coder-sb ,

Glad to hear it. I will get this merged to master.

--Jeremy