jeremiah-c-leary / vhdl-style-guide

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

Parser issue with calling procedure without arguments followed by for ... loop without label #515

Closed joshrsmith closed 3 years ago

joshrsmith commented 3 years ago

Environment Linux, circa https://github.com/jeremiah-c-leary/vhdl-style-guide/commit/fa5acc0794990a94dce40b2f649b864b0a39eca8

Describe the bug

Error: Unexpected token detected while parsing loop_statement @ Line XXX, Column YY Expecting : loop Found : <name of procedure>

To Reproduce

My_Proc : process
  ....
   procedure foo is
   begin
      ...
   end procedure foo;

   procedure bar is
   begin
      foo; --error here
   end procedure bar;
   ...

Expected behavior This would be supported by the parser.

jeremiah-c-leary commented 3 years ago

Hey @joshrsmith ,

I created this file:

architecture rtl of fifo is

 begin

   proc_label : process

     procedure foo is
     begin
     end procedure foo;

     procedure bar is
     begin
       foo;
     end procedure bar;

   begin

   end process;

 end architecture;

and it was parsed okay. I noticed the error was related to a loop_statement and was wondering if this is fixed with the update to for issue #514 . Could you check if this issue is resolved when you check the other issue?

Thanks,

--Jeremy

joshrsmith commented 3 years ago

There is still an issue here. I think I narrowed it down...

This triggers the problem:

architecture rtl of fifo is

 begin

   proc_label : process

     procedure foo is
     begin
     end procedure foo;

     procedure bar is
     begin
       foo;
       for i in 0 to G_GENERIC-1 loop
               -- stuff
       end loop;
     end procedure bar;

   begin

   end process;

 end architecture;

This works around the problem (note the label on the loop):

architecture rtl of fifo is

 begin

   proc_label : process

     procedure foo is
     begin
     end procedure foo;

     procedure bar is
     begin
       foo;
       my_loop : for i in 0 to G_GENERIC-1 loop
               -- stuff
       end loop my_loop;
     end procedure bar;

   begin

   end process;

 end architecture;
jeremiah-c-leary commented 3 years ago

Hey @joshrsmith ,

That example helped. I replicated the error and just pushed a fix.

Thanks,

--Jeremy

joshrsmith commented 3 years ago

Resolved.