#36 Patch to fix bug number 1111214 (verilog comment problem)


This patch fixes a problem observed with exuberant
ctags 5.5.4, parsing multi-line comments,
i.e. /* ... */

My fix is in the verilog parser file only: If the
same bug applies to other languages (as I suspect it
might), it may be necessary to replicate this fix to
other parsers.

The problem is that if the last character of a multi-
line comment, immediately before the closing */
delimiter happens to be an asterisk (or any even-
number of consecutive asterisks), then the parser
mistakenly thinks that the comment has not ended.

It's easier to understand with an example. See
attached file example.v

I have attached a patch file showing the very minor
change that it took to fix the problem. (patch.txt)

The root cause is obvious by looking at the patch

Derek Sherlock

- Patch file is attached.
- Example test file demonstrating the problem,
follows inline below:

// File example.v
// Below is an example of a comment that
// is mis-parsed by
// exuberant ctags.
// It uses the multi-line comment
// format, i.e. /* ... */
// except that in this case, the
// character sequence immediately
// preceeding the closing delimiter is
// an asterisk. (Any even
// number of asterisks would have the
// same problem.
// The line immediately afterwards
// is used to demonstrate the problem.
// the module name 'wahoo' isn't recognised,
// because the parser mistakenly
// thinks we are still in a multi-line comment.
// Try running:
// ctags -x example.v
// with and without my proposed fix,
// to see the difference.
* I am a multi-line comment
* I happen to end in a strange
* (but legal) way: **/

module wahoo ()


  • Derek Sherlock

    Derek Sherlock - 2006-03-24

    Patch to fix parsing of /../ comments

  • Derek Sherlock

    Derek Sherlock - 2006-03-28

    Logged In: YES

    3/28/06 Derek Sherlock: This patch fixes bug number

  • Derek Sherlock

    Derek Sherlock - 2006-03-28
    • summary: Patch to fix misparsing of / .. / comments --> Patch to fix bug number 1111214 (verilog comment problem)
  • Elliott Hughes

    Elliott Hughes - 2006-09-24

    Logged In: YES

    i agree with the submitter that this is a bug in the verilog parser. the other C-
    like languages are okay, though. i wonder if a better fix would be for the verilog
    parser to use skipOverCComment from "get.c"?

  • Elliott Hughes

    Elliott Hughes - 2007-05-27

    Logged In: YES
    Originator: NO

    i've committed a fix to use skipOverCComment, so we only have the C-style block comment logic in one place. that fixes the example here, the example in bug #960316, the example in bug #1111214, .

    there's no examples in bugs #1606569 and #1615060, but they appear to be the same bug.

  • Elliott Hughes

    Elliott Hughes - 2007-05-27
    • assigned_to: nobody --> elliotth
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks