body.
"))
+(ert-deftest forward-sexp-with-adjacent-operators ()
+ "Tests detecting the fullstop in presence of `.=.'."
+ (with-temp-buffer
+ (sweeprolog-mode)
+ (insert "a,+b.")
+ (goto-char (point-min))
+ (sweeprolog--forward-sexp)
+ (should (= (point) 2))
+ (goto-char (point-max))
+ (sweeprolog--backward-sexp)
+ (should (= (point) 4))))
+
;;; sweeprolog-tests.el ends here
((or (= syn ?.)
(= syn ?\\))
(skip-syntax-forward ".")
- (list 'operator beg (point)))
+ (let ((end (point)))
+ (while (and (< beg (point))
+ (not (sweeprolog--query-once
+ "sweep" "sweep_op_info"
+ (cons (buffer-substring-no-properties beg (point))
+ (buffer-file-name)))))
+ (forward-char -1))
+ (list 'operator beg (if (= beg (point)) end (point)))))
((= syn ?\()
(list 'open beg (point)))
((= syn ?\))
(skip-syntax-backward "w_")
(list 'functor (point) end))
((or (= syn ?.)
- (= syn ?\\)) ; specifically, the backslash character
+ (= syn ?\\)) ; specifically, the backslash character
(skip-syntax-backward ".")
- (list 'operator (point) end))
+ (let ((beg (point)))
+ (while (and (< (point) end)
+ (not (sweeprolog--query-once
+ "sweep" "sweep_op_info"
+ (cons (buffer-substring-no-properties (point) end)
+ (buffer-file-name)))))
+ (forward-char 1))
+ (list 'operator (if (= end (point)) beg (point)) end)))
((= syn ?\()
(list 'open (1- end) end))
((= syn ?\))