Function: org-element-plain-list-parser

org-element-plain-list-parser is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-plain-list-parser LIMIT AFFILIATED STRUCTURE)

Documentation

Parse a plain list.

LIMIT bounds the search. AFFILIATED is a list of which CAR is the buffer position at the beginning of the first affiliated keyword and CDR is a plist of affiliated keywords along with their value. STRUCTURE is the structure of the plain list being parsed.

Return a new syntax node of plain-list type containing :type,
:begin, :end, :contents-begin and :contents-end, :structure,
:post-blank and :post-affiliated properties.

Assume point is at the beginning of the list.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defun org-element-plain-list-parser (limit affiliated structure)
  "Parse a plain list.

LIMIT bounds the search.  AFFILIATED is a list of which CAR is
the buffer position at the beginning of the first affiliated
keyword and CDR is a plist of affiliated keywords along with
their value.  STRUCTURE is the structure of the plain list being
parsed.

Return a new syntax node of `plain-list' type containing `:type',
`:begin', `:end', `:contents-begin' and `:contents-end', `:structure',
`:post-blank' and `:post-affiliated' properties.

Assume point is at the beginning of the list."
  (save-excursion
    (let* ((struct (or structure (org-element--list-struct limit)))
	   (type (cond ((looking-at-p "[ \t]*[A-Za-z0-9]") 'ordered)
		       ((nth 5 (assq (point) struct)) 'descriptive)
		       (t 'unordered)))
	   (contents-begin (point))
	   (begin (car affiliated))
	   (contents-end (let* ((item (assq contents-begin struct))
				(ind (nth 1 item))
				(pos (nth 6 item)))
			   (while (and (setq item (assq pos struct))
				       (= (nth 1 item) ind))
			     (setq pos (nth 6 item)))
			   pos))
           (contents-end (progn (goto-char contents-end)
                                (skip-chars-backward " \r\t\n")
                                (if (bolp) (point) (line-beginning-position 2))))
	   (end (progn (goto-char contents-end)
		       (skip-chars-forward " \r\t\n" limit)
		       (if (= (point) limit) limit (line-beginning-position)))))
      ;; Return value.
      (org-element-create
       'plain-list
       (nconc
	(list :type type
	      :begin begin
	      :end end
	      :contents-begin contents-begin
	      :contents-end contents-end
	      :structure struct
	      :post-blank (count-lines contents-end end)
	      :post-affiliated contents-begin)
	(cdr affiliated))))))