Commit 6411a60a authored by Vinicius Jose Latorre's avatar Vinicius Jose Latorre
Browse files

ebnf2ps 4.2

parent 07493045
...@@ -8,6 +8,37 @@ ...@@ -8,6 +8,37 @@
* format.el (format-write-file): Add optional argument CONFIRM * format.el (format-write-file): Add optional argument CONFIRM
and make it behave like the analogous argument to `write-file'. and make it behave like the analogous argument to `write-file'.
2004-04-04 Vinicius Jose Latorre <viniciusjl@ig.com.br>
* progmodes/ebnf2ps.el: Doc fix.
(ebnf-version): New version number (4.2).
(ebnf-syntax): Customization and docstring fix.
(ebnf-eliminate-empty-rules, ebnf-optimize, ebnf-otz-initialize): Put
autoloaded funs before first use.
(ebnf-style-database): Add dtd entry.
(ebnf-syntax-alist): Add dtd initialization.
(ebnf-token-sequence): New fun.
(ebnf-comment-table): Add new comment action character.
(ebnf-dtd-parser, ebnf-dtd-initialize): Autoloaded funs from ebnf-dtd.
* progmodes/ebnf-dtd.el: New file, implement a parser for DTD (Data
Type Definition for XML).
* progmodes/ebnf-abn.el (ebnf-abn-concatenation): Code simplification:
call ebnf-token-sequence.
* progmodes/ebnf-bnf.el (ebnf-sequence): Code simplification: call
ebnf-token-sequence.
* progmodes/ebnf-ebx.el (ebnf-ebx-concatenation): Code simplification:
call ebnf-token-sequence.
* progmodes/ebnf-iso.el (ebnf-iso-single-definition): Code
simplification: call ebnf-token-sequence.
* progmodes/ebnf-yac.el (ebnf-yac-sequence): Code simplification: call
ebnf-token-sequence.
2004-04-04 Eli Zaretskii <eliz@gnu.org> 2004-04-04 Eli Zaretskii <eliz@gnu.org>
* calendar/timeclock.el (timeclock-relative) * calendar/timeclock.el (timeclock-relative)
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Time-stamp: <2004/03/18 23:49:58 vinicius> ;; Time-stamp: <2004/04/03 16:43:57 vinicius>
;; Keywords: wp, ebnf, PostScript ;; Keywords: wp, ebnf, PostScript
;; Version: 1.0 ;; Version: 1.1
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -316,11 +316,7 @@ ...@@ -316,11 +316,7 @@
term (cdr term)) term (cdr term))
(setq seq (cons term seq))) (setq seq (cons term seq)))
(cons token (cons token
(if (= (length seq) 1) (ebnf-token-sequence seq))))
;; sequence with only one element
(car seq)
;; a real sequence
(ebnf-make-sequence (nreverse seq))))))
;;; repetition = [repeat] element ;;; repetition = [repeat] element
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Time-stamp: <2004/02/28 18:25:52 vinicius> ;; Time-stamp: <2004/04/03 16:42:18 vinicius>
;; Keywords: wp, ebnf, PostScript ;; Keywords: wp, ebnf, PostScript
;; Version: 1.8 ;; Version: 1.9
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -206,17 +206,7 @@ ...@@ -206,17 +206,7 @@
term (cdr term)) term (cdr term))
(setq seq (cons term seq))) (setq seq (cons term seq)))
(cons token (cons token
(cond (ebnf-token-sequence seq))))
;; null sequence
((null seq)
(ebnf-make-empty))
;; sequence with only one element
((= (length seq) 1)
(car seq))
;; a real sequence
(t
(ebnf-make-sequence (nreverse seq)))
))))
;;; exception = repeat [ "-" repeat]. ;;; exception = repeat [ "-" repeat].
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Time-stamp: <2004/03/22 08:53:21 vinicius> ;; Time-stamp: <2004/04/03 16:45:34 vinicius>
;; Keywords: wp, ebnf, PostScript ;; Keywords: wp, ebnf, PostScript
;; Version: 1.0 ;; Version: 1.1
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -282,11 +282,7 @@ ...@@ -282,11 +282,7 @@
term (cdr term)) term (cdr term))
(setq seq (cons term seq))) (setq seq (cons term seq)))
(cons token (cons token
(if (= (length seq) 1) (ebnf-token-sequence seq))))
;; sequence with only one element
(car seq)
;; a real sequence
(ebnf-make-sequence (nreverse seq))))))
;;; exception ::= term ('-' term)? ;;; exception ::= term ('-' term)?
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Time-stamp: <2004/02/29 18:31:33 vinicius> ;; Time-stamp: <2004/04/03 16:48:52 vinicius>
;; Keywords: wp, ebnf, PostScript ;; Keywords: wp, ebnf, PostScript
;; Version: 1.7 ;; Version: 1.8
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -203,17 +203,9 @@ ...@@ -203,17 +203,9 @@
(eq token 'catenate)) (eq token 'catenate))
(setq seq (cons term seq))) (setq seq (cons term seq)))
(cons token (cons token
(cond (ebnf-token-sequence (if term
;; null sequence (cons term seq)
((null seq) seq)))))
term)
;; sequence with only one element
((and (null term) (= (length seq) 1))
(car seq))
;; a real sequence
(t
(ebnf-make-sequence (nreverse (cons term seq))))
))))
;;; term = factor, ['-', exception]; ;;; term = factor, ['-', exception];
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Time-stamp: <2004/02/29 20:23:29 vinicius> ;; Time-stamp: <2004/04/03 16:50:46 vinicius>
;; Keywords: wp, ebnf, PostScript ;; Keywords: wp, ebnf, PostScript
;; Version: 1.2.1 ;; Version: 1.3
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -218,20 +218,10 @@ ...@@ -218,20 +218,10 @@
factor (ebnf-yac-factor token)) factor (ebnf-yac-factor token))
(setq seq (cons factor seq))) (setq seq (cons factor seq)))
(cons token (cons token
(cond (if (and ebnf-yac-ignore-error-recovery ebnf-yac-error)
;; ignore error recovery ;; ignore error recovery
((and ebnf-yac-ignore-error-recovery ebnf-yac-error) nil
nil) (ebnf-token-sequence seq)))))
;; null sequence
((null seq)
(ebnf-make-empty))
;; sequence with only one element
((= (length seq) 1)
(car seq))
;; a real sequence
(t
(ebnf-make-sequence (nreverse seq)))
))))
;;; Factor = Name ;;; Factor = Name
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Time-stamp: <2004/03/30 21:49:21 vinicius> ;; Time-stamp: <2004/04/04 21:40:30 vinicius>
;; Keywords: wp, ebnf, PostScript ;; Keywords: wp, ebnf, PostScript
;; Version: 4.1 ;; Version: 4.2
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA. ;; Boston, MA 02111-1307, USA.
(defconst ebnf-version "4.1" (defconst ebnf-version "4.2"
"ebnf2ps.el, v 4.1 <2004/03/18 vinicius> "ebnf2ps.el, v 4.2 <2004/04/04 vinicius>
Vinicius's last change version. When reporting bugs, please also Vinicius's last change version. When reporting bugs, please also
report the version of Emacs, if any, that ebnf2ps was running with. report the version of Emacs, if any, that ebnf2ps was running with.
...@@ -177,9 +177,36 @@ Please send all bug fixes and enhancements to ...@@ -177,9 +177,36 @@ Please send all bug fixes and enhancements to
;; (global-set-key '(control f22) 'ebnf-despool) ;; (global-set-key '(control f22) 'ebnf-despool)
;; ;;
;; ;;
;; Invoking Ebnf2ps in Batch
;; -------------------------
;;
;; It's possible also to run ebnf2ps in batch, this is useful when, for
;; example, you have a directory with a lot of files containing the EBNF to be
;; translated to PostScript.
;;
;; To run ebnf2ps in batch type, for example:
;;
;; emacs -batch -l setup-ebnf2ps.el -f ebnf-eps-directory
;;
;; Where setup-ebnf2ps.el should be a file containing:
;;
;; ;; set load-path if ebnf2ps isn't installed in your Emacs environment
;; (setq load-path (append (list "/dir/of/ebnf2ps") load-path))
;; (require 'ebnf2ps)
;; ;; insert here your ebnf2ps settings
;; (setq ebnf-terminal-shape 'bevel)
;; ;; etc.
;;
;;
;; EBNF Syntax ;; EBNF Syntax
;; ----------- ;; -----------
;; ;;
;; BNF (Backus Naur Form) notation is defined like languages, and like
;; languages there are rules about name formation and syntax. In this section
;; it's defined a BNF syntax that it's called simply EBNF (Extended BNF).
;; ebnf2ps package also deal with other BNF notation. Please, see the variable
;; `ebnf-syntax' documentation below in this section.
;;
;; The current EBNF that ebnf2ps accepts has the following constructions: ;; The current EBNF that ebnf2ps accepts has the following constructions:
;; ;;
;; ; comment (until end of line) ;; ; comment (until end of line)
...@@ -324,6 +351,10 @@ Please send all bug fixes and enhancements to ...@@ -324,6 +351,10 @@ Please send all bug fixes and enhancements to
;; `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation' ;; `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation'
;; ("Extensible Markup Language (XML) 1.0 (Third Edition)") ;; ("Extensible Markup Language (XML) 1.0 (Third Edition)")
;; ;;
;; `dtd' ebnf2ps recognizes the syntax described in the URL:
;; `http://www.w3.org/TR/2004/REC-xml-20040204/'
;; ("Extensible Markup Language (XML) 1.0 (Third Edition)")
;;
;; Any other value is treated as `ebnf'. ;; Any other value is treated as `ebnf'.
;; ;;
;; The default value is `ebnf'. ;; The default value is `ebnf'.
...@@ -395,6 +426,8 @@ Please send all bug fixes and enhancements to ...@@ -395,6 +426,8 @@ Please send all bug fixes and enhancements to
;; ;;
;; ebnf2ps accepts the following actions in comments: ;; ebnf2ps accepts the following actions in comments:
;; ;;
;; ;^ same as form feed. See section Form Feed above.
;;
;; ;> the next production starts in the same line as the current one. ;; ;> the next production starts in the same line as the current one.
;; It is useful when `ebnf-horizontal-orientation' is nil. ;; It is useful when `ebnf-horizontal-orientation' is nil.
;; ;;
...@@ -459,8 +492,8 @@ Please send all bug fixes and enhancements to ...@@ -459,8 +492,8 @@ Please send all bug fixes and enhancements to
;; Only the ;> will take effect, that is, A and B will be drawn in the same ;; Only the ;> will take effect, that is, A and B will be drawn in the same
;; line. ;; line.
;; ;;
;; In ISO EBNF the above actions are specified as (*>*), (*<*), (*[EPS*) and ;; In ISO EBNF the above actions are specified as (*^*), (*>*), (*<*), (*[EPS*)
;; (*]EPS*). The first example above should be written: ;; and (*]EPS*). The first example above should be written:
;; ;;
;; A = t; ;; A = t;
;; C = x; ;; C = x;
...@@ -1687,10 +1720,14 @@ Valid values are: ...@@ -1687,10 +1720,14 @@ Valid values are:
`http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation' `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation'
(\"Extensible Markup Language (XML) 1.0 (Third Edition)\") (\"Extensible Markup Language (XML) 1.0 (Third Edition)\")
`dtd' ebnf2ps recognizes the syntax described in the URL:
`http://www.w3.org/TR/2004/REC-xml-20040204/'
(\"Extensible Markup Language (XML) 1.0 (Third Edition)\")
Any other value is treated as `ebnf'." Any other value is treated as `ebnf'."
:type '(radio :tag "Syntax" :type '(radio :tag "Syntax"
(const ebnf) (const abnf) (const iso-ebnf) (const ebnf) (const abnf) (const iso-ebnf)
(const yacc) (const ebnfx)) (const yacc) (const ebnfx) (const dtd))
:group 'ebnf-syntactic) :group 'ebnf-syntactic)
...@@ -1883,6 +1920,21 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'." ...@@ -1883,6 +1920,21 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'."
:type 'boolean :type 'boolean
:group 'ebnf-optimization) :group 'ebnf-optimization)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; To make this file smaller, some commands go in a separate file.
;; But autoload them here to make the separation invisible.
;; Autoload is here to avoid compilation gripes.
(autoload 'ebnf-eliminate-empty-rules "ebnf-otz"
"Eliminate empty rules.")
(autoload 'ebnf-optimize "ebnf-otz"
"Syntactic chart optimizer.")
(autoload 'ebnf-otz-initialize "ebnf-otz"
"Initialize optimizer.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customization ;; Customization
...@@ -2406,6 +2458,10 @@ See also `ebnf-syntax-buffer'." ...@@ -2406,6 +2458,10 @@ See also `ebnf-syntax-buffer'."
(ebnfx (ebnfx
default default
(ebnf-syntax . 'ebnfx)) (ebnf-syntax . 'ebnfx))
;; dtd default
(dtd
default
(ebnf-syntax . 'dtd))
) )
"Style database. "Style database.
...@@ -4664,7 +4720,8 @@ killed after process termination." ...@@ -4664,7 +4720,8 @@ killed after process termination."
(yacc ebnf-yac-parser ebnf-yac-initialize) (yacc ebnf-yac-parser ebnf-yac-initialize)
(abnf ebnf-abn-parser ebnf-abn-initialize) (abnf ebnf-abn-parser ebnf-abn-initialize)
(ebnf ebnf-bnf-parser ebnf-bnf-initialize) (ebnf ebnf-bnf-parser ebnf-bnf-initialize)
(ebnfx ebnf-ebx-parser ebnf-ebx-initialize)) (ebnfx ebnf-ebx-parser ebnf-ebx-initialize)
(dtd ebnf-dtd-parser ebnf-dtd-initialize))
"Alist associating ebnf syntax with a parser and a initializer.") "Alist associating ebnf syntax with a parser and a initializer.")
...@@ -5661,6 +5718,20 @@ killed after process termination." ...@@ -5661,6 +5718,20 @@ killed after process termination."
(cons seq body) (cons seq body)
body)))))))) body))))))))
(defun ebnf-token-sequence (sequence)
(cond
;; null sequence
((null sequence)
(ebnf-make-empty))
;; sequence with only one element
((= (length sequence) 1)
(car sequence))
;; a real sequence
(t
(ebnf-make-sequence (nreverse sequence)))
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variables used by parsers ;; Variables used by parsers
...@@ -5671,6 +5742,7 @@ killed after process termination." ...@@ -5671,6 +5742,7 @@ killed after process termination."
;; Override special comment character: ;; Override special comment character:
(aset table ?< 'newline) (aset table ?< 'newline)
(aset table ?> 'keep-line) (aset table ?> 'keep-line)
(aset table ?^ 'form-feed)
table) table)
"Vector used to map characters to a special comment token.") "Vector used to map characters to a special comment token.")
...@@ -5709,14 +5781,11 @@ killed after process termination." ...@@ -5709,14 +5781,11 @@ killed after process termination."
(autoload 'ebnf-ebx-initialize "ebnf-ebx" (autoload 'ebnf-ebx-initialize "ebnf-ebx"
"Initializations for EBNFX parser.") "Initializations for EBNFX parser.")
(autoload 'ebnf-eliminate-empty-rules "ebnf-otz" (autoload 'ebnf-dtd-parser "ebnf-dtd"
"Eliminate empty rules.") "DTD parser.")
(autoload 'ebnf-optimize "ebnf-otz"
"Syntactic chart optimizer.")
(autoload 'ebnf-otz-initialize "ebnf-otz" (autoload 'ebnf-dtd-initialize "ebnf-dtd"
"Initialize optimizer.") "Initializations for DTD parser.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment