The Lispref says:
Emacs supports two comment styles simultaneously in any one syntax
table. This is for the sake of C++. [...]
The two comment-start sequences must begin with the same
character; only the second character may differ.
but this isn't really enforced. A consequence of this is that you can
make xemacs hit an abort() in font-lock.c. An example of this occurs
in some recent version of a sql mode, which tries to support '/*' and
'--' as comment starters (see recipe below for the crash).
The abort() is triggered in find_context(). In Fparse_partial_sexp()
we are not so aggressive and just parse '/-' and '-*' as comments --
this also happens in FSF emacs, which uses Fparse_partial_sexp in
font-lock.
Any suggestions?
Gunnar
crash recipe:
------------------------------
(setq sql-mode-syntax-table
(let ((table (make-syntax-table)))
;; C-style comments /**/ (see elisp manual "Syntax Flags"))
(modify-syntax-entry ?/ ". 14" table)
(modify-syntax-entry ?* ". 23" table)
;; double-dash starts comment
(modify-syntax-entry ?- ". 56" table)
; (modify-syntax-entry ?\n "> b" table)
table)
)
(defun sql-mode ()
"Major mode to edit SQL."
(interactive)
(kill-all-local-variables)
(setq major-mode 'sql-mode)
(setq mode-name "SQL")
(set-syntax-table sql-mode-syntax-table)
)
------------------------------
- evaluate the above
- make a new buffer and switch to sql-mode
- type '-* ' (without the quotes)
- M-: (syntactically-sectionize nil 3 3)
BOOM
--
Gunnar Evermann
Speech, Vision & Robotics Group
Engineering Department
Cambridge University