Function: thai-find-word-ends
thai-find-word-ends is a byte-compiled function defined in
thai-word.el.gz.
Signature
(thai-find-word-ends POS LIMIT &optional IGNORE)
Source Code
;; Defined in /usr/src/emacs/lisp/language/thai-word.el.gz
;; Find Thai words starting at POS and return a list of positions of
;; the Thai word ends. It doesn't move point. LIMIT limits the
;; maximum position. IGNORE is a list of positions to ignore. It is
;; assumed that all following characters to LIMIT are Thai. If the
;; following char is not Thai (i.e., POS is equal to LIMIT), return t.
;;
;; Note that the longest word position comes first.
(defun thai-find-word-ends (pos limit &optional ignore)
(if (>= pos limit)
t
(let* ((char (char-after pos))
(this (cdr (assq char (cdr thai-word-table))))
category-set
positions)
;; Look up the following character sequence in `thai-word-table'
;; character by character.
(while this
(setq pos (1+ pos)
char (or (char-after pos) 0)
category-set (char-category-set char))
;; If the current sequence is recorded in `thai-word-table'
;; (i.e. (car THIS) is 1) and the following Thai character is
;; not an upper-vowel, lower-vowel, or tone-mark, we have
;; found a possible word ending position.
(if (and (eq (car this) 1)
(not (or (aref category-set ?2)
(aref category-set ?3)
(aref category-set ?4))))
(progn
;; Skip possible Thai suffices.
(while (or (eq char thai-MaiYaMok) (eq char thai-PaiYanNoi))
(setq pos (1+ pos)
char (char-after pos)))
;; Skip character positions in IGNORE list.
(or (memq pos ignore)
(setq positions (cons pos positions)))))
;; Set up next loop.
(setq this (and (< pos limit) (cdr (assq char this)))))
positions)))