Remillard / VHDL-Mode

A package for Sublime Text that aids coding in the VHDL language.
MIT License
40 stars 10 forks source link

Text in strings recognized for beautification #106

Closed Remillard closed 5 years ago

Remillard commented 5 years ago

So it turns out that text in strings can trigger beautification words. Notably something like

write_note(out_stream, string'("--------- End Collection on A -------------"), C_DEBUG);

Will trigger an erroneous end string. Need to figure out a way to ignore this for matching.

Remillard commented 5 years ago

Pretty quick fix. Just needed to blank out strings for lexical analysis. Quick method addition.

Remillard commented 5 years ago

There's something weird going on still with strings and beautification -- possibly in the alignment of symbols. String text like the following is getting a space inserted prior to it (note the string'(" --- part):

        -- Start a single shot collection on A.  Monitor the state
        test_id <= TEST1;
        write_note(dbg_stream, string'(" -------------------------------------------"), C_DEBUG);
        write_note(dbg_stream, string'(" --------- TEST 1 --------------------------"), C_DEBUG);
        write_note(dbg_stream, string'(" ---- SINGLE BUFFER A SINGLE SHOT TEST -----"), C_DEBUG);
        write_note(dbg_stream, string'(" -------------------------------------------"), C_DEBUG);

However later in the same file, the following is NOT getting the extra space:

        -- End single shot collection on A.  Read stats about A.
        write_note(dbg_stream, string'("--------- End Collection on A -------------"), C_DEBUG);
        axi_lw_bus.avalon_master_mosi(C_CTRL_REG_1_ADDR, X"00000000", axi_lw_bus_rec, dbg_stream, C_DEBUG);
        write_note(dbg_stream, string'("--------- Tick Time -----------------------"), C_DEBUG);
        axi_lw_bus.avalon_master_miso(C_TIME_REG_ADDR, rd_data, axi_lw_bus_rec, dbg_stream, C_DEBUG);
        write_note(dbg_stream, string'("--------- Offset of Oldest A Data ---------"), C_DEBUG);
        axi_lw_bus.avalon_master_miso(C_BUF_A_OFF_ADDR, rd_data, axi_lw_bus_rec, dbg_stream, C_DEBUG);
Remillard commented 5 years ago

Seems to be contiguous lines with strings both starting with --.... When the lines are separated, there's no space.

Remillard commented 5 years ago

Here's another example:

        write_note(dbg_stream, string'("-------------------------------------------"), C_DEBUG);
        write_note(dbg_stream, string'("SIMULATION END"), C_DEBUG);
        write_note(dbg_stream, string'(" -------------------------------------------"), C_DEBUG);
        write_note(std_stream, string'(" -------------------------------------------"), C_DEBUG);
        write_note(std_stream, string'("SIMULATION END"), C_DEBUG);
        write_note(std_stream, string'("-------------------------------------------"), C_DEBUG);
Remillard commented 5 years ago

This just became a very bad bug. It'll affect std_logic_vector bit strings with don't cares like this:

    constant C_DISCRETES_MASK : std_logic_vector(9 downto 0) := "0 ---------";
    constant C_CARB_MASK      : std_logic_vector(9 downto 0) := "1 ---------";

Will try to get time to work on this ASAP.

Remillard commented 5 years ago

Turned out the problem was comment alignment was triggering for text inside of strings. Solved that problem, but larger problem that literal strings are considered for space removal as well. so still hammering on it.

Remillard commented 5 years ago

feature/text_mangling_refactor is a branch dedicated to cleaning up the beautification routines by puttings these methods into classes and giving myself the tools to do more sophisticated things.