branch: externals/bnf-mode
commit 3beded6594876625283ac11ee0f3a32c9716ec58
Author: Serghei Iakovlev <[email protected]>
Commit: Serghei Iakovlev <[email protected]>
Rule names are case insensitive. Added test.
---
bnf-mode.el | 7 ++++---
test/bnf-mode-font-test.el | 21 ++++++++++++++++++---
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/bnf-mode.el b/bnf-mode.el
index dd3e1c1..dd685ef 100644
--- a/bnf-mode.el
+++ b/bnf-mode.el
@@ -212,9 +212,10 @@ See `rx' documentation for more information about REGEXPS
param."
bnf-font-lock-keywords
;; keywords-only
nil
- ;; Regarding to RFC5234#2.1
- ;; The names <rulename>, <Rulename>, <RULENAME>,
- ;; and <rUlENamE> all refer to the same rule.
+ ;; Regarding to RFC5234#2.1 rule names are case
+ ;; insensitive. The names <rulename>, <Rulename>,
+ ;; <RULENAME>, and <rUlENamE> all refer to the
+ ;; same rule.
t
)))
diff --git a/test/bnf-mode-font-test.el b/test/bnf-mode-font-test.el
index e099d26..2300695 100644
--- a/test/bnf-mode-font-test.el
+++ b/test/bnf-mode-font-test.el
@@ -61,7 +61,8 @@ buffer."
(should (eq (bnf-test-face-at 1)
'font-lock-comment-face))
(should (eq (bnf-test-face-at 3)
'font-lock-comment-face))
(should-not (bnf-test-face-at 5))
- (should (eq (bnf-test-face-at 24)
'font-lock-comment-face))))
+ (should (eq (bnf-test-face-at 24) '
+ font-lock-comment-face))))
(ert-deftest bnf-mode-syntax-table/fontify-nonterminals ()
:tags '(fontification syntax-table)
@@ -75,11 +76,25 @@ buffer."
(should-not (bnf-test-face-at 5))
;; "may expand into" symbol
(should-not (eq (bnf-test-face-at 7)
'font-lock-function-name-face))
+ (should-not (eq (bnf-test-face-at 9)
'font-lock-function-name-face))
;; angle bracket
(should-not (bnf-test-face-at 11))
;; "dec" symbol
- (should-not (eq (bnf-test-face-at 12)
'font-lock-function-name-face))
- (should-not (eq (bnf-test-face-at 15)
'font-lock-function-name-face))))
+ (should (eq (bnf-test-face-at 12)
'font-lock-builtin-face))
+ (should (eq (bnf-test-face-at 15)
'font-lock-builtin-face))))
+
+(ert-deftest bnf-mode-syntax-table/fontify-nonterminals-case ()
+ :tags '(fontification syntax-table)
+ (bnf-test-with-temp-buffer "<RULE> ::= foo
+<RuLe> ::= <foO>"
+ (should (eq (bnf-test-face-at 2)
'font-lock-function-name-face))
+ (should (eq (bnf-test-face-at 5)
'font-lock-function-name-face))
+ (should (eq (bnf-test-face-at 17)
'font-lock-function-name-face))
+ (should (eq (bnf-test-face-at 20)
'font-lock-function-name-face))
+ (should-not (bnf-test-face-at 21))
+ (should (eq (bnf-test-face-at 28)
'font-lock-builtin-face))
+ (should (eq (bnf-test-face-at 30)
'font-lock-builtin-face))
+ (should-not (bnf-test-face-at 31))))
(provide 'bnf-mode-font-test)