emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/bnf-mode 5856e25 29/36: Fixed comments recognition in A


From: Stefan Monnier
Subject: [elpa] externals/bnf-mode 5856e25 29/36: Fixed comments recognition in ALGOL 60 style
Date: Wed, 17 Mar 2021 18:40:19 -0400 (EDT)

branch: externals/bnf-mode
commit 5856e25c6873ac1d963c0af7fb354bbe61ce1a41
Author: Serghei Iakovlev <egrep@protonmail.ch>
Commit: Serghei Iakovlev <egrep@protonmail.ch>

    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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]