[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bnf-mode 7c98cc9 66/74: Fixed misspelling, updated chan
From: |
Stefan Monnier |
Subject: |
[elpa] externals/bnf-mode 7c98cc9 66/74: Fixed misspelling, updated change log |
Date: |
Thu, 9 May 2019 08:27:54 -0400 (EDT) |
branch: externals/bnf-mode
commit 7c98cc9edb9dba80309f8ce3ceadf3f3e51f4c7e
Author: Serghei Iakovlev <address@hidden>
Commit: Serghei Iakovlev <address@hidden>
Fixed misspelling, updated change log
---
CHANGELOG.org | 11 ++++++++--
bnf-mode.el | 54 ++++++++++++++++------------------------------
test/bnf-mode-font-test.el | 27 +++++++----------------
test/test-helper.el | 1 +
4 files changed, 36 insertions(+), 57 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 3375510..af429f1 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -6,6 +6,13 @@ 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.4.1...HEAD][Unreleased]]
+*** Added
+- Introduce ALGOL 60 comments style
[[https://github.com/sergeyklay/bnf-mode/pull/4][#4]]
+
+*** Changed
+- Only setting =bnf-mode-algol-comments-style= to non-nil will allow use
+ semicolons as a regular terminal symbols
+
** [[https://github.com/sergeyklay/bnf-mode/compare/0.4.0...0.4.1][0.4.1]] -
2019-04-21
*** Fixes
- Minor fix related to build & deploy BNF Mode on Travis CI
@@ -21,7 +28,7 @@ The format is based on [[http://keepachangelog.com][Keep a
Changelog]] and this
** [[https://github.com/sergeyklay/bnf-mode/compare/0.3.1...0.3.2][0.3.2]] -
2019-03-24
*** Changed
-- Publish package on MELPA
[[https://github.com/melpa/melpa/pull/6074][(melpa/melpa#6074)]]
+- Published package on MELPA
[[https://github.com/melpa/melpa/pull/6074][(melpa/melpa#6074)]]
*** Fixed
- In the BNF there are no strings thus treat ' and " as a regular symbols
@@ -29,7 +36,7 @@ The format is based on [[http://keepachangelog.com][Keep a
Changelog]] and this
- In the BNF there are no grouping brackets except angle ones. Fixed
*** Removed
-- Removing the ~bnf-mode-version~ function. Users can easily call
~describe-package~
+- Removed the ~bnf-mode-version~ function. Users can easily call
~describe-package~
or ~pkg-info-package-version~ interactively if they want to get this
information [[https://github.com/sergeyklay/bnf-mode/issues/1][(#1)]]
** [[https://github.com/sergeyklay/bnf-mode/compare/0.3.0...0.3.1][0.3.1]] -
2019-03-17
diff --git a/bnf-mode.el b/bnf-mode.el
index a16739f..8b24758 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -84,11 +84,11 @@
:type 'hook
:group 'bnf)
-(defcustom bnf-mode-algol-commets-style nil
+(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:
+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 |
@@ -97,7 +97,8 @@ For the purpose of including text among the symbols of a
program the following
| begin comment <any sequence not containing ;>; | begin |
:------------------------------------------------:------------------:
-Note: Enabling this feature disables ABNF/EBN comments style (just \";\")."
+Note: Enabling this feature will disable comments recognition which use
+semicolon only (\";\")."
:group 'bnf
:type 'boolean)
@@ -204,7 +205,7 @@ See `rx' documentation for more information about REGEXPS
param."
(modify-syntax-entry ?\> ")<" table)
;; Comments setup
- (if bnf-mode-algol-commets-style
+ (if bnf-mode-algol-comments-style
(modify-syntax-entry ?\; ">" table)
(progn
(modify-syntax-entry ?\; "<" table)
@@ -213,31 +214,16 @@ See `rx' documentation for more information about REGEXPS
param."
table)
"Syntax table in use in `bnf-mode' buffers.")
-(defun bnf--bnf-syntax-propertize-function (start end)
- "Apply syntax table properties to special constructs in region START to END.
-Currently handled:
-
- - Fontify terminals with ';' character correctly"
- (save-excursion
- (goto-char start)
- ;; Search for terminals like "<abc;>" or "<a;bc>".
- ;; Does not work for terminals like "<a;bc;>".
- (while (re-search-forward "\\(?:<[^>]*\\);" end t)
- (when (looking-at "\\(?:[^>]\\)*>")
- ;; Mark the ";" character as an extra character used in terminals
- ;; along with word constituents.
- (put-text-property (1- (point)) (point)
- 'syntax-table (string-to-syntax "_"))))))
-
-
-;;; Initialization
-
-(defconst bnf--bnf-syntax-propertize-macro
+(defconst bnf--syntax-propertize
(syntax-propertize-rules
+ ;; Fontify comments in ALGOL 60 style.
("\\(?:begin\\s-+\\|;\\s-*\\)\\(comment\\)\\(;\\|\\s-+[^;]*;\\)" (1 "<")))
- "Fontify comments in ALGOL 60 style.
+ "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-commets-style' is set to t")
+Will be used only if `bnf-mode-algol-comments-style' is set to t")
+
+
+;;; Initialization
;;;###autoload
(define-derived-mode bnf-mode prog-mode "BNF"
@@ -247,19 +233,16 @@ Will be used only if `bnf-mode-algol-commets-style' is
set to t")
;; Comments setup
(setq-local comment-use-syntax nil)
- (if bnf-mode-algol-commets-style
+ (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--bnf-syntax-propertize-macro))
+ (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 syntax-propertize-function
- #'bnf--bnf-syntax-propertize-function)))
+ (setq-local comment-start-skip "\\(?:\\(\\W\\|^\\);+\\)\\s-+")))
;; Basically `syntax-propertize-function' is a construct which belongs
;; to `font-lock'. But correct indentation depends on
@@ -273,9 +256,8 @@ Will be used only if `bnf-mode-algol-commets-style' is set
to t")
;; To patch our way around this, we issue a `syntax-propertize' call
;; manually, `font-lock' enabled or not.
(with-silent-modifications
- (if bnf-mode-algol-commets-style
- (funcall syntax-propertize-function (point-min) (point-max))
- (bnf--bnf-syntax-propertize-function (point-min) (point-max))))
+ (when bnf-mode-algol-comments-style
+ (funcall syntax-propertize-function (point-min) (point-max))))
;; Font locking
(setq font-lock-defaults
diff --git a/test/bnf-mode-font-test.el b/test/bnf-mode-font-test.el
index 5ac0179..0d1ade0 100644
--- a/test/bnf-mode-font-test.el
+++ b/test/bnf-mode-font-test.el
@@ -45,8 +45,9 @@
(should-not (bnf-test-face-at 31))
(should-not (bnf-test-face-at 35))))
-(ert-deftest bnf-mode-syntax-table/fontify-line-comment ()
+(ert-deftest bnf-mode-syntax-table/fontify-line-comments ()
:tags '(fontification syntax-table)
+ (custom-set-variables '(bnf-mode-algol-comments-style nil))
(bnf-test-with-temp-buffer
"; A
@@ -56,6 +57,12 @@
(should-not (bnf-test-face-at 5))
(should (eq (bnf-test-face-at 24) 'font-lock-comment-face))))
+;; TODO
+(ert-deftest bnf-mode-syntax-table/fontify-algol-comments ()
+ :tags '(fontification syntax-table)
+ (custom-set-variables '(bnf-mode-algol-comments-style t))
+ (bnf-test-with-temp-buffer "" ))
+
(ert-deftest bnf-mode-syntax-table/fontify-nonterminals ()
:tags '(fontification syntax-table)
(bnf-test-with-temp-buffer
@@ -163,23 +170,5 @@ angle-brackets ::= are-optional"
(should (eq (bnf-test-face-at 90) 'font-lock-builtin-face))
(should (eq (bnf-test-face-at 94) 'font-lock-builtin-face))))
-(ert-deftest bnf-mode-syntax-table/fontify-dotcomma-inside-rule ()
- :tags '(fontification syntax-table)
- (bnf-test-with-temp-buffer
- "<a rule> ::= <abc;>
-; <foo> ::= <bar>
-<a> ::= <ab;c>"
- ;; "abc;"
- (should (eq (bnf-test-face-at 16) 'font-lock-builtin-face))
- (should (eq (bnf-test-face-at 18) 'font-lock-builtin-face))
- ;; "; <foo> ::= <bar>"
- (should (eq (bnf-test-face-at 22) 'font-lock-comment-delimiter-face))
- (should (eq (bnf-test-face-at 22) 'font-lock-comment-delimiter-face))
- (should (eq (bnf-test-face-at 23) 'font-lock-comment-face))
- (should (eq (bnf-test-face-at 37) 'font-lock-comment-face))
- ;; "ab;c"
- (should (eq (bnf-test-face-at 48) 'font-lock-builtin-face))
- (should (eq (bnf-test-face-at 51) 'font-lock-builtin-face))))
-
(provide 'bnf-mode-font-test)
;;; bnf-mode-font-test.el ends here
diff --git a/test/test-helper.el b/test/test-helper.el
index a8db9f6..c1524f7 100644
--- a/test/test-helper.el
+++ b/test/test-helper.el
@@ -57,6 +57,7 @@
,(if (fboundp 'font-lock-ensure)
'(font-lock-ensure)
'(with-no-warnings (font-lock-fontify-buffer)))
+
(goto-char (point-min))
,@body))
- [elpa] externals/bnf-mode 7bbf329 49/74: Added comment-start-skip to help comment commands recognize comments, (continued)
- [elpa] externals/bnf-mode 7bbf329 49/74: Added comment-start-skip to help comment commands recognize comments, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 00a0543 50/74: Removed not used tests macro, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 6eb06a8 52/74: Make tests easier to read, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 273eabd 31/74: Correct change log formatting (II) [ci skip], Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 687ee9e 16/74: Angle brackets to use for nonterminals are optional. Changed, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 83f0e0f 28/74: Code cleanup, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 96c6e76 61/74: Changed CI deploy token [ci skip], Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 8dabc6c 63/74: Minor correction to the change log format, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode e898672 73/74: Removed no longer needed local variables, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode f95ec5f 69/74: Improved preparing package, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 7c98cc9 66/74: Fixed misspelling, updated change log,
Stefan Monnier <=
- [elpa] externals/bnf-mode ce5005e 57/74: Install missed dependency on Travis CI, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode f00384e 10/74: Change comment syntax, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 7240455 38/74: Improved test reporting, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 6ce1208 33/74: We're on MELPA. Yay!, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode e5f56ca 35/74: Amended documentation, update change log, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode ac004f6 34/74: Removed the bnf-mode-version function, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 89660ba 44/74: Removing emacs26-el package solves "Recursive load" issue, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode c836c7c 19/74: Temporarily removed ABNF, amended tests, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode 5b6ff92 41/74: Update copyright, Stefan Monnier, 2019/05/09
- [elpa] externals/bnf-mode e9a5e4a 45/74: Return back comment-start and comment-end, Stefan Monnier, 2019/05/09