Skip to content

Issue when using \ followed by " #1831

Open

Description

@LapinFou

Hi folks,

I encountered an issue when using AUTO features with the following Verilog code.

Updating AUTOs...
verilog-modi-current: Search failed: "\\<\\(end\\(?:c\\(?:lass\\|on\\(?:fig\\|nectmodule\\)\\)\\|interface\\|module\\|p\\(?:ackage\\|r\\(?:imitive\\|ogram\\)\\)\\)\\)\\>"

After some investigation, I found the problematic line (see below).

   task tbPassed;
      begin
           begin
              $display("\n                  xx");
              $display("                xxx    _____         _____ _____");
              $display("              xxxx    |  __ \\ /\\    / ____/ ____|");
              $display("            xxxxx     | |__) /  \\  | (___| (___");
              $display("  xxx     xxxxxx      |  ___/ /\\ \\  \\___ \\\\___ \\"); // Generate error -> "verilog-modi-current: Search failed [...]"
              $display("  xxxx  xxxxxx        | |  / ____ \\ ____) |___) |");
              $display("    xxxxxxxx          |_| /_/    \\_\\_____/_____/");
              $display("      xxxx");
          end
      end
   endtask

If I add a space before the final " (\\ ") instead of \\")), then it does work.
Please see the corrected code below:

   task tbPassed;
      begin
           begin
              $display("\n                  xx");
              $display("                xxx    _____         _____ _____");
              $display("              xxxx    |  __ \\ /\\    / ____/ ____|");
              $display("            xxxxx     | |__) /  \\  | (___| (___");
              $display("  xxx     xxxxxx      |  ___/ /\\ \\  \\___ \\\\___ \\ "); // This i OK
              $display("  xxxx  xxxxxx        | |  / ____ \\ ____) |___) |");
              $display("    xxxxxxxx          |_| /_/    \\_\\_____/_____/");
              $display("      xxxx");
          end
      end
   endtask

I'm using the Verilog mode version 2023.06.06.141322628 with GNU Emacs 28.2 on Linux (RHEL7).

Activity

  1. changed the title [-]Issue when using `\` before `"`[/-] [+]Issue when using `\` followed by `"`[/+] on Jun 21, 2023
  2. wsnyder commented on Jul 25, 2023

    @wsnyder
    Member

    Thanks for the report. I looked at this and the possible fix would be very slow, so I think until a better fix gets more thought it will need to be worked around as you did.

  3. acr4 commented on Sep 9, 2023

    @acr4
    Contributor

    PR #1840 begins to think about how to solve this. Like @wsnyder said, it's more complex than it looks on the surface. Here's a quick test-case, but by no means an exhaustive one. It just builds on @LapinFou's original text block.

    module m;
    
       always @(/*AS*/) begin
          if(x)
            y = z;
       end
    
       task tbPassed;
          begin
             begin
                $display("\n                  xx");
                $display("                xxx    _____         _____ _____");
                $display("              xxxx    |  __ \\ /\\    / ____/ ____|");
                $display("            xxxxx     | |__) /  \\  | (___| (___");
                $display("  xxx     xxxxxx      |  ___/ /\\ \\  \\___ \\\\___ \\");
                $display("  xxxx  xxxxxx        | |  / ____ \\ ____) |___) |");
                $display("    xxxxxxxx          |_| /_/    \\_\\_____/_____/");
                $display("      xxxx");
             end
          end
       endtask
    
    endmodule // m
    
  4. LapinFou commented on Sep 9, 2023

    @LapinFou
    Author

    Thanks a lot for looking to fix this issue. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions