branch: elpa/dart-mode
commit 3082066d93ca9177fa42404cc50e98ddd6d56bf6
Author: Brady Trainor <[email protected]>
Commit: Brady Trainor <[email protected]>
Don't font lock anchor in a string
---
dart-mode.el | 5 +++--
test/test.el | 9 +++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dart-mode.el b/dart-mode.el
index 445ee00..bdd8b2f 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -334,9 +334,10 @@ For example, \"height\" in \"const int height\" would be
matched."
'("bool" "double" "dynamic" "int" "num" "void"
"var"
"get" "set")))
- (set-match-data (list beg end))
(goto-char end)
- (throw 'result t))
+ (unless (nth 3 (syntax-ppss))
+ (set-match-data (list beg end))
+ (throw 'result t)))
(goto-char (match-end 1)))
(throw 'result nil))))
diff --git a/test/test.el b/test/test.el
index a6e1c84..d37bda1 100644
--- a/test/test.el
+++ b/test/test.el
@@ -34,3 +34,12 @@
(ert-deftest dart-font-lock-named-constructors-test ()
:expected-result :failed
(should (dart-font-lock-test-apps "faceup/issues/named-constructors.dart")))
+
+(defun dart-font-lock-test (faceup)
+ (faceup-test-font-lock-string 'dart-mode faceup))
+(faceup-defexplainer dart-font-lock-test)
+
+(ert-deftest dart-font-lock-declared-identifier-anchors ()
+ "Simple Dart font-lock tests."
+ (should (dart-font-lock-test "«k:var» «v:a», «v:b»;"))
+ (should (dart-font-lock-test "group(«s:\"WordCount: Ignore special
characters - \"», ignoreSpecialCharacters);")))