comparison lisp/progmodes/ebnf2ps.el @ 34803:de1f65fa5dcd

Fix a problem with skip-chars-forward: it doesn't accept ranges like \177-\237, but accepts the character sequence from \177 to \237. Doc fix. (ebnf-version): New version (3.4). (ebnf-setup): Code fix. (ebnf-range-regexp): New fun. (ebnf-8-bit-chars): Const fix.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 21 Dec 2000 21:22:34 +0000
parents 81113bfa57a5
children c2604e531b66
comparison
equal deleted inserted replaced
34802:d0237aa9a10d 34803:de1f65fa5dcd
3 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 4
5 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> 5 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
6 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 6 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
7 ;; Keywords: wp, ebnf, PostScript 7 ;; Keywords: wp, ebnf, PostScript
8 ;; Time-stamp: <2000/08/27 14:24:32 vinicius> 8 ;; Time-stamp: <2000/12/19 15:17:15 vinicius>
9 ;; Version: 3.3 9 ;; Version: 3.4
10 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/Emacs.html 10 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/Emacs.html
11 11
12 ;; This file is part of GNU Emacs. 12 ;; This file is part of GNU Emacs.
13 13
14 ;; GNU Emacs is free software; you can redistribute it and/or modify 14 ;; GNU Emacs is free software; you can redistribute it and/or modify
24 ;; You should have received a copy of the GNU General Public License 24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA. 27 ;; Boston, MA 02111-1307, USA.
28 28
29 (defconst ebnf-version "3.3" 29 (defconst ebnf-version "3.4"
30 "ebnf2ps.el, v 3.2 <2000/08/27 vinicius> 30 "ebnf2ps.el, v 3.4 <2000/12/19 vinicius>
31 31
32 Vinicius's last change version. When reporting bugs, please also 32 Vinicius's last change version. When reporting bugs, please also
33 report the version of Emacs, if any, that ebnf2ps was running with. 33 report the version of Emacs, if any, that ebnf2ps was running with.
34 34
35 Please send all bug fixes and enhancements to 35 Please send all bug fixes and enhancements to
1879 ;;;###autoload 1879 ;;;###autoload
1880 (defun ebnf-setup () 1880 (defun ebnf-setup ()
1881 "Return the current ebnf2ps setup." 1881 "Return the current ebnf2ps setup."
1882 (format 1882 (format
1883 " 1883 "
1884 ;;; ebnf2ps.el version %s
1885
1884 \(setq ebnf-special-font %s 1886 \(setq ebnf-special-font %s
1885 ebnf-special-shape %s 1887 ebnf-special-shape %s
1886 ebnf-special-shadow %S 1888 ebnf-special-shadow %S
1887 ebnf-special-border-width %S 1889 ebnf-special-border-width %S
1888 ebnf-special-border-color %S 1890 ebnf-special-border-color %S
1931 ebnf-debug-ps %S 1933 ebnf-debug-ps %S
1932 ebnf-use-float-format %S 1934 ebnf-use-float-format %S
1933 ebnf-yac-ignore-error-recovery %S 1935 ebnf-yac-ignore-error-recovery %S
1934 ebnf-ignore-empty-rule %S 1936 ebnf-ignore-empty-rule %S
1935 ebnf-optimize %S) 1937 ebnf-optimize %S)
1938
1939 ;;; ebnf2ps.el - end of settings
1936 " 1940 "
1941 ebnf-version
1937 (ps-print-quote ebnf-special-font) 1942 (ps-print-quote ebnf-special-font)
1938 (ps-print-quote ebnf-special-shape) 1943 (ps-print-quote ebnf-special-shape)
1939 ebnf-special-shadow 1944 ebnf-special-shadow
1940 ebnf-special-border-width 1945 ebnf-special-border-width
1941 ebnf-special-border-color 1946 ebnf-special-border-color
4096 "\n"))) 4101 "\n")))
4097 4102
4098 4103
4099 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4100 ;; Internal functions 4105 ;; Internal functions
4106
4107
4108 ;; function `ebnf-range-regexp' is used to avoid a bug of `skip-chars-forward'
4109 ;; on version 20.4.1, that is, it doesn't accept ranges like "\240-\377" (or
4110 ;; "\177-\237"), but it accepts the character sequence from \240 to \377 (or
4111 ;; from \177 to \237). It seems that version 20.7 has the same problem.
4112 (defun ebnf-range-regexp (prefix from to)
4113 (let (str)
4114 (while (<= from to)
4115 (setq str (concat str (char-to-string from))
4116 from (1+ from)))
4117 (concat prefix str)))
4101 4118
4102 4119
4103 (defvar ebnf-map-name 4120 (defvar ebnf-map-name
4104 (let ((map (make-vector 256 ?\_))) 4121 (let ((map (make-vector 256 ?\_)))
4105 (mapcar #'(lambda (char) 4122 (mapcar #'(lambda (char)
4942 (progn 4959 (progn
4943 (skip-chars-forward chars ebnf-limit) 4960 (skip-chars-forward chars ebnf-limit)
4944 (point)))) 4961 (point))))
4945 4962
4946 4963
4947 ;; to avoid a bug of `skip-chars-forward' on version 20.4.1, that is, it 4964 ;; replace the range "\240-\377" (see `ebnf-range-regexp').
4948 ;; doesn't accept the range "\240-\377", but it accepts the character sequence 4965 (defconst ebnf-8-bit-chars (ebnf-range-regexp "" ?\240 ?\377))
4949 ;; from \240 to \377. It seems that version 20.7 has the same problem.
4950 (defconst ebnf-8-bit-chars
4951 (let ((char ?\240)
4952 str)
4953 (while (<= char ?\377)
4954 (setq str (concat str (char-to-string char))
4955 char (1+ char)))
4956 str))
4957 4966
4958 4967
4959 (defun ebnf-string (chars eos-char kind) 4968 (defun ebnf-string (chars eos-char kind)
4960 (forward-char) 4969 (forward-char)
4961 (buffer-substring-no-properties 4970 (buffer-substring-no-properties