From 98d05848517a087728c9257abf1466cfd189e0c4 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 9 Nov 2022 22:30:46 +0200 Subject: [PATCH] Recognize backslash as part of an operator in tokenization --- sweeprolog-tests.el | 12 ++++++------ sweeprolog.el | 8 +++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el index da66d0a..78924f2 100644 --- a/sweeprolog-tests.el +++ b/sweeprolog-tests.el @@ -73,22 +73,22 @@ foo(Foo) :- bar. (should (equal (get-text-property (+ (point-min) 3) 'font-lock-face) '(sweeprolog-built-in-default-face - sweeprolog-directive-default-face))) + sweeprolog-body-default-face))) (should (equal (get-text-property (+ (point-min) 9) 'font-lock-face) - '(sweeprolog-directive-default-face))) + '(sweeprolog-body-default-face))) (should (equal (get-text-property (+ (point-min) 10) 'font-lock-face) '(sweeprolog-identifier-default-face - sweeprolog-directive-default-face))) + sweeprolog-body-default-face))) (should (equal (get-text-property (+ (point-min) 13) 'font-lock-face) - '(sweeprolog-directive-default-face))) + '(sweeprolog-body-default-face))) (should (equal (get-text-property (+ (point-min) 16) 'font-lock-face) '(sweeprolog-local-default-face sweeprolog-predicate-indicator-default-face - sweeprolog-directive-default-face))) + sweeprolog-body-default-face))) (should (equal (get-text-property (+ (point-min) 23) 'font-lock-face) '(sweeprolog-fullstop-default-face))) @@ -103,7 +103,7 @@ foo(Foo) :- bar. (should (equal (get-text-property (+ (point-min) 39) 'font-lock-face) '(sweeprolog-undefined-default-face - sweeprolog-clause-default-face))))) + sweeprolog-body-default-face))))) (ert-deftest complete-variable () diff --git a/sweeprolog.el b/sweeprolog.el index 11f6eef..4b87ee0 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -1996,7 +1996,7 @@ modified." ((rx bow (group-n 1 "0'" anychar)) (1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) (string-to-syntax "w")))) - ((rx bow (group-n 1 "!")) + ((rx bow (group-n 1 "!") eow) (1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) (string-to-syntax "w"))))) start end))) @@ -2629,7 +2629,8 @@ predicate definition at or directly above POINT." (while (and (not (eobp)) (nth 3 (syntax-ppss))) (forward-char)) (list 'string beg (point))) - ((= syn ?.) + ((or (= syn ?.) + (= syn ?\\)) (skip-syntax-forward ".") (list 'operator beg (point))) ((= syn ?\() @@ -2666,7 +2667,8 @@ predicate definition at or directly above POINT." (= (char-syntax (char-before)) ?_))) (skip-syntax-backward "w_") (list 'functor (point) end)) - ((= syn ?.) + ((or (= syn ?.) + (= syn ?\\)) ; specifically, the backslash character (skip-syntax-backward ".") (list 'operator (point) end)) ((= syn ?\() -- 2.39.2