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

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

[elpa] externals/bnf-mode 3e48f65 27/74: BNF has no strings. Treat ' and


From: Stefan Monnier
Subject: [elpa] externals/bnf-mode 3e48f65 27/74: BNF has no strings. Treat ' and " as a symbols
Date: Thu, 9 May 2019 08:27:47 -0400 (EDT)

branch: externals/bnf-mode
commit 3e48f6520f5a1ec4bbb324a72adc2741ad16f24b
Author: Serghei Iakovlev <address@hidden>
Commit: Serghei Iakovlev <address@hidden>

    BNF has no strings. Treat ' and " as a symbols
---
 CHANGELOG.org              |  3 +++
 bnf-mode.el                | 10 ++++++----
 test/bnf-mode-font-test.el |  8 ++++++--
 test/test-helper.el        |  2 +-
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index c2fcffb..fb0f271 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.1...HEAD][Unreleased]]
+*** Fixed
+- Original BNF has no strings so treat ~'~ and ~"~ as a symbols
+
 ** [[https://github.com/sergeyklay/bnf-mode/compare/0.3.0...0.3.1][0.3.1]] - 
2019-03-17
 *** Fixed
 - Fixed BNF rule name definition to follow 
[[https://www.masswerk.at/algol60/report.htm][ALGOL 60 report]]
diff --git a/bnf-mode.el b/bnf-mode.el
index f078872..1c41ea0 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -4,7 +4,7 @@
 
 ;; Author: Serghei Iakovlev (concat "sadhooklay" "@" "gmail" ".com")
 ;; Maintainer: Serghei Iakovlev
-;; Version: 0.3.1
+;; Version: 0.3.2
 ;; URL: https://github.com/sergeyklay/bnf-mode
 ;; Keywords: languages
 ;; Package-Requires: ((cl-lib "0.5") (pkg-info "0.4") (emacs "24.3"))
@@ -187,9 +187,7 @@ See `rx' documentation for more information about REGEXPS 
param."
   (let ((table (make-syntax-table)))
     ;; Give CR the same syntax as newline
     (modify-syntax-entry ?\^m "> b" table)
-    ;; Characters used to delimit string constants
-    (modify-syntax-entry ?\"  "\""  table)
-    ;; Comments setup (see RFC822#2.8)
+    ;; Comments setup
     (modify-syntax-entry ?\;  "<"   table)
     (modify-syntax-entry ?\n  ">"   table)
     ;; Treat ::= as sequence of symbols
@@ -197,6 +195,10 @@ See `rx' documentation for more information about REGEXPS 
param."
     (modify-syntax-entry ?\=  "_"   table)
     ;; Treat | as a symbol
     (modify-syntax-entry ?\|  "_"   table)
+    ;; BNF has no strings so treat ' and "
+    ;; as a symbols
+    (modify-syntax-entry ?\"  "_"  table)
+    (modify-syntax-entry ?\'  "_"  table)
     ;; Group angle brackets
     (modify-syntax-entry ?\<  "(>"  table)
     (modify-syntax-entry ?\>  ")<"  table)
diff --git a/test/bnf-mode-font-test.el b/test/bnf-mode-font-test.el
index 727e147..02f1ac7 100644
--- a/test/bnf-mode-font-test.el
+++ b/test/bnf-mode-font-test.el
@@ -4,7 +4,7 @@
 
 ;; Author: Serghei Iakovlev (concat "sadhooklay" "@" "gmail" ".com")
 ;; Maintainer: Serghei Iakovlev
-;; Version: 0.3.1
+;; Version: 0.3.2
 ;; URL: https://github.com/sergeyklay/bnf-mode
 
 ;; This file is not part of GNU Emacs.
@@ -38,7 +38,11 @@
 
 (ert-deftest bnf-mode-syntax-table/fontify-strings ()
   :tags '(fontification syntax-table)
-  (should (eq (bnf-test-face-at 11 "<foo> ::= \"bar\"") 
'font-lock-string-face)))
+  (bnf-test-with-temp-buffer "<string delimers> ::= \" | ' | ` | ”"
+                             (should-not (bnf-test-face-at 23))
+                             (should-not (bnf-test-face-at 27))
+                             (should-not (bnf-test-face-at 31))
+                             (should-not (bnf-test-face-at 35))))
 
 (ert-deftest bnf-mode-syntax-table/fontify-line-comment ()
   :tags '(fontification syntax-table)
diff --git a/test/test-helper.el b/test/test-helper.el
index 6227629..6480f75 100644
--- a/test/test-helper.el
+++ b/test/test-helper.el
@@ -4,7 +4,7 @@
 
 ;; Author: Serghei Iakovlev (concat "sadhooklay" "@" "gmail" ".com")
 ;; Maintainer: Serghei Iakovlev
-;; Version: 0.3.1
+;; Version: 0.3.2
 ;; URL: https://github.com/sergeyklay/bnf-mode
 
 ;; This file is not part of GNU Emacs.



reply via email to

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