branch: externals/bnf-mode
commit 7bbf32931b2f93401e919a6aa19499a7b530599c
Author: Serghei Iakovlev <[email protected]>
Commit: Serghei Iakovlev <[email protected]>
Added comment-start-skip to help comment commands recognize comments
---
CHANGELOG.org | 3 +++
bnf-mode.el | 5 +++--
test/bnf-mode-font-test.el | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 5b50aec..07c06f0 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -6,6 +6,9 @@ All notable changes to this project will be documented in this
file.
The format is based on [[http://keepachangelog.com][Keep a Changelog]] and
this project adheres to [[http://semver.org][Semantic Versioning]].
** [[https://github.com/sergeyklay/bnf-mode/compare/0.3.2...HEAD][Unreleased]]
+*** Added
+- Added =comment-start-skip= to help comment commands recognize comments
+
*** Changed
- Return back =comment-start= and =comment-end= removed in
[[https://github.com/sergeyklay/bnf-mode/commit/83f0e0fc144e453bcce459d2d655a7b48e77953e][83f0e0f]]
diff --git a/bnf-mode.el b/bnf-mode.el
index edf36b2..232b6c4 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -168,11 +168,11 @@ See `rx' documentation for more information about REGEXPS
param."
(modify-syntax-entry ?\= "_" table)
;; Treat | as a symbol
(modify-syntax-entry ?\| "_" table)
- ;; In the BNF there are no strings
+ ;; In BNF there are no strings
;; so treat ' and " as a symbols
(modify-syntax-entry ?\" "_" table)
(modify-syntax-entry ?\' "_" table)
- ;; In the BNF there are no grouping
+ ;; In BNF there are no grouping
;; brackets except angle ones
(modify-syntax-entry ?\( "_" table)
(modify-syntax-entry ?\) "_" table)
@@ -195,6 +195,7 @@ See `rx' documentation for more information about REGEXPS
param."
(setq-local comment-use-syntax nil)
(setq-local comment-start "; ")
(setq-local comment-end "")
+ (setq-local comment-start-skip "\\(?:\\(\\W\\|^\\);+\\)\\s-*")
;; Font locking
(setq font-lock-defaults
'(
diff --git a/test/bnf-mode-font-test.el b/test/bnf-mode-font-test.el
index 18335d7..ff4aa09 100644
--- a/test/bnf-mode-font-test.el
+++ b/test/bnf-mode-font-test.el
@@ -49,7 +49,7 @@
(bnf-test-with-temp-buffer "; A
<stm> ::= <decl> ; foo"
- (should (eq (bnf-test-face-at 1)
'font-lock-comment-face))
+ (should (eq (bnf-test-face-at 1)
'font-lock-comment-delimiter-face))
(should (eq (bnf-test-face-at 3)
'font-lock-comment-face))
(should-not (bnf-test-face-at 5))
(should (eq (bnf-test-face-at 24)
'font-lock-comment-face))))