]> git.eshelyaron.com Git - emacs.git/commitdiff
ebnf2ps 4.2
authorVinicius Jose Latorre <viniciusjl@ig.com.br>
Mon, 5 Apr 2004 02:00:42 +0000 (02:00 +0000)
committerVinicius Jose Latorre <viniciusjl@ig.com.br>
Mon, 5 Apr 2004 02:00:42 +0000 (02:00 +0000)
lisp/ChangeLog
lisp/progmodes/ebnf-abn.el
lisp/progmodes/ebnf-bnf.el
lisp/progmodes/ebnf-ebx.el
lisp/progmodes/ebnf-iso.el
lisp/progmodes/ebnf-yac.el
lisp/progmodes/ebnf2ps.el

index cf38476e364a0358243df10f2a59c5b4fe2f1a5b..cb27984f9717b71eae9ae00495e6bbc72a5bf56f 100644 (file)
@@ -8,6 +8,37 @@
        * format.el (format-write-file): Add optional argument CONFIRM
        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>
 
        * calendar/timeclock.el (timeclock-relative)
index e41d27d0c1f61de2646c40297537935e4342d0d4..35771a10f325829885e4a837da453009a3f0862f 100644 (file)
@@ -4,9 +4,9 @@
 
 ;; Author: 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
-;; Version: 1.0
+;; Version: 1.1
 
 ;; This file is part of GNU Emacs.
 
                 term  (cdr term))
       (setq seq (cons term seq)))
     (cons token
-         (if (= (length seq) 1)
-             ;; sequence with only one element
-             (car seq)
-           ;; a real sequence
-           (ebnf-make-sequence (nreverse seq))))))
+         (ebnf-token-sequence seq))))
 
 
 ;;;    repetition     =  [repeat] element
index 4f0ef6099c84f7739e04852b1a52df9a40a0505a..d32ad5a77c94112341e32f1f342d99bd9354367e 100644 (file)
@@ -5,9 +5,9 @@
 
 ;; Author: 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
-;; Version: 1.8
+;; Version: 1.9
 
 ;; This file is part of GNU Emacs.
 
                 term  (cdr term))
       (setq seq (cons term seq)))
     (cons token
-         (cond
-          ;; 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)))
-          ))))
+         (ebnf-token-sequence seq))))
 
 
 ;;; exception = repeat [ "-" repeat].
index 4e9fc24ade11acdaaf3ae4ef1dbc82366c12f6a7..d7dfa7af89fad4b93e96957143d7ddc3b62d7338 100644 (file)
@@ -4,9 +4,9 @@
 
 ;; Author: 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
-;; Version: 1.0
+;; Version: 1.1
 
 ;; This file is part of GNU Emacs.
 
                 term  (cdr term))
       (setq seq (cons term seq)))
     (cons token
-         (if (= (length seq) 1)
-             ;; sequence with only one element
-             (car seq)
-           ;; a real sequence
-           (ebnf-make-sequence (nreverse seq))))))
+         (ebnf-token-sequence seq))))
 
 
 ;;; exception ::= term ('-' term)?
index 0d9977d70845722b475d47178d15f60e3c7edc19..f36065bd558b60dfc2b89f666592b2de8dd39216 100644 (file)
@@ -5,9 +5,9 @@
 
 ;; Author: 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
-;; Version: 1.7
+;; Version: 1.8
 
 ;; This file is part of GNU Emacs.
 
                (eq token 'catenate))
       (setq seq (cons term seq)))
     (cons token
-         (cond
-          ;; null sequence
-          ((null 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))))
-          ))))
+         (ebnf-token-sequence (if term
+                                  (cons term seq)
+                                seq)))))
 
 
 ;;; term = factor, ['-', exception];
index ff097b5195d078ea13ea8538aa6624187a6cee64..c7bf0e31541a62cd4f9f780ad40378edc85c3bd4 100644 (file)
@@ -5,9 +5,9 @@
 
 ;; Author: 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
-;; Version: 1.2.1
+;; Version: 1.3
 
 ;; This file is part of GNU Emacs.
 
                 factor (ebnf-yac-factor token))
       (setq seq (cons factor seq)))
     (cons token
-         (cond
-          ;; ignore error recovery
-          ((and ebnf-yac-ignore-error-recovery ebnf-yac-error)
-           nil)
-          ;; 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)))
-          ))))
+         (if (and ebnf-yac-ignore-error-recovery ebnf-yac-error)
+             ;; ignore error recovery
+             nil
+           (ebnf-token-sequence seq)))))
 
 
 ;;; Factor = Name
index 56125cbea5a3d75725da7ba52888c388c2c8b382..e45a7ee510e23e309024e0d1ee8c32cbbd3509ac 100644 (file)
@@ -5,9 +5,9 @@
 
 ;; Author: 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
-;; Version: 4.1
+;; Version: 4.2
 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
 
 ;; This file is part of GNU Emacs.
@@ -27,8 +27,8 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
-(defconst ebnf-version "4.1"
-  "ebnf2ps.el, v 4.1 <2004/03/18 vinicius>
+(defconst ebnf-version "4.2"
+  "ebnf2ps.el, v 4.2 <2004/04/04 vinicius>
 
 Vinicius's last change version.  When reporting bugs, please also
 report the version of Emacs, if any, that ebnf2ps was running with.
@@ -177,9 +177,36 @@ Please send all bug fixes and enhancements to
 ;;   (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
 ;; -----------
 ;;
+;; 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:
 ;;
 ;;    ;                        comment (until end of line)
@@ -324,6 +351,10 @@ Please send all bug fixes and enhancements to
 ;;                  `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation'
 ;;                  ("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'.
 ;;
 ;; The default value is `ebnf'.
@@ -395,6 +426,8 @@ Please send all bug fixes and enhancements to
 ;;
 ;; 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.
 ;;             It is useful when `ebnf-horizontal-orientation' is nil.
 ;;
@@ -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
 ;; line.
 ;;
-;; In ISO EBNF the above actions are specified as (*>*), (*<*), (*[EPS*) and
-;; (*]EPS*).  The first example above should be written:
+;; In ISO EBNF the above actions are specified as (*^*), (*>*), (*<*), (*[EPS*)
+;; and (*]EPS*).  The first example above should be written:
 ;;
 ;;    A = t;
 ;;    C = x;
@@ -1687,10 +1720,14 @@ Valid values are:
                `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation'
                (\"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'."
   :type '(radio :tag "Syntax"
                (const ebnf) (const abnf)  (const iso-ebnf)
-               (const yacc) (const ebnfx))
+               (const yacc) (const ebnfx) (const dtd))
   :group 'ebnf-syntactic)
 
 
@@ -1883,6 +1920,21 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'."
   :type 'boolean
   :group 'ebnf-optimization)
 
+\f
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; 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.")
+
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Customization
@@ -2406,6 +2458,10 @@ See also `ebnf-syntax-buffer'."
     (ebnfx
      default
      (ebnf-syntax                      . 'ebnfx))
+    ;; dtd default
+    (dtd
+     default
+     (ebnf-syntax                      . 'dtd))
     )
   "Style database.
 
@@ -4664,7 +4720,8 @@ killed after process termination."
     (yacc      ebnf-yac-parser  ebnf-yac-initialize)
     (abnf      ebnf-abn-parser  ebnf-abn-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.")
 
 
@@ -5661,6 +5718,20 @@ killed after process termination."
                                                   (cons seq 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)))
+   ))
+
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Variables used by parsers
@@ -5671,6 +5742,7 @@ killed after process termination."
     ;; Override special comment character:
     (aset table ?< 'newline)
     (aset table ?> 'keep-line)
+    (aset table ?^ 'form-feed)
     table)
   "Vector used to map characters to a special comment token.")
 
@@ -5709,14 +5781,11 @@ killed after process termination."
 (autoload 'ebnf-ebx-initialize        "ebnf-ebx"
   "Initializations for EBNFX parser.")
 
-(autoload 'ebnf-eliminate-empty-rules "ebnf-otz"
-  "Eliminate empty rules.")
-
-(autoload 'ebnf-optimize              "ebnf-otz"
-  "Syntactic chart optimizer.")
+(autoload 'ebnf-dtd-parser            "ebnf-dtd"
+  "DTD parser.")
 
-(autoload 'ebnf-otz-initialize        "ebnf-otz"
-  "Initialize optimizer.")
+(autoload 'ebnf-dtd-initialize        "ebnf-dtd"
+  "Initializations for DTD parser.")
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;