]> git.eshelyaron.com Git - dict.git/commitdiff
Recognize backslash as part of an operator in tokenization
authorEshel Yaron <me@eshelyaron.com>
Wed, 9 Nov 2022 20:30:46 +0000 (22:30 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 9 Nov 2022 20:30:46 +0000 (22:30 +0200)
sweeprolog-tests.el
sweeprolog.el

index da66d0a5f3ff4882fac16d333411c80cbb15abcf..78924f2eabff3567a7140fc97bf2cdefdce23c79 100644 (file)
@@ -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 ()
index 11f6eeff4d3b748930fc1551671ab6564fe018c0..4b87ee045587e067b70422220f3e56bd56442737 100644 (file)
@@ -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 ?\()