branch: elpa/yaml-mode
commit ed7ec2e83c0e0123c72a4699ae9a9656d521e284
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Don't freeze on unclosed strings
---
test-files/test-quotes-in-strings.yaml | 1 +
yaml-mode.el | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/test-files/test-quotes-in-strings.yaml
b/test-files/test-quotes-in-strings.yaml
index 5859bbd..07137a9 100644
--- a/test-files/test-quotes-in-strings.yaml
+++ b/test-files/test-quotes-in-strings.yaml
@@ -3,3 +3,4 @@ some's'strings'some's'nots:
- this: 'is a string with "quotes"'
- and: 'to express one single quote, use '' two of them'
- finally: syntax is not string
+- singlequotedoesntfreeze: '
diff --git a/yaml-mode.el b/yaml-mode.el
index 66e41b3..6bd4000 100644
--- a/yaml-mode.el
+++ b/yaml-mode.el
@@ -284,7 +284,10 @@ that key is pressed to begin a block literal."
;; We're right after a quote that opens a string literal.
;; Skip over it (big speedup for long JSON strings).
(goto-char (1- pt))
- (ignore-errors (forward-sexp)))))))))
+ (condition-case nil
+ (forward-sexp)
+ (scan-error
+ (goto-char end))))))))))
(defun yaml-font-lock-block-literals (bound)
"Find lines within block literals.