aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Jose Latorre2004-04-05 02:00:42 +0000
committerVinicius Jose Latorre2004-04-05 02:00:42 +0000
commit6411a60a71653b232e4606d7e40cbbf3cb91f663 (patch)
tree974534ed63f2314681959e3ae27fdad299357d4f
parent074930457dbb756869e70b4e30a079fcdb0efc85 (diff)
downloademacs-6411a60a71653b232e4606d7e40cbbf3cb91f663.tar.gz
emacs-6411a60a71653b232e4606d7e40cbbf3cb91f663.zip
ebnf2ps 4.2
-rw-r--r--lisp/ChangeLog31
-rw-r--r--lisp/progmodes/ebnf-abn.el10
-rw-r--r--lisp/progmodes/ebnf-bnf.el16
-rw-r--r--lisp/progmodes/ebnf-ebx.el10
-rw-r--r--lisp/progmodes/ebnf-iso.el18
-rw-r--r--lisp/progmodes/ebnf-yac.el22
-rw-r--r--lisp/progmodes/ebnf2ps.el99
7 files changed, 135 insertions, 71 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cf38476e364..cb27984f971 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -8,6 +8,37 @@
8 * format.el (format-write-file): Add optional argument CONFIRM 8 * format.el (format-write-file): Add optional argument CONFIRM
9 and make it behave like the analogous argument to `write-file'. 9 and make it behave like the analogous argument to `write-file'.
10 10
112004-04-04 Vinicius Jose Latorre <viniciusjl@ig.com.br>
12
13 * progmodes/ebnf2ps.el: Doc fix.
14 (ebnf-version): New version number (4.2).
15 (ebnf-syntax): Customization and docstring fix.
16 (ebnf-eliminate-empty-rules, ebnf-optimize, ebnf-otz-initialize): Put
17 autoloaded funs before first use.
18 (ebnf-style-database): Add dtd entry.
19 (ebnf-syntax-alist): Add dtd initialization.
20 (ebnf-token-sequence): New fun.
21 (ebnf-comment-table): Add new comment action character.
22 (ebnf-dtd-parser, ebnf-dtd-initialize): Autoloaded funs from ebnf-dtd.
23
24 * progmodes/ebnf-dtd.el: New file, implement a parser for DTD (Data
25 Type Definition for XML).
26
27 * progmodes/ebnf-abn.el (ebnf-abn-concatenation): Code simplification:
28 call ebnf-token-sequence.
29
30 * progmodes/ebnf-bnf.el (ebnf-sequence): Code simplification: call
31 ebnf-token-sequence.
32
33 * progmodes/ebnf-ebx.el (ebnf-ebx-concatenation): Code simplification:
34 call ebnf-token-sequence.
35
36 * progmodes/ebnf-iso.el (ebnf-iso-single-definition): Code
37 simplification: call ebnf-token-sequence.
38
39 * progmodes/ebnf-yac.el (ebnf-yac-sequence): Code simplification: call
40 ebnf-token-sequence.
41
112004-04-04 Eli Zaretskii <eliz@gnu.org> 422004-04-04 Eli Zaretskii <eliz@gnu.org>
12 43
13 * calendar/timeclock.el (timeclock-relative) 44 * calendar/timeclock.el (timeclock-relative)
diff --git a/lisp/progmodes/ebnf-abn.el b/lisp/progmodes/ebnf-abn.el
index e41d27d0c1f..35771a10f32 100644
--- a/lisp/progmodes/ebnf-abn.el
+++ b/lisp/progmodes/ebnf-abn.el
@@ -4,9 +4,9 @@
4 4
5;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 5;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
6;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Time-stamp: <2004/03/18 23:49:58 vinicius> 7;; Time-stamp: <2004/04/03 16:43:57 vinicius>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.0 9;; Version: 1.1
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -316,11 +316,7 @@
316 term (cdr term)) 316 term (cdr term))
317 (setq seq (cons term seq))) 317 (setq seq (cons term seq)))
318 (cons token 318 (cons token
319 (if (= (length seq) 1) 319 (ebnf-token-sequence seq))))
320 ;; sequence with only one element
321 (car seq)
322 ;; a real sequence
323 (ebnf-make-sequence (nreverse seq))))))
324 320
325 321
326;;; repetition = [repeat] element 322;;; repetition = [repeat] element
diff --git a/lisp/progmodes/ebnf-bnf.el b/lisp/progmodes/ebnf-bnf.el
index 4f0ef6099c8..d32ad5a77c9 100644
--- a/lisp/progmodes/ebnf-bnf.el
+++ b/lisp/progmodes/ebnf-bnf.el
@@ -5,9 +5,9 @@
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Time-stamp: <2004/02/28 18:25:52 vinicius> 8;; Time-stamp: <2004/04/03 16:42:18 vinicius>
9;; Keywords: wp, ebnf, PostScript 9;; Keywords: wp, ebnf, PostScript
10;; Version: 1.8 10;; Version: 1.9
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -206,17 +206,7 @@
206 term (cdr term)) 206 term (cdr term))
207 (setq seq (cons term seq))) 207 (setq seq (cons term seq)))
208 (cons token 208 (cons token
209 (cond 209 (ebnf-token-sequence seq))))
210 ;; null sequence
211 ((null seq)
212 (ebnf-make-empty))
213 ;; sequence with only one element
214 ((= (length seq) 1)
215 (car seq))
216 ;; a real sequence
217 (t
218 (ebnf-make-sequence (nreverse seq)))
219 ))))
220 210
221 211
222;;; exception = repeat [ "-" repeat]. 212;;; exception = repeat [ "-" repeat].
diff --git a/lisp/progmodes/ebnf-ebx.el b/lisp/progmodes/ebnf-ebx.el
index 4e9fc24ade1..d7dfa7af89f 100644
--- a/lisp/progmodes/ebnf-ebx.el
+++ b/lisp/progmodes/ebnf-ebx.el
@@ -4,9 +4,9 @@
4 4
5;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 5;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
6;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Time-stamp: <2004/03/22 08:53:21 vinicius> 7;; Time-stamp: <2004/04/03 16:45:34 vinicius>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.0 9;; Version: 1.1
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -282,11 +282,7 @@
282 term (cdr term)) 282 term (cdr term))
283 (setq seq (cons term seq))) 283 (setq seq (cons term seq)))
284 (cons token 284 (cons token
285 (if (= (length seq) 1) 285 (ebnf-token-sequence seq))))
286 ;; sequence with only one element
287 (car seq)
288 ;; a real sequence
289 (ebnf-make-sequence (nreverse seq))))))
290 286
291 287
292;;; exception ::= term ('-' term)? 288;;; exception ::= term ('-' term)?
diff --git a/lisp/progmodes/ebnf-iso.el b/lisp/progmodes/ebnf-iso.el
index 0d9977d7084..f36065bd558 100644
--- a/lisp/progmodes/ebnf-iso.el
+++ b/lisp/progmodes/ebnf-iso.el
@@ -5,9 +5,9 @@
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Time-stamp: <2004/02/29 18:31:33 vinicius> 8;; Time-stamp: <2004/04/03 16:48:52 vinicius>
9;; Keywords: wp, ebnf, PostScript 9;; Keywords: wp, ebnf, PostScript
10;; Version: 1.7 10;; Version: 1.8
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -203,17 +203,9 @@
203 (eq token 'catenate)) 203 (eq token 'catenate))
204 (setq seq (cons term seq))) 204 (setq seq (cons term seq)))
205 (cons token 205 (cons token
206 (cond 206 (ebnf-token-sequence (if term
207 ;; null sequence 207 (cons term seq)
208 ((null seq) 208 seq)))))
209 term)
210 ;; sequence with only one element
211 ((and (null term) (= (length seq) 1))
212 (car seq))
213 ;; a real sequence
214 (t
215 (ebnf-make-sequence (nreverse (cons term seq))))
216 ))))
217 209
218 210
219;;; term = factor, ['-', exception]; 211;;; term = factor, ['-', exception];
diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el
index ff097b5195d..c7bf0e31541 100644
--- a/lisp/progmodes/ebnf-yac.el
+++ b/lisp/progmodes/ebnf-yac.el
@@ -5,9 +5,9 @@
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Time-stamp: <2004/02/29 20:23:29 vinicius> 8;; Time-stamp: <2004/04/03 16:50:46 vinicius>
9;; Keywords: wp, ebnf, PostScript 9;; Keywords: wp, ebnf, PostScript
10;; Version: 1.2.1 10;; Version: 1.3
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -218,20 +218,10 @@
218 factor (ebnf-yac-factor token)) 218 factor (ebnf-yac-factor token))
219 (setq seq (cons factor seq))) 219 (setq seq (cons factor seq)))
220 (cons token 220 (cons token
221 (cond 221 (if (and ebnf-yac-ignore-error-recovery ebnf-yac-error)
222 ;; ignore error recovery 222 ;; ignore error recovery
223 ((and ebnf-yac-ignore-error-recovery ebnf-yac-error) 223 nil
224 nil) 224 (ebnf-token-sequence seq)))))
225 ;; null sequence
226 ((null seq)
227 (ebnf-make-empty))
228 ;; sequence with only one element
229 ((= (length seq) 1)
230 (car seq))
231 ;; a real sequence
232 (t
233 (ebnf-make-sequence (nreverse seq)))
234 ))))
235 225
236 226
237;;; Factor = Name 227;;; Factor = Name
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index 56125cbea5a..e45a7ee510e 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -5,9 +5,9 @@
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Time-stamp: <2004/03/30 21:49:21 vinicius> 8;; Time-stamp: <2004/04/04 21:40:30 vinicius>
9;; Keywords: wp, ebnf, PostScript 9;; Keywords: wp, ebnf, PostScript
10;; Version: 4.1 10;; Version: 4.2
11;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ 11;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
12 12
13;; This file is part of GNU Emacs. 13;; This file is part of GNU Emacs.
@@ -27,8 +27,8 @@
27;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 27;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28;; Boston, MA 02111-1307, USA. 28;; Boston, MA 02111-1307, USA.
29 29
30(defconst ebnf-version "4.1" 30(defconst ebnf-version "4.2"
31 "ebnf2ps.el, v 4.1 <2004/03/18 vinicius> 31 "ebnf2ps.el, v 4.2 <2004/04/04 vinicius>
32 32
33Vinicius's last change version. When reporting bugs, please also 33Vinicius's last change version. When reporting bugs, please also
34report the version of Emacs, if any, that ebnf2ps was running with. 34report the version of Emacs, if any, that ebnf2ps was running with.
@@ -177,9 +177,36 @@ Please send all bug fixes and enhancements to
177;; (global-set-key '(control f22) 'ebnf-despool) 177;; (global-set-key '(control f22) 'ebnf-despool)
178;; 178;;
179;; 179;;
180;; Invoking Ebnf2ps in Batch
181;; -------------------------
182;;
183;; It's possible also to run ebnf2ps in batch, this is useful when, for
184;; example, you have a directory with a lot of files containing the EBNF to be
185;; translated to PostScript.
186;;
187;; To run ebnf2ps in batch type, for example:
188;;
189;; emacs -batch -l setup-ebnf2ps.el -f ebnf-eps-directory
190;;
191;; Where setup-ebnf2ps.el should be a file containing:
192;;
193;; ;; set load-path if ebnf2ps isn't installed in your Emacs environment
194;; (setq load-path (append (list "/dir/of/ebnf2ps") load-path))
195;; (require 'ebnf2ps)
196;; ;; insert here your ebnf2ps settings
197;; (setq ebnf-terminal-shape 'bevel)
198;; ;; etc.
199;;
200;;
180;; EBNF Syntax 201;; EBNF Syntax
181;; ----------- 202;; -----------
182;; 203;;
204;; BNF (Backus Naur Form) notation is defined like languages, and like
205;; languages there are rules about name formation and syntax. In this section
206;; it's defined a BNF syntax that it's called simply EBNF (Extended BNF).
207;; ebnf2ps package also deal with other BNF notation. Please, see the variable
208;; `ebnf-syntax' documentation below in this section.
209;;
183;; The current EBNF that ebnf2ps accepts has the following constructions: 210;; The current EBNF that ebnf2ps accepts has the following constructions:
184;; 211;;
185;; ; comment (until end of line) 212;; ; comment (until end of line)
@@ -324,6 +351,10 @@ Please send all bug fixes and enhancements to
324;; `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation' 351;; `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation'
325;; ("Extensible Markup Language (XML) 1.0 (Third Edition)") 352;; ("Extensible Markup Language (XML) 1.0 (Third Edition)")
326;; 353;;
354;; `dtd' ebnf2ps recognizes the syntax described in the URL:
355;; `http://www.w3.org/TR/2004/REC-xml-20040204/'
356;; ("Extensible Markup Language (XML) 1.0 (Third Edition)")
357;;
327;; Any other value is treated as `ebnf'. 358;; Any other value is treated as `ebnf'.
328;; 359;;
329;; The default value is `ebnf'. 360;; The default value is `ebnf'.
@@ -395,6 +426,8 @@ Please send all bug fixes and enhancements to
395;; 426;;
396;; ebnf2ps accepts the following actions in comments: 427;; ebnf2ps accepts the following actions in comments:
397;; 428;;
429;; ;^ same as form feed. See section Form Feed above.
430;;
398;; ;> the next production starts in the same line as the current one. 431;; ;> the next production starts in the same line as the current one.
399;; It is useful when `ebnf-horizontal-orientation' is nil. 432;; It is useful when `ebnf-horizontal-orientation' is nil.
400;; 433;;
@@ -459,8 +492,8 @@ Please send all bug fixes and enhancements to
459;; Only the ;> will take effect, that is, A and B will be drawn in the same 492;; Only the ;> will take effect, that is, A and B will be drawn in the same
460;; line. 493;; line.
461;; 494;;
462;; In ISO EBNF the above actions are specified as (*>*), (*<*), (*[EPS*) and 495;; In ISO EBNF the above actions are specified as (*^*), (*>*), (*<*), (*[EPS*)
463;; (*]EPS*). The first example above should be written: 496;; and (*]EPS*). The first example above should be written:
464;; 497;;
465;; A = t; 498;; A = t;
466;; C = x; 499;; C = x;
@@ -1687,10 +1720,14 @@ Valid values are:
1687 `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation' 1720 `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation'
1688 (\"Extensible Markup Language (XML) 1.0 (Third Edition)\") 1721 (\"Extensible Markup Language (XML) 1.0 (Third Edition)\")
1689 1722
1723 `dtd' ebnf2ps recognizes the syntax described in the URL:
1724 `http://www.w3.org/TR/2004/REC-xml-20040204/'
1725 (\"Extensible Markup Language (XML) 1.0 (Third Edition)\")
1726
1690Any other value is treated as `ebnf'." 1727Any other value is treated as `ebnf'."
1691 :type '(radio :tag "Syntax" 1728 :type '(radio :tag "Syntax"
1692 (const ebnf) (const abnf) (const iso-ebnf) 1729 (const ebnf) (const abnf) (const iso-ebnf)
1693 (const yacc) (const ebnfx)) 1730 (const yacc) (const ebnfx) (const dtd))
1694 :group 'ebnf-syntactic) 1731 :group 'ebnf-syntactic)
1695 1732
1696 1733
@@ -1885,6 +1922,21 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'."
1885 1922
1886 1923
1887;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1924;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1925;; To make this file smaller, some commands go in a separate file.
1926;; But autoload them here to make the separation invisible.
1927;; Autoload is here to avoid compilation gripes.
1928
1929(autoload 'ebnf-eliminate-empty-rules "ebnf-otz"
1930 "Eliminate empty rules.")
1931
1932(autoload 'ebnf-optimize "ebnf-otz"
1933 "Syntactic chart optimizer.")
1934
1935(autoload 'ebnf-otz-initialize "ebnf-otz"
1936 "Initialize optimizer.")
1937
1938
1939;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1888;; Customization 1940;; Customization
1889 1941
1890 1942
@@ -2406,6 +2458,10 @@ See also `ebnf-syntax-buffer'."
2406 (ebnfx 2458 (ebnfx
2407 default 2459 default
2408 (ebnf-syntax . 'ebnfx)) 2460 (ebnf-syntax . 'ebnfx))
2461 ;; dtd default
2462 (dtd
2463 default
2464 (ebnf-syntax . 'dtd))
2409 ) 2465 )
2410 "Style database. 2466 "Style database.
2411 2467
@@ -4664,7 +4720,8 @@ killed after process termination."
4664 (yacc ebnf-yac-parser ebnf-yac-initialize) 4720 (yacc ebnf-yac-parser ebnf-yac-initialize)
4665 (abnf ebnf-abn-parser ebnf-abn-initialize) 4721 (abnf ebnf-abn-parser ebnf-abn-initialize)
4666 (ebnf ebnf-bnf-parser ebnf-bnf-initialize) 4722 (ebnf ebnf-bnf-parser ebnf-bnf-initialize)
4667 (ebnfx ebnf-ebx-parser ebnf-ebx-initialize)) 4723 (ebnfx ebnf-ebx-parser ebnf-ebx-initialize)
4724 (dtd ebnf-dtd-parser ebnf-dtd-initialize))
4668 "Alist associating ebnf syntax with a parser and a initializer.") 4725 "Alist associating ebnf syntax with a parser and a initializer.")
4669 4726
4670 4727
@@ -5661,6 +5718,20 @@ killed after process termination."
5661 (cons seq body) 5718 (cons seq body)
5662 body)))))))) 5719 body))))))))
5663 5720
5721
5722(defun ebnf-token-sequence (sequence)
5723 (cond
5724 ;; null sequence
5725 ((null sequence)
5726 (ebnf-make-empty))
5727 ;; sequence with only one element
5728 ((= (length sequence) 1)
5729 (car sequence))
5730 ;; a real sequence
5731 (t
5732 (ebnf-make-sequence (nreverse sequence)))
5733 ))
5734
5664 5735
5665;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5736;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5666;; Variables used by parsers 5737;; Variables used by parsers
@@ -5671,6 +5742,7 @@ killed after process termination."
5671 ;; Override special comment character: 5742 ;; Override special comment character:
5672 (aset table ?< 'newline) 5743 (aset table ?< 'newline)
5673 (aset table ?> 'keep-line) 5744 (aset table ?> 'keep-line)
5745 (aset table ?^ 'form-feed)
5674 table) 5746 table)
5675 "Vector used to map characters to a special comment token.") 5747 "Vector used to map characters to a special comment token.")
5676 5748
@@ -5709,14 +5781,11 @@ killed after process termination."
5709(autoload 'ebnf-ebx-initialize "ebnf-ebx" 5781(autoload 'ebnf-ebx-initialize "ebnf-ebx"
5710 "Initializations for EBNFX parser.") 5782 "Initializations for EBNFX parser.")
5711 5783
5712(autoload 'ebnf-eliminate-empty-rules "ebnf-otz" 5784(autoload 'ebnf-dtd-parser "ebnf-dtd"
5713 "Eliminate empty rules.") 5785 "DTD parser.")
5714
5715(autoload 'ebnf-optimize "ebnf-otz"
5716 "Syntactic chart optimizer.")
5717 5786
5718(autoload 'ebnf-otz-initialize "ebnf-otz" 5787(autoload 'ebnf-dtd-initialize "ebnf-dtd"
5719 "Initialize optimizer.") 5788 "Initializations for DTD parser.")
5720 5789
5721 5790
5722;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5791;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;