g2384 / VHDLFormatter

VHDL formatter web online written in typescript
https://g2384.github.io/VHDLFormatter/
MIT License
51 stars 20 forks source link

Syntax errors with custom type'd ports in component declaration #10

Closed mpendel closed 6 years ago

mpendel commented 6 years ago

Report a bug

There seems to be an issue with custom type'd ports. In this case, a record.

Input

component clk_reset is
      generic (  LCL_BLK        : block_t    := CLK_RST;
                 CLK1_FREQ_MHZ  : real       := 96.0;
                 CLK2_FREQ_MHZ  : real       := 48.0;
                 RESET_LOW_TIME : time       := 700 ns
         );
      port (
      -- Ctrl I/F
          clk_ctrl_in    : in  ctrl2blk_t;   
          clk_resp_out   : out blk2ctrl_t;   
      -- CLOCK Outputs
          clk1_out       : out std_logic;
          clk2_out       : out std_logic;
          rstn_out       : out std_logic
     );
    end component;
-- anything1
-- anything2

Expected Behavior

I think it's obvious. Shouldn't throw away lines nor introduce syntax errors.

Actual Behavior

Formatting is fine, but it kicks out an extra END COMPONENT; and drops a line. See below:

Result

COMPONENT clk_reset IS
    GENERIC (
        LCL_BLK : block_t := CLK_RST;
        CLK1_FREQ_MHZ : real := 96.0;
        CLK2_FREQ_MHZ : real := 48.0;
        RESET_LOW_TIME : TIME := 700 ns
    );
    PORT (
        -- Ctrl I/F
        clk_ctrl_in : IN ctrl2blk_t;
        clk_resp_out : OUT blk2ctrl_t;
        -- CLOCK Outputs
        clk1_out : OUT std_logic;
        clk2_out : OUT std_logic;
        rstn_out : OUT std_logic
    );
END COMPONENT;
END COMPONENT;
-- anything1

Notice the extra END COMPONENT; and the missing --anything2

mpendel commented 6 years ago

I see that there's a duplicate issue and it may not be related to custom types. Regardless, the issue stands. Thanks!

g2384 commented 6 years ago

investigating

g2384 commented 6 years ago

Fixed. If not, reopen this one with new examples, <3