Function: ebnf-dtd-parser

ebnf-dtd-parser is an autoloaded and byte-compiled function defined in ebnf-dtd.el.gz.

Signature

(ebnf-dtd-parser START)

Documentation

DTD parser.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ebnf-dtd.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Syntactic analyzer


;;; document ::= prolog element Misc*
;;; /* Note that *only* the prolog will be parsed */

(defun ebnf-dtd-parser (start)
  "DTD parser."
  (let ((total (+ (- ebnf-limit start) 1))
	(bias (1- start))
	(origin (point))
	rule-list token rule the-end)
    (goto-char start)
    (setq token (ebnf-dtd-lex))
    (and (eq token 'end-of-input)
	 (error "Empty DTD file"))
    (setq token (ebnf-dtd-prolog token))
    (unless (eq (car token) 'end-prolog)
      (setq the-end (cdr token)
	    token   (car token))
      (while (not (eq token the-end))
	(ebnf-message-float
	 "Parsing...%s%%"
	 (/ (* (- (point) bias) 100.0) total))
	(setq token (ebnf-dtd-intsubset token)
	      rule  (cdr token)
	      token (car token))
	(or (null rule)
	    (ebnf-add-empty-rule-list rule)
	    (setq rule-list (cons rule rule-list))))
      (or (eq the-end 'end-of-input)
	  (eq (ebnf-dtd-lex) 'end-decl)
	  (error "Missing end of DOCTYPE"))
      ;; adjust message, 'cause *only* prolog will be parsed
      (ebnf-message-float "Parsing...%s%%" 100.0))
    (goto-char origin)
    rule-list))