home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / lucidem / help / 815 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  2.3 KB

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