home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!rphroy!kocrsv01!c23mts
- From: c23mts@kocrsv01.delcoelect.com (Mike Scheidler)
- Newsgroups: alt.lucid-emacs.help
- Subject: Re: Need help with lhilit regular expression
- Keywords: lhilit
- Message-ID: <1992Dec21.133035.2118@kocrsv01.delcoelect.com>
- Date: 21 Dec 92 13:30:35 GMT
- References: <50683@shamash.cdc.com>
- Sender: news@kocrsv01.delcoelect.com (Usenet News Account)
- Reply-To: c23mts@kocrsv01.delcoelect.com
- Distribution: usa
- Organization: Delco Electronics Corp.
- Lines: 41
- Originator: c23mts@kocrsw12
-
-
- In article <50683@shamash.cdc.com>, bjdunlop@shamash.cdc.com (Bruce Dunlop) writes:
- > I am trying to make lhilit handle verilog comments. One comment syntax
- > is //, which indicates a comment from the current column to the end of
- > the current line. The other comment syntax is like C, /* ...*/.
- >
- > I got the // hilit to work fine, but the /* ... */ hilit that I copied
- > from the c-mode has a problem with comments like:
- > //*********************
- > which we use to separate sections of code. The // makes it a one line
- > comment in verilog, but the /* makes it look like a block comment to lhilit.
- > But there is no matching */, so lhilit gets stuck until I do a ^G abort.
- >
- > Is there a way to make lhilit not interpret //* as the beginning of a block
- > comment?
-
- I don't do c++, so I don't know if this is a viable solution, but you could
- modify the regexp pattern for /* .. */ comments from
-
- ("/\\*" "\\*/" hilit0)
- to
- ("[ \t\n]/\\*" "\\*/" hilit0)
- ^^^^^^^
- which would match a '/*' token only if it is preceded by a space, tab, or
- newline character. This would definitely keep it from matching the '//*'
- sequence, but would require that comments beginning with '/*' either start
- at the beginning of a line or be preceded by at least one space or tab.
- Under most circumstances, I think this restriction shouldn't be a problem.
- About the only thing I can think of that wouldn't match would be something
- like this
-
- int a;/* this is a comment */
-
- where it would be easy (and more readable) to insert a space before the
- comment.
-
- --
- Mike Scheidler INTERNET: c23mts@kocrsv01.delcoelect.com
- Software Technology UUCP: deaes!c23mts
- Delco Electronics Corporation PHONE: (317) 451-0642
- Kokomo, IN 46904 GMNET: 8-322-0642
-