Function: rng-forward

rng-forward is a byte-compiled function defined in rng-valid.el.gz.

Signature

(rng-forward &optional LIMIT)

Documentation

Move forward over one or more tokens updating the state.

If LIMIT is nil, stop after tags. If LIMIT is non-nil, stop when end of last token parsed is >= LIMIT. Return nil at end of buffer, t otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/rng-valid.el.gz
;;; Parsing

(defun rng-forward (&optional limit)
  "Move forward over one or more tokens updating the state.
If LIMIT is nil, stop after tags.
If LIMIT is non-nil, stop when end of last token parsed is >= LIMIT.
Return nil at end of buffer, t otherwise."
  (let (type)
    (while (progn
	     (setq type (xmltok-forward))
	     (rng-clear-overlays xmltok-start (point))
	     (let ((continue
		    (cond ((eq type 'start-tag)
			   (rng-process-start-tag 'start-tag)
			   nil)
			  ((eq type 'end-tag)
			   (rng-process-end-tag)
			   nil)
			  ((eq type 'empty-element)
			   (rng-process-start-tag 'empty-element)
			   nil)
			  ((eq type 'space)
			   (rng-process-text xmltok-start nil t)
			   t)
			  ((eq type 'data)
			   (rng-process-text xmltok-start nil nil)
			   t)
			  ((memq type '(entity-ref char-ref))
			   (cond (xmltok-replacement
				  (rng-process-text xmltok-start
						    nil
						    'maybe
						    xmltok-replacement))
				 ((eq type 'char-ref)
				  (rng-process-unknown-char))
				 (t
				  (rng-process-unknown-entity)))
			   t)
			  ((eq type 'cdata-section)
			   (rng-process-text (+ xmltok-start 9)	; "<![CDATA["
					     (- (point) 3) ; "]]>"
					     'maybe)
			   t)
			  ((eq type 'partial-start-tag)
			   (rng-process-start-tag 'partial-start-tag)
			   t)
			  ((eq type 'partial-empty-element)
			   (rng-process-start-tag 'empty-element)
			   t)
			  ((eq type 'partial-end-tag)
			   (rng-process-end-tag 'partial)
			   t)
			  (t type))))
	       (if limit
		   (< (point) limit)
		 continue))))
    (and type t)))