comparison lisp/w3/css.el @ 165:5a88923fcbfe r20-3b9

Import from CVS: tag r20-3b9
author cvs
date Mon, 13 Aug 2007 09:44:42 +0200
parents b980b6286996
children
comparison
equal deleted inserted replaced
164:4e0740e5aab2 165:5a88923fcbfe
1 ;;; css.el -- Cascading Style Sheet parser 1 ;;; css.el -- Cascading Style Sheet parser
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1997/04/21 14:00:12 3 ;; Created: 1997/05/11 00:54:23
4 ;; Version: 1.38 4 ;; Version: 1.39
5 ;; Keywords: 5 ;; Keywords:
6 6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu) 8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. 9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
900 ;; with the <style> tag from older browsers. 900 ;; with the <style> tag from older browsers.
901 ((or (looking-at "<!--+") ; begin 901 ((or (looking-at "<!--+") ; begin
902 (looking-at "--+>")) ; end 902 (looking-at "--+>")) ; end
903 (goto-char (match-end 0))) 903 (goto-char (match-end 0)))
904 ;; C++ style comments 904 ;; C++ style comments
905 ((looking-at "//") 905 ((looking-at "[ \t]*//")
906 (end-of-line)) 906 (end-of-line))
907 ;; Pre-Processor directives 907 ;; Pre-Processor directives
908 ((looking-at "[ \t\r]*@\\([^ \t\r\n]\\)") 908 ((looking-at "[ \t\r]*@\\([^ \t\r\n]\\)")
909 (let (data directive) 909 (let (data directive)
910 (skip-chars-forward " @\t\r") ; Past any leading whitespace 910 (skip-chars-forward " @\t\r") ; Past any leading whitespace
913 (downcase-region save-pos (point)) 913 (downcase-region save-pos (point))
914 (setq directive (intern (buffer-substring save-pos (point)))) 914 (setq directive (intern (buffer-substring save-pos (point))))
915 (skip-chars-forward " \t\r") 915 (skip-chars-forward " \t\r")
916 (setq save-pos (point)) 916 (setq save-pos (point))
917 (cond 917 (cond
918 ((looking-at ".*\\({\\)") 918 ((looking-at "[^{]*\\({\\)")
919 (goto-char (match-beginning 1)) 919 (goto-char (match-beginning 1))
920 (forward-sexp 1) 920 (forward-sexp 1)
921 (setq data (buffer-substring save-pos (1- (point))))) 921 (setq data (buffer-substring save-pos (1- (point)))))
922 ((looking-at "[\"']+") 922 ((looking-at "[\"']+")
923 (setq save-pos (1+ save-pos)) 923 (setq save-pos (1+ save-pos))
952 (skip-chars-forward "^{") 952 (skip-chars-forward "^{")
953 (setq save-pos (point)) 953 (setq save-pos (point))
954 (condition-case () 954 (condition-case ()
955 (forward-sexp 1) 955 (forward-sexp 1)
956 (error (goto-char (point-max)))) 956 (error (goto-char (point-max))))
957 (end-of-line)
958 (skip-chars-backward "\r}") 957 (skip-chars-backward "\r}")
959 (subst-char-in-region save-pos (point) ?\n ? ) 958 (subst-char-in-region save-pos (point) ?\n ? )
960 (subst-char-in-region save-pos (point) ?\r ? ) 959 (subst-char-in-region save-pos (point) ?\r ? )
961 ;; This is for not choking on garbage at the end of the buffer. 960 ;; This is for not choking on garbage at the end of the buffer.
962 ;; I get bit by this every once in a while when going through my 961 ;; I get bit by this every once in a while when going through my