[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: narrow-to-here-document
From: |
Kevin Rodgers |
Subject: |
Re: narrow-to-here-document |
Date: |
Wed, 25 Jun 2003 10:58:51 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Masatake YAMATO wrote:
I've reflected suggestions to my code.
...
Kevin Rodgers:
3.
Would INCLUDE/IGNORE/CDATA marked sections in SGML/XML/HTML qualify?
<![CDATA[
No <tag>s or &entity; references are recognized here.
]]>
...
;;
;; sgml-mode
;;
(defvar sgml-here-document-beginning-regexp "<!\\[\\([A-Z]+\\)\\[")
SGML actually allows zero or more status keywords (separated by one or
more parameter separators, and followed by zero or more parameter
separators) between the marked section start (<![) and the declaration
subset open ([). The status keywords are CDATA, IGNORE, INCLUDE,
and RCDATA, and TEMP. A parameter separator is a whitespace character
(space, linefeed, carriage return, or tab), a parameter entity
reference, or a comment:
(defvar sgml-status-keyword-regexp
;; 10.4.2 Status Keyword Specification [100]
"CDATA\\|IGNORE\\|INCLUDE\\|RCDATA")
(defvar sgml-s-regexp "[ \r\n\t]") ; 6.2.1 s Separator [5]
(defvar sgml-parameter-entity-reference-regexp
;; 9.4.4 Named Entity References [60]
"%[a-zA-Z][a-zA-Z0-9---.]*[;\r\n]")
(defvar sgml-comment-regexp "--.*--") ; 10.3 Comment Declaration [92]
(defvar sgml-parameter-separator ; 10.1.1 Parameter Separator [65]
(format "%s\\|%s\\|\\%s"
sgml-s-regexp
sgml-parameter-entity-reference-regexp
sgml-comment-regexp))
(defvar sgml-here-document-beginning-regexp
;; 10.4 Marked Section Declaration [93], [94]
;; 10.4.2 Status Keyword Specification [97]
(format "<!\\[\\(\\(%s\\)+\\(%s\\|TEMP\\)\\)*\\(%s\\)*\\["
sgml-parameter-separator-reference-regexp
sgml-status-keyword-regexp
sgml-parameter-separator-reference-regexp))
XML only allows "<![CDATA[" (with no intervening characters at all):
(defvar xml-here-document-beginning-regexp ; 2.1 CDATA Sections [18], [19]
"<!\\[\\(CDATA\\)\\[")
(defvar sgml-here-document-end-regexp "]]>")
(defun sgml-here-document-region ()
(let (beginning end)
(save-excursion
(save-match-data
(when (re-search-backward
sgml-here-document-beginning-regexp
(point-min) t)
(setq beginning (match-end 0))
(when (re-search-forward
sgml-here-document-end-regexp
(point-max) t)
(setq end (match-beginning 0))))))
(if (and beginning end (<= (point) end))
(cons beginning end))))
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
- Re: narrow-to-here-document, (continued)
- Re: narrow-to-here-document, Kim F. Storm, 2003/06/25
- Re: narrow-to-here-document, Richard Stallman, 2003/06/26
- Re: narrow-to-here-document, Stefan Daschek, 2003/06/25
- mmm-mode.el(Re: narrow-to-here-document), Masatake YAMATO, 2003/06/26
- Re: narrow-to-here-document, David Kastrup, 2003/06/26
- Re: narrow-to-here-document, Alan Shutko, 2003/06/29
- Re: narrow-to-here-document, Miles Bader, 2003/06/29
- Re: narrow-to-here-document, Kai Großjohann, 2003/06/30
- Re: narrow-to-here-document, David Kastrup, 2003/06/30
- Re: narrow-to-here-document, Kai Großjohann, 2003/06/30
- Re: narrow-to-here-document,
Kevin Rodgers <=
Message not available
- Re: narrow-to-here-document, Richard Stallman, 2003/06/26
- Re: narrow-to-here-document, Miles Bader, 2003/06/26
- Re: narrow-to-here-document, Tak Ota, 2003/06/26
- Re: narrow-to-here-document, Miles Bader, 2003/06/26
- Re: narrow-to-here-document, David Kastrup, 2003/06/27
Re: narrow-to-here-document, Richard Stallman, 2003/06/26