branch: externals/bnf-mode
commit 1e7e342eacda636623cdb08f16afd5d28ae3b77a
Author: Serghei Iakovlev <[email protected]>
Commit: Serghei Iakovlev <[email protected]>

    Removed support of ALGOL 60 style comments
    
    Actually, this syntax was never part of the BNF and was mistakenly
    interpreted as an alternative way of commenting BNF grammars
    introduced by Peter Naur.
---
 NEWS                            | 14 +++++-------
 bnf-mode.el                     | 47 +++++----------------------------------
 bnf-mode.info                   | 49 ++++++++++++++---------------------------
 bnf-mode.texi                   | 20 ++---------------
 test/test-bnf-mode-font-lock.el |  9 +-------
 5 files changed, 30 insertions(+), 109 deletions(-)

diff --git a/NEWS b/NEWS
index d8a19e9..27cfd78 100644
--- a/NEWS
+++ b/NEWS
@@ -5,21 +5,17 @@ See the end of the file for license conditions.
 
 This file is about changes in BNF Mode.
 
-* Unreleased
+* BNF Mode 0.4.5
 ** Tests were migrated from ert-runner to buttercup.
 Previously BNF Mode used `ert' through `ert-runner' for testing
 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
+** Removed support of ALGOL 60 style comments.
+Actually, this syntax was never part of the BNF and was mistakenly
+interpreted as an alternative way of commenting BNF grammars
+introduced by Peter Naur.
 
 * BNF Mode 0.4.4
 ** Rework documentation and provide Info-file.
diff --git a/bnf-mode.el b/bnf-mode.el
index 1e65905..c4bea7c 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -51,23 +51,6 @@
   :link '(url-link :tag "GitHub Page" "https://github.com/sergeyklay/bnf-mode";)
   :link '(emacs-commentary-link :tag "Commentary" "bnf-mode"))
 
-(defcustom bnf-mode-algol-comments-style nil
-  "Non-nil means use for BNF comments style introduced in ALGOL 60.
-
-For the purpose of including text among the symbols of a program the
-following \"comment\" conventions will hold:
-
-  :------------------------------------------------:------------------:
-  | The sequence of basic symbols:                 | is equivalent to |
-  :------------------------------------------------:------------------:
-  | ; comment <any sequence not containing ;>;     | ;                |
-  | begin comment <any sequence not containing ;>; | begin            |
-  :------------------------------------------------:------------------:
-
-Note: enabling this feature will disable comments recognition, which
-start with semicolons only (\";\")."
-  :type 'boolean)
-
 
 ;;;; Specialized rx
 
@@ -170,22 +153,13 @@ See `rx' documentation for more information about REGEXPS 
param."
     (modify-syntax-entry ?\< "(>" table)
     (modify-syntax-entry ?\> ")<" table)
 
-    ;; Comments setup
-    (unless bnf-mode-algol-comments-style
-      (modify-syntax-entry ?\; "<" table)
-      (modify-syntax-entry ?\n ">" table))
+    ;; Comments are begins with “;” and ends with “\n”
+    (modify-syntax-entry ?\; "<" table)
+    (modify-syntax-entry ?\n ">" table)
 
     table)
   "Syntax table in use in `bnf-mode' buffers.")
 
-(defconst bnf--syntax-propertize
-  (syntax-propertize-rules
-   ;; Fontify comments in ALGOL 60 style.
-   ("\\(?:begin\\s-+\\|;\\s-*\\)\\(comment\\)[^;]*\\(;\\)" (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.")
-
 
 ;;;; Initialization
 
@@ -194,8 +168,6 @@ style.  Will be used only if 
`bnf-mode-algol-comments-style' is set to t.")
   "A major mode for editing BNF grammars.
 
 \\{bnf-mode-map}
-The variable `bnf-mode-algol-comments-style' can be changed to control
-comments style used in grammars.
 
 Turning on BNF Mode calls the value of `prog-mode-hook' and then of
 `bnf-mode-hook', if they are non-nil."
@@ -203,16 +175,9 @@ Turning on BNF Mode calls the value of `prog-mode-hook' 
and then of
 
   ;; Comments setup
   (setq-local comment-use-syntax nil)
-  (if bnf-mode-algol-comments-style
-      (progn
-        (setq-local comment-start "; comment ")
-        (setq-local comment-end ";")
-        (setq-local comment-start-skip "\\(?:\\(\\W\\|^\\)comment\\)\\s-+")
-        (setq-local syntax-propertize-function bnf--syntax-propertize))
-    (progn
-      (setq-local comment-start "; ")
-      (setq-local comment-end "")
-      (setq-local comment-start-skip "\\(?:\\(\\W\\|^\\);+\\)\\s-+")))
+  (setq-local comment-start "; ")
+  (setq-local comment-end "")
+  (setq-local comment-start-skip "\\(?:\\(\\W\\|^\\);+\\)\\s-+")
 
   ;; Font locking
   (setq font-lock-defaults
diff --git a/bnf-mode.info b/bnf-mode.info
index 61b8740..8931d8e 100644
--- a/bnf-mode.info
+++ b/bnf-mode.info
@@ -8,7 +8,7 @@ report.
 
 This manual is for BNF Mode version 0.4.4.
 
-   Copyright © 2019, 2020 Free Software Foundation, Inc.
+   Copyright © 2019-2020 Free Software Foundation, Inc.
 
      Permission is granted to copy, distribute and/or modify this
      document under the terms of the GNU Free Documentation License,
@@ -216,19 +216,7 @@ File: bnf-mode.info,  Node: Customizing,  Next: Project 
Links,  Prev: Usage,  Up
 4 Customizing
 *************
 
-There are not so much customization options yet.  The most interested
-option is ‘bnf-mode-algol-comments-style’.  This variable can be changed
-to control comments style used in grammars.  Setting it to non-nil means
-use for BNF comments style introduced in ALGOL 60.  In this case the
-following "comment" conventions will hold:
-
-The sequence of basic symbols                      Is equivalent to
---------------------------------------------------------------------------
-‘; comment <any sequence not containing ;>;’       ‘;’
-‘begin comment <any sequence not containing ;>;’   ‘begin’
-
-   Note: enabling this feature will disable comments recognition, which
-start with semicolons only (‘;’).
+There are not so much customization options yet.
 
    To customize ‘abbrev-mode’ for ‘bnf-mode’, simple add preffered
 abbreviations to ‘bnf-mode-abbrev-table’.
@@ -338,28 +326,23 @@ File: bnf-mode.info,  Node: Variable Index,  Prev: Index, 
 Up: Top
 Variable Index
 **************
 
-lumnfractions .7 .3
-@headitem The sequence of basic symbols @tab Is equivalent to
-@item @code{; comment <any sequence not containing ;>;}
-@tab @code{;}
-@item @code{begin comment <any sequence not containing ;>;}
-@tab @code{begin}
-@end multitable
-
-Note: enabling this feature will disable comments recognition, which
-start with semicolons only (@code{;}).
+
+There are not so much customization options yet.
 
 To customize @code{abbrev-mode} for @code{bnf-mode}, simple add preffered
 abbreviations to @code{bnf-mode-abbrev-table}.
diff --git a/test/test-bnf-mode-font-lock.el b/test/test-bnf-mode-font-lock.el
index 011e0e5..ca9a929 100644
--- a/test/test-bnf-mode-font-lock.el
+++ b/test/test-bnf-mode-font-lock.el
@@ -51,7 +51,7 @@
             '(("string delimers" function-name "::=" constant "|" warning
                "|" warning "|" warning))))
 
-  (it "fontifies line comments with default comments style"
+  (it "fontifies line comments"
     (expect "; A
      <stm> ::= <decl> ; foo"
             :to-be-fontified-as
@@ -59,13 +59,6 @@
               ("stm" function-name "::=" constant "decl" builtin
                "; foo" comment))))
 
-  (it "fontifies line comments using ALGOL style"
-    (setq-default bnf-mode-algol-comments-style t)
-    (expect "begin comment here ; not comment"
-            :to-be-fontified-as
-            '(("comment" comment ";" comment-delimiter)))
-    (setq-default bnf-mode-algol-comments-style nil))
-
   (it "does not mix terminals and nonterminals"
     (expect "<stm> ::= <decl>
      angle-brackets ::= are-optional"

Reply via email to