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

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

[elpa] externals/bnf-mode a7df2dd 17/74: Fontify sequences


From: Stefan Monnier
Subject: [elpa] externals/bnf-mode a7df2dd 17/74: Fontify sequences
Date: Thu, 9 May 2019 08:27:45 -0400 (EDT)

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

    Fontify sequences
---
 bnf-mode.el                | 10 ++++------
 test/bnf-mode-font-test.el | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/bnf-mode.el b/bnf-mode.el
index 32e74ec..12550b4 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -165,16 +165,14 @@ See `rx' documentation for more information about REGEXPS 
param."
                    "::="))
      1 font-lock-function-name-face)
     ;; RHS nonterminals
-    (,(bnf-rx (and "::="
-                   (1+ space)
+    (,(bnf-rx (and (1+ space)
                    "<"
                    (group rulename)
                    ">"))
      1 font-lock-builtin-face)
-     ;; Regarding to RFC5234#2.1 angle brackets
-     ;; (“<”, “>”) for RHS nonterminals are optional.
-     (,(bnf-rx (and "::="
-                   (1+ space)
+    ;; Regarding to RFC5234#2.1 angle brackets
+    ;; (“<”, “>”) for RHS nonterminals are optional.
+    (,(bnf-rx (and (1+ space)
                    (group rulename)))
      1 font-lock-builtin-face)
     ;; “may expand into” symbol
diff --git a/test/bnf-mode-font-test.el b/test/bnf-mode-font-test.el
index 23c5bd9..cfe18d2 100644
--- a/test/bnf-mode-font-test.el
+++ b/test/bnf-mode-font-test.el
@@ -114,6 +114,25 @@ angle-brackets ::= are-optional"
                              (should (eq (bnf-test-face-at 8) 
'font-lock-function-name-face))
                              (should-not (bnf-test-face-at 9))))
 
+(ert-deftest bnf-mode-syntax-table/fontify-sequence ()
+  :tags '(fontification syntax-table)
+  (bnf-test-with-temp-buffer "rule ::= foo bar baz"
+                             ;; “rule”
+                             (should (eq (bnf-test-face-at 1) 
'font-lock-function-name-face))
+                             (should (eq (bnf-test-face-at 4) 
'font-lock-function-name-face))
+                             ;; “foo”
+                             (should (eq (bnf-test-face-at 10) 
'font-lock-builtin-face))
+                             (should (eq (bnf-test-face-at 12) 
'font-lock-builtin-face))
+                             ;; space
+                             (should-not (bnf-test-face-at 13))
+                             ;; “bar”
+                             (should (eq (bnf-test-face-at 14) 
'font-lock-builtin-face))
+                             (should (eq (bnf-test-face-at 16) 
'font-lock-builtin-face))
+                             ;; space
+                             (should-not (bnf-test-face-at 17))
+                             ;; “baz”
+                             (should (eq (bnf-test-face-at 18) 
'font-lock-builtin-face))
+                             (should (eq (bnf-test-face-at 10) 
'font-lock-builtin-face))))
 
 (provide 'bnf-mode-font-test)
 



reply via email to

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