branch: elpa/gnuplot
commit 84933f0f91212b3a26c6849d82d93bd95a1b1618
Author: Jonathan Oddie <[email protected]>
Commit: Jonathan Oddie <[email protected]>
Allow single quoted strings to include '' as an escape for '
---
gnuplot.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/gnuplot.el b/gnuplot.el
index dc6458b..ff84156 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -1655,8 +1655,8 @@ These are highlighted using `font-lock-reference-face'.")
;; backslash to escape the newline
;;
;; - double quoted strings can contain escaped quotes \" and escaped
-;; backslashes \\, but there's no way to quote the delimiter in
-;; single quoted strings
+;; backslashes \\, while single quotes can escape the quote by
+;; doubling '' and backslash is not special (except at eol)
;;
;; - strings can end at newline without needing a closing delimiter
;;
@@ -1701,7 +1701,7 @@ string was found, otherwise nil."
(end-at-eob-p nil)
(re
(cond ((string= opener "#") nil)
- ((string= opener "'") "'")
+ ((string= opener "'") "''?")
((string= opener "\"") "\\\\\"\\|\\\\\\\\\\|\""))))
(while (not end)
(if (and (not (eobp)) (bolp) (eolp)) ; Empty continuation line:
@@ -1712,8 +1712,10 @@ string was found, otherwise nil."
(if end
(when (and re
- (or (string= (match-string 0) "\\\"")
- (string= (match-string 0) "\\\\")))
+ (let ((m (match-string 0)))
+ (or (string= m "\\\"")
+ (string= m "\\\\")
+ (string= m "''"))))
(setq end nil)) ; Skip over escapes and look again
;; We got to EOL without finding an ending delimiter