/[emacs]/emacs/lisp/textmodes/sgml-mode.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/sgml-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.76 by mdub, Wed Apr 3 12:12:59 2002 UTC revision 1.77 by mdub, Wed Apr 3 21:17:38 2002 UTC
# Line 872  If non-nil LIMIT is a nearby position be Line 872  If non-nil LIMIT is a nearby position be
872    ;; any string or tag or comment or ...    ;; any string or tag or comment or ...
873    (save-excursion    (save-excursion
874      (let ((pos (point))      (let ((pos (point))
875            text-start cdata-start state)            text-start state)
876        (if limit (goto-char limit)        (if limit (goto-char limit)
877          ;; Hopefully this regexp will match something that's not inside          ;; Hopefully this regexp will match something that's not inside
878          ;; a tag and also hopefully the match is nearby.          ;; a tag and also hopefully the match is nearby.
879          (re-search-backward "^[ \t]*<[_:[:alpha:]/%!?#]" nil 'move))          (re-search-backward "^[ \t]*<[_:[:alpha:]/%!?#]" nil 'move))
       ;; (setq text-start (point))  
880        (with-syntax-table sgml-tag-syntax-table        (with-syntax-table sgml-tag-syntax-table
881          (while (< (point) pos)          (while (< (point) pos)
882            ;; When entering this loop we're inside text.            ;; When entering this loop we're inside text.
883            (setq text-start (point))            (setq text-start (point))
884            (skip-chars-forward "^<" pos)            (skip-chars-forward "^<" pos)
885            (setq cdata-start (if (looking-at "<!\\[[A-Z]+\\[") (point)))            (setq state
886            ;; We skipped text and reached a tag.  Parse it.                  (cond
887            ;; FIXME: Handle net-enabling start-tags                   ((= (point) pos)
888            (if cdata-start                    ;; We got to the end without seeing a tag.
889                (search-forward "]]>" pos 'move)                    nil)
890              (setq state (parse-partial-sexp (point) pos 0))))                   ((looking-at "<!\\[[A-Z]+\\[")
891          (cond                    ;; We've found a CDATA section or similar.
892           (cdata-start  (cons 'cdata cdata-start))                    (let ((cdata-start (point)))
893           ((nth 3 state) (cons 'string (nth 8 state)))                      (unless (search-forward "]]>" pos 'move)
894           ((nth 4 state) (cons 'comment (nth 8 state)))                        (list 0 nil nil 'cdata nil nil nil nil cdata-start))))
895           ((and state (> (nth 0 state) 0)) (cons 'tag (nth 1 state)))                   (t
896           (t (cons 'text text-start)))))))                    ;; We've reached a tag.  Parse it.
897                      ;; FIXME: Handle net-enabling start-tags
898                      (parse-partial-sexp (point) pos 0))))))
899          (cond
900           ((eq (nth 3 state) 'cdata) (cons 'cdata (nth 8 state)))
901           ((nth 3 state) (cons 'string (nth 8 state)))
902           ((nth 4 state) (cons 'comment (nth 8 state)))
903           ((and state (> (nth 0 state) 0)) (cons 'tag (nth 1 state)))
904           (t (cons 'text text-start))))))
905    
906  (defun sgml-beginning-of-tag (&optional top-level)  (defun sgml-beginning-of-tag (&optional top-level)
907    "Skip to beginning of tag and return its name.    "Skip to beginning of tag and return its name.

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26