I am trying to understand why SQL mode accepts -* as a comment block start.
In sql.el, I read:
(defvar sql-mode-syntax-table
(let ((table (make-syntax-table)))
;; C-style comments /**/ ...
(modify-syntax-entry ?/ ". 14" table)
(modify-syntax-entry ?* ". 23" table)
;; double-dash starts comments
(modify-syntax-entry ?- ". 12b" table)
;;...
table) "...")
Elisp manual "Syntax Flags" describes the flags for comment sequences. The digits indeed say -* is a two-character comment-start sequence: 1 makes - the start and 2 makes * the second character.
But b is a comment style flag, separating -- from /* and */, which have the default (a) style. This sounds like -* should not count as a comment-start:
‘b’ means that ‘-’ as a comment delimiter belongs to the alternative “b” comment style. For a two-character comment starter, this flag is only significant on the second char, and for a 2-character comment ender it is only significant on the first char.
However:
Each comment delimiter has a style and only matches comment delimiters of the same style. Thus if a comment starts with the comment-start sequence of style “b”, it will extend until the next matching comment-end sequence of style “b”.
So it turns out that the style flag only regulates which characters will end the comment block. Not which characters can be used together in a two-character comment sequence!
Am I right that this is why -* starts a comment block?