-;;; xmltok.el --- XML tokenization
+;;; xmltok.el --- XML tokenization -*- lexical-binding:t -*-
-;; Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2015 Free Software Foundation, Inc.
;; Author: James Clark
-;; Keywords: XML
+;; Keywords: wp, hypermedia, languages, XML
;; This file is part of GNU Emacs.
indicating the position of the error.")
(defmacro xmltok-save (&rest body)
+ (declare (indent 0) (debug t))
`(let (xmltok-type
xmltok-start
xmltok-name-colon
xmltok-errors)
,@body))
-(put 'xmltok-save 'lisp-indent-function 0)
-(def-edebug-spec xmltok-save t)
-
(defsubst xmltok-attribute-name-start (att)
(aref att 0))
(eval-when-compile
(let* ((or "\\|")
(open "\\(?:")
- (gopen "\\(")
(close "\\)")
(name-start-char "[_[:alpha:]]")
(name-continue-not-start-char "[-.[:digit:]]")
;; Need do this after the goto-char because
;; marked error should just apply to <!--
(xmltok-add-error "First following `--' not followed by `>'")
- 'not-well-formed)))))
+ (goto-char (point-max))
+ 'comment)))))
(defun xmltok-scan-attributes ()
(let ((recovering nil)
(xmltok-valid-char-p n)
n)))
-(defun xmltok-unclosed-reparse-p (change-start
- change-end
- pre-change-length
- start
- end
- delimiter)
- (let ((len-1 (1- (length delimiter))))
- (goto-char (max start (- change-start len-1)))
- (search-forward delimiter (min end (+ change-end len-1)) t)))
-
-;; Handles a <!-- with the next -- not followed by >
-
-(defun xmltok-semi-closed-reparse-p (change-start
- change-end
- pre-change-length
- start
- end
- delimiter
- delimiter-length)
- (or (<= (- end delimiter-length) change-end)
- (xmltok-unclosed-reparse-p change-start
- change-end
- pre-change-length
- start
- end
- delimiter)))
-
(defun xmltok-valid-char-p (n)
"Return non-nil if N is the Unicode code of a valid XML character."
(cond ((< n #x20) (memq n '(#xA #xD #x9)))
(setq xmltok-dtd xmltok-predefined-entity-alist)
(xmltok-scan-xml-declaration)
(xmltok-next-prolog-token)
- (while (condition-case err
+ (while (condition-case nil
(when (xmltok-parse-prolog-item)
(xmltok-next-prolog-token))
(xmltok-markup-declaration-parse-error
(t
(let ((xmltok-start (1- (point)))
xmltok-type xmltok-replacement)
- (xmltok-scan-after-amp (lambda (start end)))
+ (xmltok-scan-after-amp (lambda (_start _end)))
(cond ((eq xmltok-type 'char-ref)
(setq value-parts
(cons (buffer-substring-no-properties
(defun xmltok-current-token-string ()
(buffer-substring-no-properties xmltok-start (point)))
-(put 'xmltok-markup-declaration-parse-error
- 'error-conditions
- '(error xmltok-markup-declaration-parse-error))
-
-(put 'xmltok-markup-declaration-parse-error
- 'error-message
- "Syntax error in markup declaration")
+(define-error 'xmltok-markup-declaration-parse-error
+ "Syntax error in markup declaration")
(defun xmltok-markup-declaration-parse-error ()
(signal 'xmltok-markup-declaration-parse-error nil))