[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode 867922d61e 112/153: Handle string literals more
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode 867922d61e 112/153: Handle string literals more correctly |
Date: |
Sat, 29 Jan 2022 08:02:23 -0500 (EST) |
branch: elpa/forth-mode
commit 867922d61e362b7f46cc3380d862ede346073469
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Helmut Eller <eller.helmut@gmail.com>
Handle string literals more correctly
* test/tests.el (forth-string-font-lock): Add tests.
* forth-syntax.el (forth-syntax--state-string): Use "generic string
delimitier" "|" so that we can match \" with \n.
(forth-syntax--state-s\\\"): Escape \\ and \" sequence.
---
forth-syntax.el | 10 +++++-----
test/tests.el | 9 ++++++++-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/forth-syntax.el b/forth-syntax.el
index 4c6e02a25b..1aee67f6f0 100644
--- a/forth-syntax.el
+++ b/forth-syntax.el
@@ -58,10 +58,10 @@ SYNTAX must be a valid argument for `string-to-syntax'."
;; One line strings
(defun forth-syntax--state-string ()
(re-search-backward "\"\\=")
- (forth-syntax--set-syntax (point) (1+ (point)) "\"")
+ (forth-syntax--set-syntax (point) (1+ (point)) "|")
(forward-char)
(cond ((re-search-forward "[\"\n]" nil t)
- (forth-syntax--set-syntax (1- (point)) (point) "\"")
+ (forth-syntax--set-syntax (1- (point)) (point) "|")
#'forth-syntax--state-normal)
(t
(goto-char (point-max))
@@ -69,16 +69,16 @@ SYNTAX must be a valid argument for `string-to-syntax'."
(defun forth-syntax--state-s\\\" ()
(re-search-backward "\"\\=")
- (forth-syntax--set-syntax (point) (1+ (point)) "\"")
+ (forth-syntax--set-syntax (point) (1+ (point)) "|")
(forward-char)
- (while (and (re-search-forward "\\([\"\n]\\|\\\\\"\\)" nil t)
+ (while (and (re-search-forward "\\([\"\n]\\|\\\\\\\\\\|\\\\\"\\)" nil t)
(cond ((= (char-after (match-beginning 0)) ?\\)
(forth-syntax--set-syntax (match-beginning 0)
(1+ (match-beginning 0))
"\\")
t))))
(cond ((looking-back "[\"\n]" 1)
- (forth-syntax--set-syntax (1- (point)) (point) "\"")
+ (forth-syntax--set-syntax (1- (point)) (point) "|")
#'forth-syntax--state-normal)
(t
(goto-char (point-max))
diff --git a/test/tests.el b/test/tests.el
index 3822334861..75ab802ec1 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -104,11 +104,18 @@ The whitespace before and including \"|\" on each line is
removed."
(forth-assert-face "c\" ab\"" 2 font-lock-string-face)
(forth-assert-face "[char] \" of" 10 nil)
(forth-assert-face "frob\" ab\" " 6 nil)
+ (forth-assert-face "s\" 4 \n 8 " 4 font-lock-string-face)
+ (forth-assert-face "s\" 4 \n 8 " 8 nil)
(forth-assert-face "s\\\" ab\"" 1 nil)
(forth-assert-face "s\\\" ab\"" 3 font-lock-string-face)
(forth-assert-face "s\\\" ab\"" 6 font-lock-string-face)
(forth-assert-face "s\\\" a\\\"c\"" 7 font-lock-string-face)
- (forth-assert-face "s\\\" a\\\"c\" x" 10 nil))
+ (forth-assert-face "s\\\" \\\\ 7 \" 12" 7 font-lock-string-face)
+ (forth-assert-face "s\\\" \\\\ 7 \" 12" 12 nil)
+ (forth-assert-face "s\\\" \\\" 7 \" 12" 7 font-lock-string-face)
+ (forth-assert-face "s\\\" \\\" 7 \" 12" 12 nil)
+ (forth-assert-face "s\\\" 5 \n 9 " 4 font-lock-string-face)
+ (forth-assert-face "s\\\" 5 \n 9 " 9 nil))
(ert-deftest forth-parsing-words-font-lock ()
(forth-assert-face "postpone ( x " 11 nil)
- [nongnu] elpa/forth-mode 50a7eb4bf1 094/153: Handle indentation of : and with smie instead of syntax-table., (continued)
- [nongnu] elpa/forth-mode 50a7eb4bf1 094/153: Handle indentation of : and with smie instead of syntax-table., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 45f3f20f18 104/153: Make indentation case-insensitive, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b8024ac331 088/153: Loading a Forth file provides some feedback., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9eb3550cdc 045/153: Add imenu items to autocomplete candidates., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 350638bb0c 106/153: Make indentation case-insensitive, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 039bf122ee 067/153: Document key bindings in the manual., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1a05d27d82 077/153: Fix loading backend file., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b95f1b8a02 146/153: Fix typos in doc, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2e75fb156f 081/153: Fix warning about defvar ignored., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 96c20f03f5 128/153: Make completion-at-point test work with Emacs23, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 867922d61e 112/153: Handle string literals more correctly,
ELPA Syncer <=
- [nongnu] elpa/forth-mode 16f359442e 109/153: Add tests for word movement commands, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 45650c28a2 140/153: Check if forth interactive buffer is live, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ab790fdac8 091/153: Don't kill *forth* buffer when there's a fatal error., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode be0272be3a 076/153: Inhibut Gforth terminal attribute output., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 312f3860aa 124/153: Try to indent (foo), ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 952995d95e 098/153: Add tests for indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 0bbf7992d6 135/153: Workaround pcase bug in Emacs-24.3, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ee0781f0a8 066/153: Add more functions for evaluating Forth expressions., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1ffc174c13 127/153: Pass Makefile variable FORTH as environment variable to build.el, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9b0982e169 149/153: Fix CI, ELPA Syncer, 2022/01/29