2007-11-23 06:58:00 +00:00
|
|
|
;;; nxml-rap.el --- low-level support for random access parsing for nXML mode
|
|
|
|
|
2013-01-01 09:11:05 +00:00
|
|
|
;; Copyright (C) 2003-2004, 2007-2013 Free Software Foundation, Inc.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
;; Author: James Clark
|
|
|
|
;; Keywords: XML
|
|
|
|
|
2007-11-28 04:10:03 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
2008-05-06 04:29:13 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2007-11-28 04:10:03 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 04:29:13 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
2007-11-28 04:10:03 +00:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 04:29:13 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; This uses xmltok.el to do XML parsing. The fundamental problem is
|
|
|
|
;; how to handle changes. We don't want to maintain a complete parse
|
|
|
|
;; tree. We also don't want to reparse from the start of the document
|
|
|
|
;; on every keystroke. However, it is not possible in general to
|
|
|
|
;; parse an XML document correctly starting at a random point in the
|
|
|
|
;; middle. The main problems are comments, CDATA sections and
|
|
|
|
;; processing instructions: these can all contain things that are
|
|
|
|
;; indistinguishable from elements. Literals in the prolog are also a
|
|
|
|
;; problem. Attribute value literals are not a problem because
|
|
|
|
;; attribute value literals cannot contain less-than signs.
|
|
|
|
;;
|
|
|
|
;; Our strategy is to keep track of just the problematic things.
|
|
|
|
;; Specifically, we keep track of all comments, CDATA sections and
|
|
|
|
;; processing instructions in the instance. We do this by marking all
|
|
|
|
;; except the first character of these with a non-nil nxml-inside text
|
|
|
|
;; property. The value of the nxml-inside property is comment,
|
|
|
|
;; cdata-section or processing-instruction. The first character does
|
|
|
|
;; not have the nxml-inside property so we can find the beginning of
|
|
|
|
;; the construct by looking for a change in a text property value
|
|
|
|
;; (Emacs provides primitives for this). We use text properties
|
|
|
|
;; rather than overlays, since the implementation of overlays doesn't
|
|
|
|
;; look like it scales to large numbers of overlays in a buffer.
|
|
|
|
;;
|
|
|
|
;; We don't in fact track all these constructs, but only track them in
|
|
|
|
;; some initial part of the instance. The variable `nxml-scan-end'
|
|
|
|
;; contains the limit of where we have scanned up to for them.
|
|
|
|
;;
|
|
|
|
;; Thus to parse some random point in the file we first ensure that we
|
|
|
|
;; have scanned up to that point. Then we search backwards for a
|
|
|
|
;; <. Then we check whether the < has an nxml-inside property. If it
|
|
|
|
;; does we go backwards to first character that does not have an
|
|
|
|
;; nxml-inside property (this character must be a <). Then we start
|
|
|
|
;; parsing forward from the < we have found.
|
|
|
|
;;
|
|
|
|
;; The prolog has to be parsed specially, so we also keep track of the
|
|
|
|
;; end of the prolog in `nxml-prolog-end'. The prolog is reparsed on
|
|
|
|
;; every change to the prolog. This won't work well if people try to
|
|
|
|
;; edit huge internal subsets. Hopefully that will be rare.
|
|
|
|
;;
|
|
|
|
;; We keep track of the changes by adding to the buffer's
|
|
|
|
;; after-change-functions hook. Scanning is also done as a
|
|
|
|
;; prerequisite to fontification by adding to fontification-functions
|
|
|
|
;; (in the same way as jit-lock). This means that scanning for these
|
|
|
|
;; constructs had better be quick. Fortunately it is. Firstly, the
|
|
|
|
;; typical proportion of comments, CDATA sections and processing
|
|
|
|
;; instructions is small relative to other things. Secondly, to scan
|
|
|
|
;; we just search for the regexp <[!?].
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'xmltok)
|
|
|
|
(require 'nxml-util)
|
|
|
|
|
|
|
|
(defvar nxml-prolog-end nil
|
|
|
|
"Integer giving position following end of the prolog.")
|
|
|
|
(make-variable-buffer-local 'nxml-prolog-end)
|
|
|
|
|
|
|
|
(defvar nxml-scan-end nil
|
|
|
|
"Marker giving position up to which we have scanned.
|
|
|
|
nxml-scan-end must be >= nxml-prolog-end. Furthermore, nxml-scan-end
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
must not be an inside position in the following sense. A position is
|
2007-11-23 06:58:00 +00:00
|
|
|
inside if the following character is a part of, but not the first
|
|
|
|
character of, a CDATA section, comment or processing instruction.
|
|
|
|
Furthermore all positions >= nxml-prolog-end and < nxml-scan-end that
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
are inside positions must have a non-nil `nxml-inside' property whose
|
|
|
|
value is a symbol specifying what it is inside. Any characters with a
|
|
|
|
non-nil `fontified' property must have position < nxml-scan-end and
|
|
|
|
the correct face. Dependent regions must also be established for any
|
2007-11-23 06:58:00 +00:00
|
|
|
unclosed constructs starting before nxml-scan-end.
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
There must be no `nxml-inside' properties after nxml-scan-end.")
|
2007-11-23 06:58:00 +00:00
|
|
|
(make-variable-buffer-local 'nxml-scan-end)
|
|
|
|
|
|
|
|
(defsubst nxml-get-inside (pos)
|
|
|
|
(get-text-property pos 'nxml-inside))
|
|
|
|
|
|
|
|
(defsubst nxml-clear-inside (start end)
|
2008-06-06 16:14:49 +00:00
|
|
|
(nxml-debug-clear-inside start end)
|
2007-11-23 06:58:00 +00:00
|
|
|
(remove-text-properties start end '(nxml-inside nil)))
|
|
|
|
|
|
|
|
(defsubst nxml-set-inside (start end type)
|
2008-06-06 16:14:49 +00:00
|
|
|
(nxml-debug-set-inside start end)
|
2007-11-23 06:58:00 +00:00
|
|
|
(put-text-property start end 'nxml-inside type))
|
|
|
|
|
|
|
|
(defun nxml-inside-end (pos)
|
|
|
|
"Return the end of the inside region containing POS.
|
|
|
|
Return nil if the character at POS is not inside."
|
|
|
|
(if (nxml-get-inside pos)
|
|
|
|
(or (next-single-property-change pos 'nxml-inside)
|
|
|
|
(point-max))
|
|
|
|
nil))
|
|
|
|
|
|
|
|
(defun nxml-inside-start (pos)
|
|
|
|
"Return the start of the inside region containing POS.
|
|
|
|
Return nil if the character at POS is not inside."
|
|
|
|
(if (nxml-get-inside pos)
|
|
|
|
(or (previous-single-property-change (1+ pos) 'nxml-inside)
|
|
|
|
(point-min))
|
|
|
|
nil))
|
|
|
|
|
|
|
|
;;; Change management
|
|
|
|
|
|
|
|
(defun nxml-scan-after-change (start end)
|
|
|
|
"Restore `nxml-scan-end' invariants after a change.
|
|
|
|
The change happened between START and END.
|
|
|
|
Return position after which lexical state is unchanged.
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
END must be > `nxml-prolog-end'. START must be outside
|
2008-06-06 16:14:49 +00:00
|
|
|
any 'inside' regions and at the beginning of a token."
|
2007-11-23 06:58:00 +00:00
|
|
|
(if (>= start nxml-scan-end)
|
|
|
|
nxml-scan-end
|
|
|
|
(let ((inside-remove-start start)
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
xmltok-errors)
|
2007-11-23 06:58:00 +00:00
|
|
|
(while (or (when (xmltok-forward-special (min end nxml-scan-end))
|
|
|
|
(when (memq xmltok-type
|
|
|
|
'(comment
|
|
|
|
cdata-section
|
|
|
|
processing-instruction))
|
|
|
|
(nxml-clear-inside inside-remove-start
|
|
|
|
(1+ xmltok-start))
|
|
|
|
(nxml-set-inside (1+ xmltok-start)
|
|
|
|
(point)
|
|
|
|
xmltok-type)
|
|
|
|
(setq inside-remove-start (point)))
|
|
|
|
(if (< (point) (min end nxml-scan-end))
|
|
|
|
t
|
|
|
|
(setq end (point))
|
|
|
|
nil))
|
|
|
|
;; The end of the change was inside but is now outside.
|
|
|
|
;; Imagine something really weird like
|
|
|
|
;; <![CDATA[foo <!-- bar ]]> <![CDATA[ stuff --> <!-- ]]> -->
|
|
|
|
;; and suppose we deleted "<![CDATA[f"
|
|
|
|
(let ((inside-end (nxml-inside-end end)))
|
|
|
|
(when inside-end
|
|
|
|
(setq end inside-end)
|
|
|
|
t))))
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
(nxml-clear-inside inside-remove-start end))
|
2007-11-23 06:58:00 +00:00
|
|
|
(when (> end nxml-scan-end)
|
|
|
|
(set-marker nxml-scan-end end))
|
|
|
|
end))
|
|
|
|
|
2007-11-28 04:10:03 +00:00
|
|
|
;; n-s-p only called from nxml-mode.el, where this variable is defined.
|
|
|
|
(defvar nxml-prolog-regions)
|
|
|
|
|
2007-11-23 06:58:00 +00:00
|
|
|
(defun nxml-scan-prolog ()
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let (xmltok-dtd
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
xmltok-errors)
|
2007-11-23 06:58:00 +00:00
|
|
|
(setq nxml-prolog-regions (xmltok-forward-prolog))
|
|
|
|
(setq nxml-prolog-end (point))
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
(nxml-clear-inside (point-min) nxml-prolog-end))
|
2007-11-23 06:58:00 +00:00
|
|
|
(when (< nxml-scan-end nxml-prolog-end)
|
|
|
|
(set-marker nxml-scan-end nxml-prolog-end)))
|
|
|
|
|
|
|
|
|
|
|
|
;;; Random access parsing
|
|
|
|
|
|
|
|
(defun nxml-token-after ()
|
|
|
|
"Return the position after the token containing the char after point.
|
|
|
|
Sets up the variables `xmltok-type', `xmltok-start',
|
|
|
|
`xmltok-name-end', `xmltok-name-colon', `xmltok-attributes',
|
|
|
|
`xmltok-namespace-attributes' in the same was as does
|
|
|
|
`xmltok-forward'. The prolog will be treated as a single token with
|
|
|
|
type `prolog'."
|
|
|
|
(let ((pos (point)))
|
|
|
|
(if (< pos nxml-prolog-end)
|
|
|
|
(progn
|
|
|
|
(setq xmltok-type 'prolog
|
|
|
|
xmltok-start (point-min))
|
|
|
|
(min nxml-prolog-end (point-max)))
|
|
|
|
(nxml-ensure-scan-up-to-date)
|
|
|
|
(if (nxml-get-inside pos)
|
|
|
|
(save-excursion
|
|
|
|
(nxml-move-outside-backwards)
|
|
|
|
(xmltok-forward)
|
|
|
|
(point))
|
|
|
|
(save-excursion
|
|
|
|
(if (or (eq (char-after) ?<)
|
|
|
|
(search-backward "<"
|
|
|
|
(max (point-min) nxml-prolog-end)
|
|
|
|
t))
|
|
|
|
(nxml-move-outside-backwards)
|
|
|
|
(goto-char (if (<= (point-min) nxml-prolog-end)
|
|
|
|
nxml-prolog-end
|
|
|
|
(or (nxml-inside-end (point-min))
|
|
|
|
(point-min)))))
|
|
|
|
(while (and (nxml-tokenize-forward)
|
|
|
|
(<= (point) pos)))
|
|
|
|
(point))))))
|
|
|
|
|
|
|
|
(defun nxml-token-before ()
|
|
|
|
"Return the position after the token containing the char before point.
|
|
|
|
Sets variables like `nxml-token-after'."
|
|
|
|
(if (/= (point-min) (point))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (1- (point)))
|
|
|
|
(nxml-token-after))
|
|
|
|
(setq xmltok-start (point))
|
|
|
|
(setq xmltok-type nil)
|
|
|
|
(point)))
|
|
|
|
|
|
|
|
(defun nxml-tokenize-forward ()
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
(let (xmltok-errors)
|
2007-11-23 06:58:00 +00:00
|
|
|
(when (and (xmltok-forward)
|
|
|
|
(> (point) nxml-scan-end))
|
|
|
|
(cond ((memq xmltok-type '(comment
|
|
|
|
cdata-section
|
|
|
|
processing-instruction))
|
2013-03-23 02:21:25 +00:00
|
|
|
(with-silent-modifications
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
(nxml-set-inside (1+ xmltok-start) (point) xmltok-type))))
|
2007-11-23 06:58:00 +00:00
|
|
|
(set-marker nxml-scan-end (point)))
|
|
|
|
xmltok-type))
|
|
|
|
|
2008-06-06 16:14:49 +00:00
|
|
|
(defun nxml-move-tag-backwards (bound)
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
"Move point backwards outside any 'inside' regions or tags.
|
|
|
|
Point will not move past `nxml-prolog-end'.
|
|
|
|
Point will either be at BOUND or a '<' character starting a tag
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
outside any 'inside' regions.
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
As a precondition, point must be >= BOUND."
|
2008-06-06 16:14:49 +00:00
|
|
|
(nxml-move-outside-backwards)
|
|
|
|
(when (not (equal (char-after) ?<))
|
|
|
|
(if (search-backward "<" bound t)
|
|
|
|
(progn
|
|
|
|
(nxml-move-outside-backwards)
|
|
|
|
(when (not (equal (char-after) ?<))
|
|
|
|
(search-backward "<" bound t)))
|
|
|
|
(goto-char bound))))
|
|
|
|
|
2007-11-23 06:58:00 +00:00
|
|
|
(defun nxml-move-outside-backwards ()
|
|
|
|
"Move point to first character of the containing special thing.
|
|
|
|
Leave point unmoved if it is not inside anything special."
|
|
|
|
(let ((start (nxml-inside-start (point))))
|
|
|
|
(when start
|
|
|
|
(goto-char (1- start))
|
|
|
|
(when (nxml-get-inside (point))
|
|
|
|
(error "Char before inside-start at %s had nxml-inside property %s"
|
|
|
|
(point)
|
|
|
|
(nxml-get-inside (point)))))))
|
|
|
|
|
|
|
|
(defun nxml-ensure-scan-up-to-date ()
|
|
|
|
(let ((pos (point)))
|
|
|
|
(when (< nxml-scan-end pos)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char nxml-scan-end)
|
* lisp/nxml/nxml-mode.el: Treat unclosed <[[, <?, comment, and other
literals as extending to EOB.
(nxml-last-fontify-end): Remove unused variable.
(nxml-after-change1): Use with-silent-modifications.
(nxml-extend-after-change-region): Simplify.
(nxml-extend-after-change-region1): Remove function.
(nxml-after-change1): Don't adjust for dependent regions.
(nxml-fontify-matcher): Simplify.
* lisp/nxml/xmltok.el (xmltok-dependent-regions): Remove variable.
(xmltok-add-dependent): Remove function.
(xmltok-scan-after-lt, xmltok-scan-after-processing-instruction-open)
(xmltok-scan-after-comment-open, xmltok-scan-prolog-literal)
(xmltok-scan-prolog-after-processing-instruction-open): Treat
unclosed <[[, <?, comment, and other literals as extending to EOB.
* lisp/nxml/rng-valid.el (rng-mark-xmltok-dependent-regions)
(rng-mark-xmltok-dependent-region, rng-dependent-region-changed):
Remove functions.
(rng-do-some-validation-1): Don't mark dependent regions.
* lisp/nxml/nxml-rap.el (nxml-adjust-start-for-dependent-regions)
(nxml-mark-parse-dependent-regions, nxml-mark-parse-dependent-region)
(nxml-clear-dependent-regions): Remove functions.
(nxml-scan-after-change, nxml-scan-prolog, nxml-tokenize-forward)
(nxml-ensure-scan-up-to-date):
Don't clear&mark dependent regions.
2013-05-15 18:31:51 +00:00
|
|
|
(let (xmltok-errors)
|
2007-11-23 06:58:00 +00:00
|
|
|
(while (when (xmltok-forward-special pos)
|
|
|
|
(when (memq xmltok-type
|
|
|
|
'(comment
|
|
|
|
processing-instruction
|
|
|
|
cdata-section))
|
2013-03-23 02:21:25 +00:00
|
|
|
(with-silent-modifications
|
2007-11-23 06:58:00 +00:00
|
|
|
(nxml-set-inside (1+ xmltok-start)
|
|
|
|
(point)
|
|
|
|
xmltok-type)))
|
|
|
|
(if (< (point) pos)
|
|
|
|
t
|
|
|
|
(setq pos (point))
|
|
|
|
nil)))
|
|
|
|
(set-marker nxml-scan-end pos))))))
|
|
|
|
|
|
|
|
;;; Element scanning
|
|
|
|
|
|
|
|
(defun nxml-scan-element-forward (from &optional up)
|
|
|
|
"Scan forward from FROM over a single balanced element.
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
Point must be between tokens. Return the position of the end of
|
|
|
|
the tag that ends the element. `xmltok-start' will contain the
|
|
|
|
position of the start of the tag. If UP is non-nil, then scan
|
|
|
|
past end-tag of element containing point. If no element is
|
|
|
|
found, return nil. If a well-formedness error prevents scanning,
|
|
|
|
signal an `nxml-scan-error'. Point is not moved."
|
2007-11-23 06:58:00 +00:00
|
|
|
(let ((open-tags (and up t))
|
|
|
|
found)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char from)
|
|
|
|
(while (cond ((not (nxml-tokenize-forward))
|
|
|
|
(when (consp open-tags)
|
|
|
|
(nxml-scan-error (cadr open-tags)
|
|
|
|
"Start-tag has no end-tag"))
|
|
|
|
nil)
|
|
|
|
((eq xmltok-type 'start-tag)
|
|
|
|
(setq open-tags
|
|
|
|
(cons (xmltok-start-tag-qname)
|
|
|
|
(cons xmltok-start
|
|
|
|
open-tags)))
|
|
|
|
t)
|
|
|
|
((eq xmltok-type 'end-tag)
|
|
|
|
(cond ((not open-tags) nil)
|
|
|
|
((not (consp open-tags)) (setq found (point)) nil)
|
|
|
|
((not (string= (car open-tags)
|
|
|
|
(xmltok-end-tag-qname)))
|
|
|
|
(nxml-scan-error (+ 2 xmltok-start)
|
|
|
|
"Mismatched end-tag; \
|
|
|
|
expected `%s'"
|
|
|
|
(car open-tags)))
|
|
|
|
((setq open-tags (cddr open-tags)) t)
|
|
|
|
(t (setq found (point)) nil)))
|
|
|
|
((memq xmltok-type '(empty-element
|
|
|
|
partial-empty-element))
|
|
|
|
(if open-tags
|
|
|
|
t
|
|
|
|
(setq found (point))
|
|
|
|
nil))
|
|
|
|
((eq xmltok-type 'partial-end-tag)
|
|
|
|
(cond ((not open-tags) nil)
|
|
|
|
((not (consp open-tags)) (setq found (point)) nil)
|
|
|
|
((setq open-tags (cddr open-tags)) t)
|
|
|
|
(t (setq found (point)) nil)))
|
|
|
|
((eq xmltok-type 'partial-start-tag)
|
|
|
|
(nxml-scan-error xmltok-start
|
|
|
|
"Missing `>'"))
|
|
|
|
(t t))))
|
|
|
|
found))
|
|
|
|
|
|
|
|
(defun nxml-scan-element-backward (from &optional up bound)
|
|
|
|
"Scan backward from FROM over a single balanced element.
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
Point must be between tokens. Return the position of the end of
|
|
|
|
the tag that starts the element. `xmltok-start' will contain the
|
|
|
|
position of the start of the tag. If UP is non-nil, then scan
|
|
|
|
past start-tag of element containing point. If BOUND is non-nil,
|
|
|
|
then don't scan back past BOUND. If no element is found, return
|
|
|
|
nil. If a well-formedness error prevents scanning, signal an
|
|
|
|
`nxml-scan-error'. Point is not moved."
|
2007-11-23 06:58:00 +00:00
|
|
|
(let ((open-tags (and up t))
|
|
|
|
token-end found)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char from)
|
|
|
|
(while (cond ((or (< (point) nxml-prolog-end)
|
|
|
|
(not (search-backward "<"
|
|
|
|
(max (or bound 0)
|
|
|
|
nxml-prolog-end)
|
|
|
|
t)))
|
|
|
|
(when (and (consp open-tags) (not bound))
|
|
|
|
(nxml-scan-error (cadr open-tags)
|
|
|
|
"End-tag has no start-tag"))
|
|
|
|
nil)
|
|
|
|
((progn
|
|
|
|
(nxml-move-outside-backwards)
|
|
|
|
(save-excursion
|
|
|
|
(nxml-tokenize-forward)
|
|
|
|
(setq token-end (point)))
|
|
|
|
(eq xmltok-type 'end-tag))
|
|
|
|
(setq open-tags
|
|
|
|
(cons (xmltok-end-tag-qname)
|
|
|
|
(cons xmltok-start open-tags)))
|
|
|
|
t)
|
|
|
|
((eq xmltok-type 'start-tag)
|
|
|
|
(cond ((not open-tags) nil)
|
|
|
|
((not (consp open-tags))
|
|
|
|
(setq found token-end)
|
|
|
|
nil)
|
|
|
|
((and (car open-tags)
|
|
|
|
(not (string= (car open-tags)
|
|
|
|
(xmltok-start-tag-qname))))
|
|
|
|
(nxml-scan-error (1+ xmltok-start)
|
|
|
|
"Mismatched start-tag; \
|
|
|
|
expected `%s'"
|
|
|
|
(car open-tags)))
|
|
|
|
((setq open-tags (cddr open-tags)) t)
|
|
|
|
(t (setq found token-end) nil)))
|
|
|
|
((memq xmltok-type '(empty-element
|
|
|
|
partial-empty-element))
|
|
|
|
(if open-tags
|
|
|
|
t
|
|
|
|
(setq found token-end)
|
|
|
|
nil))
|
|
|
|
((eq xmltok-type 'partial-end-tag)
|
|
|
|
(setq open-tags
|
|
|
|
(cons nil (cons xmltok-start open-tags)))
|
|
|
|
t)
|
|
|
|
((eq xmltok-type 'partial-start-tag)
|
|
|
|
;; if we have only a partial-start-tag
|
|
|
|
;; then it's unlikely that there's a matching
|
|
|
|
;; end-tag, so it's probably not helpful
|
|
|
|
;; to treat it as a complete start-tag
|
|
|
|
(nxml-scan-error xmltok-start
|
|
|
|
"Missing `>'"))
|
|
|
|
(t t))))
|
|
|
|
found))
|
|
|
|
|
|
|
|
(defun nxml-scan-error (&rest args)
|
|
|
|
(signal 'nxml-scan-error args))
|
|
|
|
|
* lisp/subr.el (define-error): New function.
* doc/lispref/control.texi (Signaling Errors): Refer to define-error.
(Error Symbols): Add `define-error'.
* doc/lispref/errors.texi (Standard Errors): Don't refer to `error-conditions'.
* lisp/progmodes/ada-xref.el (ada-error-file-not-found): Rename from
error-file-not-found and define with define-error.
* lisp/emacs-lisp/cl-lib.el (cl-assertion-failed): Move here from subr.el
and define with define-error.
* lisp/userlock.el (file-locked, file-supersession):
* lisp/simple.el (mark-inactive):
* lisp/progmodes/js.el (js-moz-bad-rpc, js-js-error):
* lisp/progmodes/ada-mode.el (ada-mode-errors):
* lisp/play/life.el (life-extinct):
* lisp/nxml/xsd-regexp.el (xsdre-invalid-regexp, xsdre-parse-error):
* lisp/nxml/xmltok.el (xmltok-markup-declaration-parse-error):
* lisp/nxml/rng-util.el (rng-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-cmpct.el (rng-c-incorrect-schema):
* lisp/nxml/nxml-util.el (nxml-error, nxml-file-parse-error):
* lisp/nxml/nxml-rap.el (nxml-scan-error):
* lisp/nxml/nxml-outln.el (nxml-outline-error):
* lisp/net/soap-client.el (soap-error):
* lisp/net/gnutls.el (gnutls-error):
* lisp/net/ange-ftp.el (ftp-error):
* lisp/mpc.el (mpc-proc-error):
* lisp/json.el (json-error, json-readtable-error, json-unknown-keyword)
(json-number-format, json-string-escape, json-string-format)
(json-key-format, json-object-format):
* lisp/jka-compr.el (compression-error):
* lisp/international/quail.el (quail-error):
* lisp/international/kkc.el (kkc-error):
* lisp/emacs-lisp/ert.el (ert-test-failed):
* lisp/calc/calc.el (calc-error, inexact-result, math-overflow)
(math-underflow):
* lisp/bookmark.el (bookmark-error-no-filename):
* lisp/epg.el (epg-error): Define with define-error.
2013-08-09 21:22:44 +00:00
|
|
|
(define-error 'nxml-scan-error
|
|
|
|
"Scan over element that is not well-formed" 'nxml-error)
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
(provide 'nxml-rap)
|
|
|
|
|
|
|
|
;;; nxml-rap.el ends here
|