comparison lisp/nxml/xmltok.el @ 96496:e374c747704b

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.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 03 Jul 2008 12:25:23 +0000
parents d495d4d5452f
children c14273ed6b9f
comparison
equal deleted inserted replaced
96495:c7a78d44a1d3 96496:e374c747704b
115 It consists of an alist of general entity names vs definitions. The 115 It consists of an alist of general entity names vs definitions. The
116 first member of the alist is t if references to entities not in the 116 first member of the alist is t if references to entities not in the
117 alist are well-formed \(e.g. because there's an external subset that 117 alist are well-formed \(e.g. because there's an external subset that
118 wasn't parsed). 118 wasn't parsed).
119 119
120 Each general entity name is a string. The definition is either nil, a 120 Each general entity name is a string. The definition is either nil,
121 symbol, a string, a cons cell. If the definition is nil, then it 121 a symbol, a string, a cons cell. If the definition is nil, then it
122 means that it's an internal entity but the result of parsing it is 122 means that it's an internal entity but the result of parsing it is
123 unknown. If it is a symbol, then the symbol is either `unparsed', 123 unknown. If it is a symbol, then the symbol is either `unparsed',
124 meaning the entity is an unparsed entity, `external', meaning the 124 meaning the entity is an unparsed entity, `external', meaning the
125 entity is or references an external entity, `element', meaning the 125 entity is or references an external entity, `element', meaning the
126 entity includes one or more elements, or `not-well-formed', meaning 126 entity includes one or more elements, or `not-well-formed', meaning
127 the replacement text is not well-formed. If the definition is a 127 the replacement text is not well-formed. If the definition is a
128 string, then the replacement text of the entity is that string; this 128 string, then the replacement text of the entity is that string; this
129 happens only during the parsing of the prolog. If the definition is a 129 happens only during the parsing of the prolog. If the definition is
130 cons cell \(ER . AR), then ER specifies the string that results from 130 a cons cell \(ER . AR), then ER specifies the string that results
131 referencing the entity in element content and AR is either nil, 131 from referencing the entity in element content and AR is either nil,
132 meaning the replacement text included a <, or a string which is the 132 meaning the replacement text included a <, or a string which is the
133 normalized attribute value.") 133 normalized attribute value.")
134 134
135 (defvar xmltok-dependent-regions nil 135 (defvar xmltok-dependent-regions nil
136 "List of descriptors of regions that a parsed token depends on. 136 "List of descriptors of regions that a parsed token depends on.
149 additional arguments to be passed to FUN. FUN will be called with 5 149 additional arguments to be passed to FUN. FUN will be called with 5
150 arguments followed by the additional arguments if any: the position of 150 arguments followed by the additional arguments if any: the position of
151 the start of the changed area in the region, the position of the end 151 the start of the changed area in the region, the position of the end
152 of the changed area in the region, the length of the changed area 152 of the changed area in the region, the length of the changed area
153 before the change, the position of the start of the region, the 153 before the change, the position of the start of the region, the
154 position of the end of the region. FUN must return non-nil if the 154 position of the end of the region. FUN must return non-nil if the
155 region needs reparsing. FUN will be called in a save-excursion with 155 region needs reparsing. FUN will be called in a `save-excursion'
156 match-data saved. 156 with match-data saved.
157 157
158 `xmltok-forward', `xmltok-forward-special' and `xmltok-forward-prolog' 158 `xmltok-forward', `xmltok-forward-special' and `xmltok-forward-prolog'
159 may add entries to the beginning of this list, but will not clear it. 159 may add entries to the beginning of this list, but will not clear it.
160 `xmltok-forward' and `xmltok-forward-special' will only add entries 160 `xmltok-forward' and `xmltok-forward-special' will only add entries
161 when returning tokens of type not-well-formed.") 161 when returning tokens of type not-well-formed.")
198 (defsubst xmltok-attribute-value-end (att) 198 (defsubst xmltok-attribute-value-end (att)
199 (aref att 4)) 199 (aref att 4))
200 200
201 (defsubst xmltok-attribute-raw-normalized-value (att) 201 (defsubst xmltok-attribute-raw-normalized-value (att)
202 "Return an object representing the normalized value of ATT. 202 "Return an object representing the normalized value of ATT.
203 This can t indicating that the normalized value is the same as the 203 This can be t indicating that the normalized value is the same as
204 buffer substring from the start to the end of the value or nil 204 the buffer substring from the start to the end of the value, or nil
205 indicating that the value is not well-formed or a string." 205 indicating that the value is not well-formed or a string."
206 (aref att 5)) 206 (aref att 5))
207 207
208 (defsubst xmltok-attribute-refs (att) 208 (defsubst xmltok-attribute-refs (att)
209 "Return a list of the entity and character references in ATT. 209 "Return a list of the entity and character references in ATT.
210 Each member is a vector [TYPE START END] where TYPE is either char-ref 210 Each member is a vector [TYPE START END] where TYPE is either char-ref
211 or entity-ref and START and END are integers giving the start and end 211 or entity-ref and START and END are integers giving the start and end of
212 of the reference. Nested entity references are not included in the list." 212 the reference. Nested entity references are not included in the list."
213 (aref att 6)) 213 (aref att 6))
214 214
215 (defun xmltok-attribute-prefix (att) 215 (defun xmltok-attribute-prefix (att)
216 (let ((colon (xmltok-attribute-name-colon att))) 216 (let ((colon (xmltok-attribute-name-colon att)))
217 (and colon 217 (and colon
265 name-end 265 name-end
266 &optional 266 &optional
267 value-begin 267 value-begin
268 value-end 268 value-end
269 raw-normalized-value) 269 raw-normalized-value)
270 "Make an attribute. RAW-NORMALIZED-VALUE is nil if the value is 270 "Make an attribute.
271 not well-formed, t if the normalized value is the string between 271 RAW-NORMALIZED-VALUE is nil if the value is not well-formed,
272 VALUE-BEGIN and VALUE-END, otherwise a STRING giving the value." 272 t if the normalized value is the string between VALUE-BEGIN
273 and VALUE-END, otherwise a STRING giving the value."
273 (vector name-begin 274 (vector name-begin
274 name-colon 275 name-colon
275 name-end 276 name-end
276 value-begin 277 value-begin
277 value-end 278 value-end
349 350
350 (defun xmltok-forward-special (bound) 351 (defun xmltok-forward-special (bound)
351 "Scan forward past the first special token starting at or after point. 352 "Scan forward past the first special token starting at or after point.
352 Return nil if there is no special token that starts before BOUND. 353 Return nil if there is no special token that starts before BOUND.
353 CDATA sections, processing instructions and comments (and indeed 354 CDATA sections, processing instructions and comments (and indeed
354 anything starting with < following by ? or !) count 355 anything starting with < following by ? or !) count as special.
355 as special. Return the type of the token." 356 Return the type of the token."
356 (when (re-search-forward "<[?!]" (1+ bound) t) 357 (when (re-search-forward "<[?!]" (1+ bound) t)
357 (setq xmltok-start (match-beginning 0)) 358 (setq xmltok-start (match-beginning 0))
358 (goto-char (1+ xmltok-start)) 359 (goto-char (1+ xmltok-start))
359 (let ((case-fold-search nil)) 360 (let ((case-fold-search nil))
360 (xmltok-scan-after-lt)))) 361 (xmltok-scan-after-lt))))
390 `(let ((,sym (xmltok+ ,@r))) 391 `(let ((,sym (xmltok+ ,@r)))
391 (if (stringp ,sym) 392 (if (stringp ,sym)
392 (cons (concat "\\(" ,sym "\\)") (cons ',name nil)) 393 (cons (concat "\\(" ,sym "\\)") (cons ',name nil))
393 (cons (concat "\\(" (car ,sym) "\\)") (cons ',name (cdr ,sym))))))) 394 (cons (concat "\\(" (car ,sym) "\\)") (cons ',name (cdr ,sym)))))))
394 395
395 (defun xmltok-p (&rest r) (xmltok+ "\\(?:" 396 (defun xmltok-p (&rest r) (xmltok+ "\\(?:"
396 (apply 'xmltok+ r) 397 (apply 'xmltok+ r)
397 "\\)")) 398 "\\)"))
398 399
399 ;; Get the group index of ELEM in a LIST of symbols. 400 ;; Get the group index of ELEM in a LIST of symbols.
400 (defun xmltok-get-index (elem list) 401 (defun xmltok-get-index (elem list)
441 (xmltok-get-index group-name ',(cdr r)))) 442 (xmltok-get-index group-name ',(cdr r))))
442 ((eq action 'string-no-properties) 443 ((eq action 'string-no-properties)
443 (list 'match-string-no-properties 444 (list 'match-string-no-properties
444 (xmltok-get-index group-name ',(cdr r)))) 445 (xmltok-get-index group-name ',(cdr r))))
445 (t (error "Invalid action: %s" action)))))))) 446 (t (error "Invalid action: %s" action))))))))
446 447
447 448
448 (eval-when-compile 449 (eval-when-compile
449 (let* ((or "\\|") 450 (let* ((or "\\|")
450 (open "\\(?:") 451 (open "\\(?:")
451 (gopen "\\(") 452 (gopen "\\(")
790 (looking-at "xml")))) 791 (looking-at "xml"))))
791 (xmltok-add-error "Processing instruction target is xml" 792 (xmltok-add-error "Processing instruction target is xml"
792 (+ xmltok-start 2) 793 (+ xmltok-start 2)
793 (+ xmltok-start 5)))) 794 (+ xmltok-start 5))))
794 (setq xmltok-type 'processing-instruction)))) 795 (setq xmltok-type 'processing-instruction))))
795 796
796 (defun xmltok-scan-after-comment-open () 797 (defun xmltok-scan-after-comment-open ()
797 (setq xmltok-type 798 (setq xmltok-type
798 (cond ((not (search-forward "--" nil t)) 799 (cond ((not (search-forward "--" nil t))
799 (xmltok-add-error "No closing -->") 800 (xmltok-add-error "No closing -->")
800 (xmltok-add-dependent 'xmltok-unclosed-reparse-p 801 (xmltok-add-dependent 'xmltok-unclosed-reparse-p
930 (cons att xmltok-namespace-attributes)) 931 (cons att xmltok-namespace-attributes))
931 (setq xmltok-attributes 932 (setq xmltok-attributes
932 (cons att xmltok-attributes))) 933 (cons att xmltok-attributes)))
933 (and needs-normalizing 934 (and needs-normalizing
934 att))) 935 att)))
935 936
936 (defun xmltok-normalize-attribute (att) 937 (defun xmltok-normalize-attribute (att)
937 (let ((end (xmltok-attribute-value-end att)) 938 (let ((end (xmltok-attribute-value-end att))
938 (well-formed t) 939 (well-formed t)
939 (value-parts nil) 940 (value-parts nil)
940 (refs nil)) 941 (refs nil))
1081 start 1082 start
1082 end 1083 end
1083 delimiter))) 1084 delimiter)))
1084 1085
1085 (defun xmltok-valid-char-p (n) 1086 (defun xmltok-valid-char-p (n)
1086 "Return non-nil if n is the Unicode code of a valid XML character." 1087 "Return non-nil if N is the Unicode code of a valid XML character."
1087 (cond ((< n #x20) (memq n '(#xA #xD #x9))) 1088 (cond ((< n #x20) (memq n '(#xA #xD #x9)))
1088 ((< n #xD800) t) 1089 ((< n #xD800) t)
1089 ((< n #xE000) nil) 1090 ((< n #xE000) nil)
1090 ((< n #xFFFE) t) 1091 ((< n #xFFFE) t)
1091 (t (and (> n #xFFFF) 1092 (t (and (> n #xFFFF)
1102 (defvar xmltok-doctype-external-subset-flag nil) 1103 (defvar xmltok-doctype-external-subset-flag nil)
1103 (defvar xmltok-internal-subset-start nil) 1104 (defvar xmltok-internal-subset-start nil)
1104 (defvar xmltok-had-param-entity-ref nil) 1105 (defvar xmltok-had-param-entity-ref nil)
1105 (defvar xmltok-prolog-regions nil) 1106 (defvar xmltok-prolog-regions nil)
1106 (defvar xmltok-standalone nil 1107 (defvar xmltok-standalone nil
1107 "Non-nil if there was an XML declaration specifying standalone=\"yes\",") 1108 "Non-nil if there was an XML declaration specifying standalone=\"yes\".")
1108 (defvar xmltok-markup-declaration-doctype-flag nil) 1109 (defvar xmltok-markup-declaration-doctype-flag nil)
1109 1110
1110 (defconst xmltok-predefined-entity-alist 1111 (defconst xmltok-predefined-entity-alist
1111 '(("lt" "<" . "<") 1112 '(("lt" "<" . "<")
1112 ("gt" ">" . ">") 1113 ("gt" ">" . ">")
1120 Returns a list of vectors [TYPE START END] where TYPE is a symbol and 1121 Returns a list of vectors [TYPE START END] where TYPE is a symbol and
1121 START and END are integers giving the start and end of the region of 1122 START and END are integers giving the start and end of the region of
1122 that type. TYPE can be one of xml-declaration, 1123 that type. TYPE can be one of xml-declaration,
1123 xml-declaration-attribute-name, xml-declaration-attribute-value, 1124 xml-declaration-attribute-name, xml-declaration-attribute-value,
1124 comment, processing-instruction-left, processing-instruction-right, 1125 comment, processing-instruction-left, processing-instruction-right,
1125 markup-declaration-open. markup-declaration-close, 1126 markup-declaration-open, markup-declaration-close,
1126 internal-subset-open, internal-subset-close, hash-name, keyword, 1127 internal-subset-open, internal-subset-close, hash-name, keyword,
1127 literal, encoding-name. 1128 literal, encoding-name.
1128 Adds to `xmltok-errors' and `xmltok-dependent-regions' as appropriate." 1129 Adds to `xmltok-errors' and `xmltok-dependent-regions' as appropriate."
1129 (let ((case-fold-search nil) 1130 (let ((case-fold-search nil)
1130 xmltok-start 1131 xmltok-start
1161 If there is a well-formed XML declaration starting at point and it 1162 If there is a well-formed XML declaration starting at point and it
1162 contains an encoding declaration, then return (START . END) 1163 contains an encoding declaration, then return (START . END)
1163 where START and END are the positions of the start and the end 1164 where START and END are the positions of the start and the end
1164 of the encoding name; if there is no encoding declaration return 1165 of the encoding name; if there is no encoding declaration return
1165 the position where and encoding declaration could be inserted. 1166 the position where and encoding declaration could be inserted.
1166 If there is XML that is not well-formed that looks like an XML declaration, 1167 If there is XML that is not well-formed that looks like an XML
1167 return nil. Otherwise, return t. 1168 declaration, return nil. Otherwise, return t.
1168 If LIMIT is non-nil, then do not consider characters beyond LIMIT." 1169 If LIMIT is non-nil, then do not consider characters beyond LIMIT."
1169 (cond ((let ((case-fold-search nil)) 1170 (cond ((let ((case-fold-search nil))
1170 (and (looking-at (xmltok-xml-declaration regexp)) 1171 (and (looking-at (xmltok-xml-declaration regexp))
1171 (or (not limit) (<= (match-end 0) limit)))) 1172 (or (not limit) (<= (match-end 0) limit))))
1172 (let ((end (xmltok-xml-declaration end encoding-value))) 1173 (let ((end (xmltok-xml-declaration end encoding-value)))
1175 (1- end)) 1176 (1- end))
1176 (or (xmltok-xml-declaration end version-value) 1177 (or (xmltok-xml-declaration end version-value)
1177 (+ (point) 5))))) 1178 (+ (point) 5)))))
1178 ((not (let ((case-fold-search t)) 1179 ((not (let ((case-fold-search t))
1179 (looking-at xmltok-bad-xml-decl-regexp)))))) 1180 (looking-at xmltok-bad-xml-decl-regexp))))))
1180 1181
1181 (defun xmltok-scan-xml-declaration () 1182 (defun xmltok-scan-xml-declaration ()
1182 (when (looking-at (xmltok-xml-declaration regexp)) 1183 (when (looking-at (xmltok-xml-declaration regexp))
1183 (xmltok-add-prolog-region 'xml-declaration (point) (match-end 0)) 1184 (xmltok-add-prolog-region 'xml-declaration (point) (match-end 0))
1184 (goto-char (match-end 0)) 1185 (goto-char (match-end 0))
1185 (when (xmltok-xml-declaration start version-name) 1186 (when (xmltok-xml-declaration start version-name)
1335 "#FIXED" 1336 "#FIXED"
1336 'literal) 1337 'literal)
1337 (when (string= (xmltok-current-token-string) "#FIXED") 1338 (when (string= (xmltok-current-token-string) "#FIXED")
1338 (xmltok-require-next-token 'literal)) 1339 (xmltok-require-next-token 'literal))
1339 t)))) 1340 t))))
1340 1341
1341 (defun xmltok-parse-nmtoken-group () 1342 (defun xmltok-parse-nmtoken-group ()
1342 (while (progn 1343 (while (progn
1343 (xmltok-require-next-token 'nmtoken 'prefixed-name 'name) 1344 (xmltok-require-next-token 'nmtoken 'prefixed-name 'name)
1344 (xmltok-require-next-token ?| ?\)) 1345 (xmltok-require-next-token ?| ?\))
1345 (eq xmltok-type ?|)))) 1346 (eq xmltok-type ?|))))
1376 (xmltok-require-next-token connector 1377 (xmltok-require-next-token connector
1377 ?\) 1378 ?\)
1378 'close-paren-star 1379 'close-paren-star
1379 'close-paren-occur) 1380 'close-paren-occur)
1380 (eq xmltok-type connector)))))) 1381 (eq xmltok-type connector))))))
1381 1382
1382 (defun xmltok-parse-model-group-member () 1383 (defun xmltok-parse-model-group-member ()
1383 (xmltok-require-token 'name 1384 (xmltok-require-token 'name
1384 'prefixed-name 1385 'prefixed-name
1385 'name-occur 1386 'name-occur
1386 ?\() 1387 ?\()
1387 (when (eq xmltok-type ?\() 1388 (when (eq xmltok-type ?\()
1388 (xmltok-next-prolog-token) 1389 (xmltok-next-prolog-token)
1389 (xmltok-parse-model-group))) 1390 (xmltok-parse-model-group)))
1390 1391
1391 (defun xmltok-parse-entity-declaration () 1392 (defun xmltok-parse-entity-declaration ()
1392 (let (paramp name) 1393 (let (paramp name)
1393 (xmltok-require-next-token 'name ?%) 1394 (xmltok-require-next-token 'name ?%)
1394 (when (eq xmltok-type ?%) 1395 (when (eq xmltok-type ?%)
1395 (setq paramp t) 1396 (setq paramp t)
1416 (when (and (or (not xmltok-had-param-entity-ref) 1417 (when (and (or (not xmltok-had-param-entity-ref)
1417 xmltok-standalone) 1418 xmltok-standalone)
1418 (not (assoc name xmltok-dtd))) 1419 (not (assoc name xmltok-dtd)))
1419 (setq xmltok-dtd 1420 (setq xmltok-dtd
1420 (cons (cons name value) xmltok-dtd)))) 1421 (cons (cons name value) xmltok-dtd))))
1421 1422
1422 (defun xmltok-parse-entity-value () 1423 (defun xmltok-parse-entity-value ()
1423 (let ((lim (1- (point))) 1424 (let ((lim (1- (point)))
1424 (well-formed t) 1425 (well-formed t)
1425 value-parts 1426 value-parts
1426 start) 1427 start)
1456 (if (not well-formed) 1457 (if (not well-formed)
1457 nil 1458 nil
1458 (apply 'concat 1459 (apply 'concat
1459 (nreverse (cons (buffer-substring-no-properties start lim) 1460 (nreverse (cons (buffer-substring-no-properties start lim)
1460 value-parts)))))) 1461 value-parts))))))
1461 1462
1462 (defun xmltok-parse-notation-declaration () 1463 (defun xmltok-parse-notation-declaration ()
1463 (xmltok-require-next-token 'name) 1464 (xmltok-require-next-token 'name)
1464 (xmltok-require-next-token "SYSTEM" "PUBLIC") 1465 (xmltok-require-next-token "SYSTEM" "PUBLIC")
1465 (let ((publicp (string= (xmltok-current-token-string) "PUBLIC"))) 1466 (let ((publicp (string= (xmltok-current-token-string) "PUBLIC")))
1466 (xmltok-require-next-token 'literal) 1467 (xmltok-require-next-token 'literal)
1541 (?> . markup-declaration-close) 1542 (?> . markup-declaration-close)
1542 (?\[ . internal-subset-open) 1543 (?\[ . internal-subset-open)
1543 (hash-name . hash-name))))) 1544 (hash-name . hash-name)))))
1544 ((and (stringp required) (eq xmltok-type 'name)) 1545 ((and (stringp required) (eq xmltok-type 'name))
1545 'keyword))) 1546 'keyword)))
1546 1547
1547 ;; Return new token type. 1548 ;; Return new token type.
1548 1549
1549 (defun xmltok-next-prolog-token () 1550 (defun xmltok-next-prolog-token ()
1550 (skip-chars-forward " \t\r\n") 1551 (skip-chars-forward " \t\r\n")
1551 (setq xmltok-start (point)) 1552 (setq xmltok-start (point))
1552 (cond ((not (and (looking-at (xmltok-prolog regexp)) 1553 (cond ((not (and (looking-at (xmltok-prolog regexp))
1553 (goto-char (match-end 0)))) 1554 (goto-char (match-end 0))))
1571 ((or (xmltok-prolog start ncname-nmtoken) 1572 ((or (xmltok-prolog start ncname-nmtoken)
1572 (xmltok-prolog start ncname-colon)) 1573 (xmltok-prolog start ncname-colon))
1573 (unless (looking-at "[ \t\r\n>),|[%]") 1574 (unless (looking-at "[ \t\r\n>),|[%]")
1574 (xmltok-add-error "Missing space after name token")) 1575 (xmltok-add-error "Missing space after name token"))
1575 (setq xmltok-type 'nmtoken)) 1576 (setq xmltok-type 'nmtoken))
1576 ((xmltok-prolog start name) 1577 ((xmltok-prolog start name)
1577 (setq xmltok-name-end (point)) 1578 (setq xmltok-name-end (point))
1578 (setq xmltok-name-colon nil) 1579 (setq xmltok-name-colon nil)
1579 (unless (looking-at "[ \t\r\n>),|[%]") 1580 (unless (looking-at "[ \t\r\n>),|[%]")
1580 (xmltok-add-error "Missing space after name")) 1581 (xmltok-add-error "Missing space after name"))
1581 (setq xmltok-type 'name)) 1582 (setq xmltok-type 'name))
1582 ((xmltok-prolog start hash-name) 1583 ((xmltok-prolog start hash-name)
1583 (setq xmltok-name-end (point)) 1584 (setq xmltok-name-end (point))
1584 (unless (looking-at "[ \t\r\n>)|%]") 1585 (unless (looking-at "[ \t\r\n>)|%]")
1585 (xmltok-add-error "Missing space after name")) 1586 (xmltok-add-error "Missing space after name"))
1586 (setq xmltok-type 'hash-name)) 1587 (setq xmltok-type 'hash-name))
1587 ((xmltok-prolog start processing-instruction-question) 1588 ((xmltok-prolog start processing-instruction-question)
1746 (not xmltok-standalone)) 1747 (not xmltok-standalone))
1747 (setq xmltok-dtd (cons t xmltok-dtd))) 1748 (setq xmltok-dtd (cons t xmltok-dtd)))
1748 (while todo 1749 (while todo
1749 (xmltok-parse-entity (car todo)) 1750 (xmltok-parse-entity (car todo))
1750 (setq todo (cdr todo))))) 1751 (setq todo (cdr todo)))))
1751 1752
1752 (defun xmltok-parse-entity (name-def) 1753 (defun xmltok-parse-entity (name-def)
1753 (let ((def (cdr name-def)) 1754 (let ((def (cdr name-def))
1754 ;; in case its value is buffer local 1755 ;; in case its value is buffer local
1755 (xmltok-dtd xmltok-dtd) 1756 (xmltok-dtd xmltok-dtd)
1756 buf) 1757 buf)
1757 (when (stringp def) 1758 (when (stringp def)
1758 (if (string-match "\\`[^&<\t\r\n]*\\'" def) 1759 (if (string-match "\\`[^&<\t\r\n]*\\'" def)
1759 (setcdr name-def (cons def def)) 1760 (setcdr name-def (cons def def))
1853 (if (eq (car xmltok-dtd) t) 1854 (if (eq (car xmltok-dtd) t)
1854 nil 1855 nil
1855 'not-well-formed)) 1856 'not-well-formed))
1856 ((eq def 'unparsed) 'not-well-formed) 1857 ((eq def 'unparsed) 'not-well-formed)
1857 (t def))))) 1858 (t def)))))
1858 1859
1859 (defun xmltok-append-entity-def (d1 d2) 1860 (defun xmltok-append-entity-def (d1 d2)
1860 (cond ((consp d1) 1861 (cond ((consp d1)
1861 (if (consp d2) 1862 (if (consp d2)
1862 (cons (concat (car d1) (car d2)) 1863 (cons (concat (car d1) (car d2))
1863 (and (cdr d1) 1864 (and (cdr d1)
1876 (setq xmltok-prolog-regions 1877 (setq xmltok-prolog-regions
1877 (cons (vector type start end) 1878 (cons (vector type start end)
1878 xmltok-prolog-regions))) 1879 xmltok-prolog-regions)))
1879 1880
1880 (defun xmltok-merge-attributes () 1881 (defun xmltok-merge-attributes ()
1881 "Return a list merging `xmltok-attributes' and 'xmltok-namespace-attributes'. 1882 "Return a list merging `xmltok-attributes' and `xmltok-namespace-attributes'.
1882 The members of the merged list are in order of occurrence in the 1883 The members of the merged list are in order of occurrence in the
1883 document. The list may share list structure with `xmltok-attributes' 1884 document. The list may share list structure with `xmltok-attributes'
1884 and `xmltok-namespace-attributes'." 1885 and `xmltok-namespace-attributes'."
1885 (cond ((not xmltok-namespace-attributes) 1886 (cond ((not xmltok-namespace-attributes)
1886 xmltok-attributes) 1887 xmltok-attributes)