branch: externals/bnf-mode
commit 5856e25c6873ac1d963c0af7fb354bbe61ce1a41
Author: Serghei Iakovlev <[email protected]>
Commit: Serghei Iakovlev <[email protected]>
Fixed comments recognition in ALGOL 60 style
---
NEWS | 9 +++++++++
bnf-mode.el | 3 ++-
test/test-bnf-mode-font-lock.el | 4 ++--
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index fb9d9fe..d8a19e9 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,15 @@ purposes. However, it seems `ert-runner' is semi-abandoned.
Thus,
tests were migrated to use more aggressively maintained test
framework calles `buttercup'.
+** Fixed comments recognition in ALGOL 60 style.
+Now, when `bnf-mode-algol-comments-style' is set to non-nil value
+the following line:
+ “begin comment Some text; Not a comment”
+will be correctly fontified as follows:
+ - “begin”: N/A
+ - “comment Some text;”: comment
+ - “Not a comment”: N/A
+
* BNF Mode 0.4.4
** Rework documentation and provide Info-file.
Previous releases of BNF Mode were bundled with incorrect “dir” file
diff --git a/bnf-mode.el b/bnf-mode.el
index 56b2be3..e67ec27 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -187,7 +187,8 @@ See `rx' documentation for more information about REGEXPS
param."
(defconst bnf--syntax-propertize
(syntax-propertize-rules
;; Fontify comments in ALGOL 60 style.
- ("\\(?:begin\\s-+\\|;\\s-*\\)\\(comment\\)\\(;\\|\\s-+[^;]*;\\)" (1 "<")))
+ ("\\(?:begin\\s-+\\|;\\s-*\\)\\(comment\\)\\(;\\)" (1 "<") (2 ">"))
+ ("\\(?:begin\\s-+\\|;\\s-*\\)\\(comment\\)\\s-+[^;]*\\(;\\)" (1 "<") (2
">")))
"Apply syntax table properties to special constructs.
Provide a macro to apply syntax table properties to comments in ALGOL 60
style. Will be used only if `bnf-mode-algol-comments-style' is set to t.")
diff --git a/test/test-bnf-mode-font-lock.el b/test/test-bnf-mode-font-lock.el
index f4d677e..011e0e5 100644
--- a/test/test-bnf-mode-font-lock.el
+++ b/test/test-bnf-mode-font-lock.el
@@ -61,9 +61,9 @@
(it "fontifies line comments using ALGOL style"
(setq-default bnf-mode-algol-comments-style t)
- (expect "; comment here"
+ (expect "begin comment here ; not comment"
:to-be-fontified-as
- '(("; comment here" comment)))
+ '(("comment" comment ";" comment-delimiter)))
(setq-default bnf-mode-algol-comments-style nil))
(it "does not mix terminals and nonterminals"