/[emacs]/emacs/lisp/progmodes/ebnf2ps.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/ebnf2ps.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by gerd, Mon Sep 24 17:41:19 2001 UTC revision 1.11.8.1 by miles, Fri Apr 4 06:20:32 2003 UTC
# Line 1  Line 1 
1  ;;; ebnf2ps.el --- translate an EBNF to a syntatic chart on PostScript  ;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript
2    
3  ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.  ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4    
5  ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>  ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
6  ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>  ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
7  ;; Keywords: wp, ebnf, PostScript  ;; Keywords: wp, ebnf, PostScript
8  ;; Time-stamp: <2001/09/24 10:31:13 vinicius>  ;; Time-stamp: <2003-02-10 10:40:14 jbarranquero>
9  ;; Version: 3.6.1  ;; Version: 3.6.1
10  ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/  ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
11    
# Line 44  Please send all bug fixes and enhancemen Line 44  Please send all bug fixes and enhancemen
44  ;; Introduction  ;; Introduction
45  ;; ------------  ;; ------------
46  ;;  ;;
47  ;; This package translates an EBNF to a syntatic chart on PostScript.  ;; This package translates an EBNF to a syntactic chart on PostScript.
48  ;;  ;;
49  ;; To use ebnf2ps, insert in your ~/.emacs:  ;; To use ebnf2ps, insert in your ~/.emacs:
50  ;;  ;;
# Line 69  Please send all bug fixes and enhancemen Line 69  Please send all bug fixes and enhancemen
69  ;; Using ebnf2ps  ;; Using ebnf2ps
70  ;; -------------  ;; -------------
71  ;;  ;;
72  ;; ebnf2ps provides six commands for generating PostScript syntatic chart  ;; ebnf2ps provides six commands for generating PostScript syntactic chart
73  ;; images of Emacs buffers:  ;; images of Emacs buffers:
74  ;;  ;;
75  ;;      ebnf-print-buffer  ;;      ebnf-print-buffer
# Line 80  Please send all bug fixes and enhancemen Line 80  Please send all bug fixes and enhancemen
80  ;;      ebnf-eps-region  ;;      ebnf-eps-region
81  ;;  ;;
82  ;; These commands all perform essentially the same function: they generate  ;; These commands all perform essentially the same function: they generate
83  ;; PostScript syntatic chart images suitable for printing on a PostScript  ;; PostScript syntactic chart images suitable for printing on a PostScript
84  ;; printer or displaying with GhostScript.  These commands are collectively  ;; printer or displaying with GhostScript.  These commands are collectively
85  ;; referred to as "ebnf- commands".  ;; referred to as "ebnf- commands".
86  ;;  ;;
# Line 482  Please send all bug fixes and enhancemen Line 482  Please send all bug fixes and enhancemen
482  ;;  ;;
483  ;; `ebnf-setup' returns the current setup.  ;; `ebnf-setup' returns the current setup.
484  ;;  ;;
485  ;; `ebnf-syntax-buffer' does a syntatic analysis of your EBNF in the current  ;; `ebnf-syntax-buffer' does a syntactic analysis of your EBNF in the current
486  ;; buffer.  ;; buffer.
487  ;;  ;;
488  ;; `ebnf-syntax-region' does a syntatic analysis of your EBNF in the current  ;; `ebnf-syntax-region' does a syntactic analysis of your EBNF in the current
489  ;; region.  ;; region.
490  ;;  ;;
491  ;; `ebnf-customize' activates a customization buffer for ebnf2ps options.  ;; `ebnf-customize' activates a customization buffer for ebnf2ps options.
# Line 637  Please send all bug fixes and enhancemen Line 637  Please send all bug fixes and enhancemen
637  ;;  ;;
638  ;; `ebnf-ignore-empty-rule'             Non-nil means ignore empty rules.  ;; `ebnf-ignore-empty-rule'             Non-nil means ignore empty rules.
639  ;;  ;;
640  ;; `ebnf-optimize'                      Non-nil means optimize syntatic chart  ;; `ebnf-optimize'                      Non-nil means optimize syntactic chart
641  ;;                                      of rules.  ;;                                      of rules.
642  ;;  ;;
643  ;; To set the above options you may:  ;; To set the above options you may:
# Line 931  Please send all bug fixes and enhancemen Line 931  Please send all bug fixes and enhancemen
931  ;; Internal Structures  ;; Internal Structures
932  ;; -------------------  ;; -------------------
933  ;;  ;;
934  ;; ebnf2ps has two passes.  The first pass does a lexical and syntatic analysis  ;; ebnf2ps has two passes.  The first pass does a lexical and syntactic analysis
935  ;; of current buffer and generates an intermediate representation.  The second  ;; of current buffer and generates an intermediate representation.  The second
936  ;; pass uses the intermediate representation to generate the PostScript  ;; pass uses the intermediate representation to generate the PostScript
937  ;; syntatic chart.  ;; syntactic chart.
938  ;;  ;;
939  ;; The intermediate representation is a list of vectors, the vector element  ;; The intermediate representation is a list of vectors, the vector element
940  ;; represents a syntatic chart element.  Below is a vector representation for  ;; represents a syntactic chart element.  Below is a vector representation for
941  ;; each syntatic chart element.  ;; each syntactic chart element.
942  ;;  ;;
943  ;; [production   WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME   PRODUCTION ACTION]  ;; [production   WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME   PRODUCTION ACTION]
944  ;; [alternative  WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST]  ;; [alternative  WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST]
# Line 986  Please send all bug fixes and enhancemen Line 986  Please send all bug fixes and enhancemen
986  ;; Things To Change  ;; Things To Change
987  ;; ----------------  ;; ----------------
988  ;;  ;;
989  ;; . Handle situations when syntatic chart is out of paper.  ;; . Handle situations when syntactic chart is out of paper.
990  ;; . Use other alphabet than ascii.  ;; . Use other alphabet than ascii.
991  ;; . Optimizations...  ;; . Optimizations...
992  ;;  ;;
# Line 1021  Please send all bug fixes and enhancemen Line 1021  Please send all bug fixes and enhancemen
1021    
1022    
1023  (defgroup ebnf2ps nil  (defgroup ebnf2ps nil
1024    "Translate an EBNF to a syntatic chart on PostScript"    "Translate an EBNF to a syntactic chart on PostScript"
1025    :prefix "ebnf-"    :prefix "ebnf-"
1026    :group 'wp    :group 'wp
1027    :group 'postscript)    :group 'postscript)
# Line 1083  Please send all bug fixes and enhancemen Line 1083  Please send all bug fixes and enhancemen
1083    :group 'ebnf2ps)    :group 'ebnf2ps)
1084    
1085    
1086  (defgroup ebnf-syntatic nil  (defgroup ebnf-syntactic nil
1087    "Syntatic customization"    "Syntactic customization"
1088    :prefix "ebnf-"    :prefix "ebnf-"
1089    :tag "Syntatic"    :tag "Syntactic"
1090    :group 'ebnf2ps)    :group 'ebnf2ps)
1091    
1092    
# Line 1568  Valid values are: Line 1568  Valid values are:
1568  Any other value is treated as `ebnf'."  Any other value is treated as `ebnf'."
1569    :type '(radio :tag "Syntax"    :type '(radio :tag "Syntax"
1570                  (const ebnf) (const iso-ebnf) (const yacc))                  (const ebnf) (const iso-ebnf) (const yacc))
1571    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1572    
1573    
1574  (defcustom ebnf-lex-comment-char ?\;  (defcustom ebnf-lex-comment-char ?\;
# Line 1576  Any other value is treated as `ebnf'." Line 1576  Any other value is treated as `ebnf'."
1576    
1577  It's used only when `ebnf-syntax' is `ebnf'."  It's used only when `ebnf-syntax' is `ebnf'."
1578    :type 'character    :type 'character
1579    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1580    
1581    
1582  (defcustom ebnf-lex-eop-char ?.  (defcustom ebnf-lex-eop-char ?.
# Line 1584  It's used only when `ebnf-syntax' is `eb Line 1584  It's used only when `ebnf-syntax' is `eb
1584    
1585  It's used only when `ebnf-syntax' is `ebnf'."  It's used only when `ebnf-syntax' is `ebnf'."
1586    :type 'character    :type 'character
1587    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1588    
1589    
1590  (defcustom ebnf-terminal-regexp nil  (defcustom ebnf-terminal-regexp nil
# Line 1597  terminal name; terminal name may also be Line 1597  terminal name; terminal name may also be
1597  It's used only when `ebnf-syntax' is `ebnf'."  It's used only when `ebnf-syntax' is `ebnf'."
1598    :type '(radio :tag "Terminal Name"    :type '(radio :tag "Terminal Name"
1599                  (const nil) regexp)                  (const nil) regexp)
1600    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1601    
1602    
1603  (defcustom ebnf-case-fold-search nil  (defcustom ebnf-case-fold-search nil
# Line 1606  It's used only when `ebnf-syntax' is `eb Line 1606  It's used only when `ebnf-syntax' is `eb
1606  It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is  It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is
1607  `ebnf'."  `ebnf'."
1608    :type 'boolean    :type 'boolean
1609    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1610    
1611    
1612  (defcustom ebnf-iso-alternative-p nil  (defcustom ebnf-iso-alternative-p nil
# Line 1624  This variable affects the following symb Line 1624  This variable affects the following symb
1624        }    ==>   :)        }    ==>   :)
1625        ;    ==>   ."        ;    ==>   ."
1626    :type 'boolean    :type 'boolean
1627    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1628    
1629    
1630  (defcustom ebnf-iso-normalize-p nil  (defcustom ebnf-iso-normalize-p nil
# Line 1635  single space, so \"A  B   C\" is normali Line 1635  single space, so \"A  B   C\" is normali
1635    
1636  It's only used when `ebnf-syntax' is `iso-ebnf'."  It's only used when `ebnf-syntax' is `iso-ebnf'."
1637    :type 'boolean    :type 'boolean
1638    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1639    
1640    
1641  (defcustom ebnf-eps-prefix "ebnf--"  (defcustom ebnf-eps-prefix "ebnf--"
# Line 1709  when executing ebnf2ps, set `ebnf-use-fl Line 1709  when executing ebnf2ps, set `ebnf-use-fl
1709    
1710  It's only used when `ebnf-syntax' is `yacc'."  It's only used when `ebnf-syntax' is `yacc'."
1711    :type 'boolean    :type 'boolean
1712    :group 'ebnf-syntatic)    :group 'ebnf-syntactic)
1713    
1714    
1715  (defcustom ebnf-ignore-empty-rule nil  (defcustom ebnf-ignore-empty-rule nil
# Line 1722  middle action rule." Line 1722  middle action rule."
1722    
1723    
1724  (defcustom ebnf-optimize nil  (defcustom ebnf-optimize nil
1725    "*Non-nil means optimize syntatic chart of rules.    "*Non-nil means optimize syntactic chart of rules.
1726    
1727  The following optimizations are done:  The following optimizations are done:
1728    
# Line 1764  The above optimizations are specially us Line 1764  The above optimizations are specially us
1764    
1765  ;;;###autoload  ;;;###autoload
1766  (defun ebnf-print-buffer (&optional filename)  (defun ebnf-print-buffer (&optional filename)
1767    "Generate and print a PostScript syntatic chart image of the buffer.    "Generate and print a PostScript syntactic chart image of the buffer.
1768    
1769  When called with a numeric prefix argument (C-u), prompts the user for  When called with a numeric prefix argument (C-u), prompts the user for
1770  the name of a file to save the PostScript image in, instead of sending  the name of a file to save the PostScript image in, instead of sending
# Line 1780  number, prompt the user for the name of Line 1780  number, prompt the user for the name of
1780    
1781  ;;;###autoload  ;;;###autoload
1782  (defun ebnf-print-region (from to &optional filename)  (defun ebnf-print-region (from to &optional filename)
1783    "Generate and print a PostScript syntatic chart image of the region.    "Generate and print a PostScript syntactic chart image of the region.
1784  Like `ebnf-print-buffer', but prints just the current region."  Like `ebnf-print-buffer', but prints just the current region."
1785    (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))    (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))
1786    (run-hooks 'ebnf-hook)    (run-hooks 'ebnf-hook)
# Line 1790  Like `ebnf-print-buffer', but prints jus Line 1790  Like `ebnf-print-buffer', but prints jus
1790    
1791  ;;;###autoload  ;;;###autoload
1792  (defun ebnf-spool-buffer ()  (defun ebnf-spool-buffer ()
1793    "Generate and spool a PostScript syntatic chart image of the buffer.    "Generate and spool a PostScript syntactic chart image of the buffer.
1794  Like `ebnf-print-buffer' except that the PostScript image is saved in a  Like `ebnf-print-buffer' except that the PostScript image is saved in a
1795  local buffer to be sent to the printer later.  local buffer to be sent to the printer later.
1796    
# Line 1801  Use the command `ebnf-despool' to send t Line 1801  Use the command `ebnf-despool' to send t
1801    
1802  ;;;###autoload  ;;;###autoload
1803  (defun ebnf-spool-region (from to)  (defun ebnf-spool-region (from to)
1804    "Generate a PostScript syntatic chart image of the region and spool locally.    "Generate a PostScript syntactic chart image of the region and spool locally.
1805  Like `ebnf-spool-buffer', but spools just the current region.  Like `ebnf-spool-buffer', but spools just the current region.
1806    
1807  Use the command `ebnf-despool' to send the spooled images to the printer."  Use the command `ebnf-despool' to send the spooled images to the printer."
# Line 1811  Use the command `ebnf-despool' to send t Line 1811  Use the command `ebnf-despool' to send t
1811    
1812  ;;;###autoload  ;;;###autoload
1813  (defun ebnf-eps-buffer ()  (defun ebnf-eps-buffer ()
1814    "Generate a PostScript syntatic chart image of the buffer in a EPS file.    "Generate a PostScript syntactic chart image of the buffer in a EPS file.
1815    
1816  Indeed, for each production is generated a EPS file.  Indeed, for each production is generated a EPS file.
1817  The EPS file name has the following form:  The EPS file name has the following form:
# Line 1833  WARNING: It's *NOT* asked any confirmati Line 1833  WARNING: It's *NOT* asked any confirmati
1833    
1834  ;;;###autoload  ;;;###autoload
1835  (defun ebnf-eps-region (from to)  (defun ebnf-eps-region (from to)
1836    "Generate a PostScript syntatic chart image of the region in a EPS file.    "Generate a PostScript syntactic chart image of the region in a EPS file.
1837    
1838  Indeed, for each production is generated a EPS file.  Indeed, for each production is generated a EPS file.
1839  The EPS file name has the following form:  The EPS file name has the following form:
# Line 1860  WARNING: It's *NOT* asked any confirmati Line 1860  WARNING: It's *NOT* asked any confirmati
1860    
1861  ;;;###autoload  ;;;###autoload
1862  (defun ebnf-syntax-buffer ()  (defun ebnf-syntax-buffer ()
1863    "Does a syntatic analysis of the current buffer."    "Does a syntactic analysis of the current buffer."
1864    (interactive)    (interactive)
1865    (ebnf-syntax-region (point-min) (point-max)))    (ebnf-syntax-region (point-min) (point-max)))
1866    
1867    
1868  ;;;###autoload  ;;;###autoload
1869  (defun ebnf-syntax-region (from to)  (defun ebnf-syntax-region (from to)
1870    "Does a syntatic analysis of a region."    "Does a syntactic analysis of a region."
1871    (interactive "r")    (interactive "r")
1872    (ebnf-generate-region from to nil))    (ebnf-generate-region from to nil))
1873    
# Line 4163  end Line 4163  end
4163       (gen-func       (gen-func
4164        nil)        nil)
4165       (t       (t
4166        (message "EBNF syntatic analysis: NO ERRORS.")))))        (message "EBNF syntactic analysis: NO ERRORS.")))))
4167    
4168    
4169  (defun ebnf-parse-and-sort (start)  (defun ebnf-parse-and-sort (start)
# Line 5283  end Line 5283  end
5283    "Eliminate empty rules.")    "Eliminate empty rules.")
5284    
5285  (autoload 'ebnf-optimize              "ebnf-otz"  (autoload 'ebnf-optimize              "ebnf-otz"
5286    "Syntatic chart optimizer.")    "Syntactic chart optimizer.")
5287    
5288  (autoload 'ebnf-otz-initialize        "ebnf-otz"  (autoload 'ebnf-otz-initialize        "ebnf-otz"
5289    "Initialize optimizer.")    "Initialize optimizer.")

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.11.8.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26