Mercurial > emacs
annotate lisp/progmodes/ebnf2ps.el @ 96608:127e54f8220e
* menu.h: New file.
* menu.c: Include it.
* xmenu.c: Likewise.
* Makefile.in: Update dependencies.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Fri, 11 Jul 2008 11:20:21 +0000 |
parents | 52b7a8c22af5 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1 ;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript |
27451 | 2 |
79717 | 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
39342
73061d0eb82e
Replace "Prologue" by "Prolog" in PostScript
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
8 ;; Keywords: wp, ebnf, PostScript |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
9 ;; Version: 4.4 |
73027
575850f5bd53
Adjust X-URL
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
68773
diff
changeset
|
10 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre |
27451 | 11 |
27539 | 12 ;; This file is part of GNU Emacs. |
13 | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; GNU Emacs is free software: you can redistribute it and/or modify |
27539 | 15 ;; it under the terms of the GNU General Public License as published by |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
16 ;; the Free Software Foundation, either version 3 of the License, or |
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
17 ;; (at your option) any later version. |
27539 | 18 |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
27539 | 26 |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
27 (defconst ebnf-version "4.4" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
28 "ebnf2ps.el, v 4.4 <2007/02/12 vinicius> |
27451 | 29 |
30 Vinicius's last change version. When reporting bugs, please also | |
31 report the version of Emacs, if any, that ebnf2ps was running with. | |
32 | |
33 Please send all bug fixes and enhancements to | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
34 Vinicius Jose Latorre <viniciusjl@ig.com.br>. |
27451 | 35 ") |
36 | |
37 | |
38 ;;; Commentary: | |
39 | |
40 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
41 ;; | |
42 ;; Introduction | |
43 ;; ------------ | |
44 ;; | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
45 ;; This package translates an EBNF to a syntactic chart on PostScript. |
27451 | 46 ;; |
47 ;; To use ebnf2ps, insert in your ~/.emacs: | |
48 ;; | |
49 ;; (require 'ebnf2ps) | |
50 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
51 ;; ebnf2ps uses ps-print package (version 5.2.3 or later), so see ps-print to |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
52 ;; know how to set options like landscape printing, page headings, margins, |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
53 ;; etc. |
27451 | 54 ;; |
55 ;; NOTE: ps-print zebra stripes and line number options doesn't have effect on | |
56 ;; ebnf2ps, they behave as it's turned off. | |
57 ;; | |
58 ;; For good performance, be sure to byte-compile ebnf2ps.el, e.g. | |
59 ;; | |
60 ;; M-x byte-compile-file <give the path to ebnf2ps.el when prompted> | |
61 ;; | |
62 ;; This will generate ebnf2ps.elc, which will be loaded instead of ebnf2ps.el. | |
63 ;; | |
64 ;; ebnf2ps was tested with GNU Emacs 20.4.1. | |
65 ;; | |
66 ;; | |
67 ;; Using ebnf2ps | |
68 ;; ------------- | |
69 ;; | |
54197 | 70 ;; ebnf2ps provides the following commands for generating PostScript syntactic |
71 ;; chart images of Emacs buffers: | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
72 ;; |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
73 ;; ebnf-print-directory |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
74 ;; ebnf-print-file |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
75 ;; ebnf-print-buffer |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
76 ;; ebnf-print-region |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
77 ;; ebnf-spool-directory |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
78 ;; ebnf-spool-file |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
79 ;; ebnf-spool-buffer |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
80 ;; ebnf-spool-region |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
81 ;; ebnf-eps-directory |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
82 ;; ebnf-eps-file |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
83 ;; ebnf-eps-buffer |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
84 ;; ebnf-eps-region |
27451 | 85 ;; |
86 ;; These commands all perform essentially the same function: they generate | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
87 ;; PostScript syntactic chart images suitable for printing on a PostScript |
27451 | 88 ;; printer or displaying with GhostScript. These commands are collectively |
89 ;; referred to as "ebnf- commands". | |
90 ;; | |
91 ;; The word "print", "spool" and "eps" in the command name determines when the | |
92 ;; PostScript image is sent to the printer (or file): | |
93 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
94 ;; print - The PostScript image is immediately sent to the printer; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
95 ;; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
96 ;; spool - The PostScript image is saved temporarily in an Emacs buffer. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
97 ;; Many images may be spooled locally before printing them. To |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
98 ;; send the spooled images to the printer, use the command |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
99 ;; `ebnf-despool'. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
100 ;; |
75624 | 101 ;; eps - The PostScript image is immediately sent to an EPS file. |
27451 | 102 ;; |
103 ;; The spooling mechanism is the same as used by ps-print and was designed for | |
104 ;; printing lots of small files to save paper that would otherwise be wasted on | |
105 ;; banner pages, and to make it easier to find your output at the printer (it's | |
106 ;; easier to pick up one 50-page printout than to find 50 single-page | |
107 ;; printouts). As ebnf2ps and ps-print use the same Emacs buffer to spool | |
108 ;; images, you can intermix the spooling of ebnf2ps and ps-print images. | |
109 ;; | |
110 ;; ebnf2ps use the same hook of ps-print in the `kill-emacs-hook' so that you | |
111 ;; won't accidentally quit from Emacs while you have unprinted PostScript | |
112 ;; waiting in the spool buffer. If you do attempt to exit with spooled | |
113 ;; PostScript, you'll be asked if you want to print it, and if you decline, | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
114 ;; you'll be asked to confirm the exit; this is modeled on the confirmation |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
115 ;; that Emacs uses for modified buffers. |
27451 | 116 ;; |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
117 ;; The word "directory", "file", "buffer" or "region" in the command name |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
118 ;; determines how much of the buffer is printed: |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
119 ;; |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
120 ;; directory - Read files in the directory and print them. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
121 ;; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
122 ;; file - Read file and print it. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
123 ;; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
124 ;; buffer - Print the entire buffer. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
125 ;; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
126 ;; region - Print just the current region. |
27451 | 127 ;; |
128 ;; Two ebnf- command examples: | |
129 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
130 ;; ebnf-print-buffer - translate and print the entire buffer, and send it |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
131 ;; immediately to the printer. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
132 ;; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
133 ;; ebnf-spool-region - translate and print just the current region, and |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
134 ;; spool the image in Emacs to send to the printer |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
135 ;; later. |
27451 | 136 ;; |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
137 ;; Note that `ebnf-eps-directory', `ebnf-eps-file', `ebnf-eps-buffer' and |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
138 ;; `ebnf-eps-region' never spool the EPS image, so they don't use the ps-print |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
139 ;; spooling mechanism. See section "Actions in Comments" for an explanation |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
140 ;; about EPS file generation. |
27451 | 141 ;; |
142 ;; | |
143 ;; Invoking Ebnf2ps | |
144 ;; ---------------- | |
145 ;; | |
146 ;; To translate and print your buffer, type | |
147 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
148 ;; M-x ebnf-print-buffer |
27451 | 149 ;; |
150 ;; or substitute one of the other four ebnf- commands. The command will | |
151 ;; generate the PostScript image and print or spool it as specified. By giving | |
152 ;; the command a prefix argument | |
153 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
154 ;; C-u M-x ebnf-print-buffer |
27451 | 155 ;; |
156 ;; it will save the PostScript image to a file instead of sending it to the | |
157 ;; printer; you will be prompted for the name of the file to save the image to. | |
158 ;; The prefix argument is ignored by the commands that spool their images, but | |
159 ;; you may save the spooled images to a file by giving a prefix argument to | |
160 ;; `ebnf-despool': | |
161 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
162 ;; C-u M-x ebnf-despool |
27451 | 163 ;; |
164 ;; When invoked this way, `ebnf-despool' will prompt you for the name of the | |
165 ;; file to save to. | |
166 ;; | |
167 ;; The prefix argument is also ignored by `ebnf-eps-buffer' and | |
168 ;; `ebnf-eps-region'. | |
169 ;; | |
170 ;; Any of the `ebnf-' commands can be bound to keys. Here are some examples: | |
171 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
172 ;; (global-set-key 'f22 'ebnf-print-buffer) ;f22 is prsc |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
173 ;; (global-set-key '(shift f22) 'ebnf-print-region) |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
174 ;; (global-set-key '(control f22) 'ebnf-despool) |
27451 | 175 ;; |
176 ;; | |
54714 | 177 ;; Invoking Ebnf2ps in Batch |
178 ;; ------------------------- | |
179 ;; | |
180 ;; It's possible also to run ebnf2ps in batch, this is useful when, for | |
181 ;; example, you have a directory with a lot of files containing the EBNF to be | |
182 ;; translated to PostScript. | |
183 ;; | |
184 ;; To run ebnf2ps in batch type, for example: | |
185 ;; | |
186 ;; emacs -batch -l setup-ebnf2ps.el -f ebnf-eps-directory | |
187 ;; | |
188 ;; Where setup-ebnf2ps.el should be a file containing: | |
189 ;; | |
190 ;; ;; set load-path if ebnf2ps isn't installed in your Emacs environment | |
191 ;; (setq load-path (append (list "/dir/of/ebnf2ps") load-path)) | |
192 ;; (require 'ebnf2ps) | |
193 ;; ;; insert here your ebnf2ps settings | |
194 ;; (setq ebnf-terminal-shape 'bevel) | |
195 ;; ;; etc. | |
196 ;; | |
197 ;; | |
27451 | 198 ;; EBNF Syntax |
199 ;; ----------- | |
200 ;; | |
54714 | 201 ;; BNF (Backus Naur Form) notation is defined like languages, and like |
202 ;; languages there are rules about name formation and syntax. In this section | |
203 ;; it's defined a BNF syntax that it's called simply EBNF (Extended BNF). | |
204 ;; ebnf2ps package also deal with other BNF notation. Please, see the variable | |
205 ;; `ebnf-syntax' documentation below in this section. | |
206 ;; | |
27451 | 207 ;; The current EBNF that ebnf2ps accepts has the following constructions: |
208 ;; | |
209 ;; ; comment (until end of line) | |
210 ;; A non-terminal | |
211 ;; "C" terminal | |
212 ;; ?C? special | |
213 ;; $A default non-terminal (see text below) | |
214 ;; $"C" default terminal (see text below) | |
215 ;; $?C? default special (see text below) | |
216 ;; A = B. production (A is the header and B the body) | |
217 ;; C D sequence (C occurs before D) | |
218 ;; C | D alternative (C or D occurs) | |
219 ;; A - B exception (A excluding B, B without any non-terminal) | |
54190 | 220 ;; n * A repetition (A repeats at least n (integer) times) |
221 ;; n * n A repetition (A repeats exactly n (integer) times) | |
222 ;; n * m A repetition (A repeats at least n (integer) and at most | |
223 ;; m (integer) times) | |
27451 | 224 ;; (C) group (expression C is grouped together) |
225 ;; [C] optional (C may or not occurs) | |
226 ;; C+ one or more occurrences of C | |
227 ;; {C}+ one or more occurrences of C | |
228 ;; {C}* zero or more occurrences of C | |
229 ;; {C} zero or more occurrences of C | |
230 ;; C / D equivalent to: C {D C}* | |
231 ;; {C || D}+ equivalent to: C {D C}* | |
232 ;; {C || D}* equivalent to: [C {D C}*] | |
233 ;; {C || D} equivalent to: [C {D C}*] | |
234 ;; | |
235 ;; The EBNF syntax written using the notation above is: | |
236 ;; | |
237 ;; EBNF = {production}+. | |
238 ;; | |
239 ;; production = non_terminal "=" body ".". ;; production | |
240 ;; | |
241 ;; body = {sequence || "|"}*. ;; alternative | |
242 ;; | |
243 ;; sequence = {exception}*. ;; sequence | |
244 ;; | |
245 ;; exception = repeat [ "-" repeat]. ;; exception | |
246 ;; | |
54190 | 247 ;; repeat = [ integer "*" [ integer ]] term. ;; repetition |
27451 | 248 ;; |
249 ;; term = factor | |
250 ;; | [factor] "+" ;; one-or-more | |
251 ;; | [factor] "/" [factor] ;; one-or-more | |
252 ;; . | |
253 ;; | |
254 ;; factor = [ "$" ] "\"" terminal "\"" ;; terminal | |
255 ;; | [ "$" ] non_terminal ;; non-terminal | |
256 ;; | [ "$" ] "?" special "?" ;; special | |
257 ;; | "(" body ")" ;; group | |
258 ;; | "[" body "]" ;; zero-or-one | |
259 ;; | "{" body [ "||" body ] "}+" ;; one-or-more | |
260 ;; | "{" body [ "||" body ] "}*" ;; zero-or-more | |
261 ;; | "{" body [ "||" body ] "}" ;; zero-or-more | |
262 ;; . | |
263 ;; | |
39342
73061d0eb82e
Replace "Prologue" by "Prolog" in PostScript
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
264 ;; non_terminal = "[!#%&'*-,0-:<>@-Z\\\\^-z~\\240-\\377]+". |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
265 ;; ;; that is, a valid non_terminal accepts decimal digits, letters (upper |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
266 ;; ;; and lower), 8-bit accentuated characters, |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
267 ;; ;; "!", "#", "%", "&", "'", "*", "+", ",", ":", |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
268 ;; ;; "<", ">", "@", "\", "^", "_", "`" and "~". |
27451 | 269 ;; |
270 ;; terminal = "\\([^\"\\]\\|\\\\[ -~\\240-\\377]\\)+". | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
271 ;; ;; that is, a valid terminal accepts any printable character (including |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
272 ;; ;; 8-bit accentuated characters) except `"', as `"' is used to delimit a |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
273 ;; ;; terminal. Also, accepts escaped characters, that is, a character |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
274 ;; ;; pair starting with `\' followed by a printable character, for |
74086
5bc3fbbf9e9b
(ebnf-stop-on-error): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
73914
diff
changeset
|
275 ;; ;; example: \", \\. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
276 ;; |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
277 ;; special = "[^?\\000-\\010\\012-\\037\\177-\\237]*". |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
278 ;; ;; that is, a valid special accepts any printable character (including |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
279 ;; ;; 8-bit accentuated characters) and tabs except `?', as `?' is used to |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
280 ;; ;; delimit a special. |
27451 | 281 ;; |
282 ;; integer = "[0-9]+". | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
283 ;; ;; that is, an integer is a sequence of one or more decimal digits. |
27451 | 284 ;; |
285 ;; comment = ";" "[^\\n\\000-\\010\\016-\\037\\177-\\237]*" "\\n". | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
286 ;; ;; that is, a comment starts with the character `;' and terminates at end |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
287 ;; ;; of line. Also, it only accepts printable characters (including 8-bit |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
288 ;; ;; accentuated characters) and tabs. |
27451 | 289 ;; |
290 ;; Try to use the above EBNF to test ebnf2ps. | |
291 ;; | |
292 ;; The `default' terminal, non-terminal and special is a way to indicate a | |
293 ;; default path in a production. For example, the production: | |
294 ;; | |
295 ;; X = [ $A ( B | $C ) | D ]. | |
296 ;; | |
297 ;; Indicates that the default meaning for "X" is "A C" if "X" is empty. | |
298 ;; | |
299 ;; The terminal name is controlled by `ebnf-terminal-regexp' and | |
300 ;; `ebnf-case-fold-search', so it's possible to match other kind of terminal | |
301 ;; name besides that enclosed by `"'. | |
302 ;; | |
303 ;; Let's see an example: | |
304 ;; | |
305 ;; (setq ebnf-terminal-regexp "[A-Z][_A-Z]*") ; upper case name | |
306 ;; (setq ebnf-case-fold-search nil) ; exact matching | |
307 ;; | |
308 ;; If you have the production: | |
309 ;; | |
310 ;; Logical = "(" Expression ( OR | AND | "XOR" ) Expression ")". | |
311 ;; | |
312 ;; The names are classified as: | |
313 ;; | |
314 ;; Logical Expression non-terminal | |
315 ;; "(" OR AND "XOR" ")" terminal | |
316 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
317 ;; The line comment is controlled by `ebnf-lex-comment-char'. The default |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
318 ;; value is ?\; (character `;'). |
27451 | 319 ;; |
320 ;; The end of production is controlled by `ebnf-lex-eop-char'. The default | |
321 ;; value is ?. (character `.'). | |
322 ;; | |
323 ;; The variable `ebnf-syntax' specifies which syntax to recognize: | |
324 ;; | |
325 ;; `ebnf' ebnf2ps recognizes the syntax described above. | |
326 ;; The following variables *ONLY* have effect with this | |
327 ;; setting: | |
328 ;; `ebnf-terminal-regexp', `ebnf-case-fold-search', | |
329 ;; `ebnf-lex-comment-char' and `ebnf-lex-eop-char'. | |
330 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
331 ;; `abnf' ebnf2ps recognizes the syntax described in the URL: |
54189 | 332 ;; `http://www.ietf.org/rfc/rfc2234.txt' |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
333 ;; ("Augmented BNF for Syntax Specifications: ABNF"). |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
334 ;; |
27451 | 335 ;; `iso-ebnf' ebnf2ps recognizes the syntax described in the URL: |
336 ;; `http://www.cl.cam.ac.uk/~mgk25/iso-ebnf.html' | |
337 ;; ("International Standard of the ISO EBNF Notation"). | |
338 ;; The following variables *ONLY* have effect with this | |
339 ;; setting: | |
340 ;; `ebnf-iso-alternative-p' and `ebnf-iso-normalize-p'. | |
341 ;; | |
342 ;; `yacc' ebnf2ps recognizes the Yacc/Bison syntax. | |
343 ;; The following variable *ONLY* has effect with this | |
344 ;; setting: | |
345 ;; `ebnf-yac-ignore-error-recovery'. | |
346 ;; | |
54625 | 347 ;; `ebnfx' ebnf2ps recognizes the syntax described in the URL: |
348 ;; `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation' | |
349 ;; ("Extensible Markup Language (XML) 1.0 (Third Edition)") | |
350 ;; | |
54714 | 351 ;; `dtd' ebnf2ps recognizes the syntax described in the URL: |
352 ;; `http://www.w3.org/TR/2004/REC-xml-20040204/' | |
353 ;; ("Extensible Markup Language (XML) 1.0 (Third Edition)") | |
354 ;; | |
27451 | 355 ;; Any other value is treated as `ebnf'. |
356 ;; | |
357 ;; The default value is `ebnf'. | |
358 ;; | |
359 ;; | |
360 ;; Optimizations | |
361 ;; ------------- | |
362 ;; | |
363 ;; The following EBNF optimizations are done: | |
364 ;; | |
365 ;; [ { A }* ] ==> { A }* | |
366 ;; [ { A }+ ] ==> { A }* | |
367 ;; [ A ] + ==> { A }* | |
368 ;; { A }* + ==> { A }* | |
369 ;; { A }+ + ==> { A }+ | |
370 ;; { A }- ==> { A }+ | |
371 ;; [ A ]- ==> A | |
372 ;; ( A | EMPTY )- ==> A | |
373 ;; ( A | B | EMPTY )- ==> A | B | |
374 ;; [ A | B ] ==> A | B | EMPTY | |
375 ;; n * EMPTY ==> EMPTY | |
376 ;; EMPTY + ==> EMPTY | |
377 ;; EMPTY / EMPTY ==> EMPTY | |
378 ;; EMPTY - A ==> EMPTY | |
379 ;; | |
380 ;; The following optimizations are done when `ebnf-optimize' is non-nil: | |
381 ;; | |
382 ;; left recursion: | |
383 ;; 1. A = B | A C. ==> A = B {C}*. | |
384 ;; 2. A = B | A B. ==> A = {B}+. | |
385 ;; 3. A = | A B. ==> A = {B}*. | |
386 ;; 4. A = B | A C B. ==> A = {B || C}+. | |
387 ;; 5. A = B | D | A C | A E. ==> A = ( B | D ) { C | E }*. | |
388 ;; | |
389 ;; optional: | |
390 ;; 6. A = B | . ==> A = [B]. | |
391 ;; 7. A = | B . ==> A = [B]. | |
392 ;; | |
58339 | 393 ;; factorization: |
27451 | 394 ;; 8. A = B C | B D. ==> A = B (C | D). |
395 ;; 9. A = C B | D B. ==> A = (C | D) B. | |
396 ;; 10. A = B C E | B D E. ==> A = B (C | D) E. | |
397 ;; | |
398 ;; The above optimizations are specially useful when `ebnf-syntax' is `yacc'. | |
399 ;; | |
400 ;; | |
401 ;; Form Feed | |
402 ;; --------- | |
403 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
404 ;; You may use form feed (^L \014) to force a production to start on a new |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
405 ;; page, for example: |
27451 | 406 ;; |
407 ;; a) A = B | C. | |
408 ;; ^L | |
409 ;; X = Y | Z. | |
410 ;; | |
411 ;; b) A = B ^L | C. | |
412 ;; X = Y | Z. | |
413 ;; | |
414 ;; c) A = B ^L^L^L | C.^L | |
415 ;; ^L | |
416 ;; X = Y | Z. | |
417 ;; | |
418 ;; In all examples above, only the production X will start on a new page. | |
419 ;; | |
420 ;; | |
421 ;; Actions in Comments | |
422 ;; ------------------- | |
423 ;; | |
424 ;; ebnf2ps accepts the following actions in comments: | |
425 ;; | |
54714 | 426 ;; ;^ same as form feed. See section Form Feed above. |
427 ;; | |
27451 | 428 ;; ;> the next production starts in the same line as the current one. |
429 ;; It is useful when `ebnf-horizontal-orientation' is nil. | |
430 ;; | |
431 ;; ;< the next production starts in the next line. | |
432 ;; It is useful when `ebnf-horizontal-orientation' is non-nil. | |
433 ;; | |
434 ;; ;[EPS open a new EPS file. The EPS file name has the form: | |
435 ;; <PREFIX><NAME>.eps | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
436 ;; where <PREFIX> is given by variable `ebnf-eps-prefix' and |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
437 ;; <NAME> is the string given by ;[ action comment, this string is |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
438 ;; mapped to form a valid file name (see documentation for |
27451 | 439 ;; `ebnf-eps-buffer' or `ebnf-eps-region'). |
440 ;; It has effect only during `ebnf-eps-buffer' or | |
441 ;; `ebnf-eps-region' execution. | |
442 ;; It's an error to try to open an already opened EPS file. | |
443 ;; | |
444 ;; ;]EPS close an opened EPS file. | |
445 ;; It has effect only during `ebnf-eps-buffer' or | |
446 ;; `ebnf-eps-region' execution. | |
447 ;; It's an error to try to close a not opened EPS file. | |
448 ;; | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
449 ;; ;Hheader generate a header in current EPS file. The header string can |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
450 ;; have the following formats: |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
451 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
452 ;; %% prints a % character. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
453 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
454 ;; %H prints the `ebnf-eps-header' (which see) value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
455 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
456 ;; %F prints the `ebnf-eps-footer' (which see) value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
457 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
458 ;; Any other format is ignored, that is, if, for example, it's |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
459 ;; used %s then %s characters are stripped out from the header. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
460 ;; If header is an empty string, no header is generated until a |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
461 ;; non-empty header is specified or `ebnf-eps-header' has a |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
462 ;; non-empty string value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
463 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
464 ;; ;Ffooter generate a footer in current EPS file. Similar to ;H action |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
465 ;; comment. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
466 ;; |
27451 | 467 ;; So if you have: |
468 ;; | |
469 ;; (setq ebnf-horizontal-orientation nil) | |
470 ;; | |
471 ;; A = t. | |
472 ;; C = x. | |
473 ;; ;> C and B are drawn in the same line | |
474 ;; B = y. | |
475 ;; W = v. | |
476 ;; | |
477 ;; The graphical result is: | |
478 ;; | |
479 ;; +---+ | |
480 ;; | A | | |
481 ;; +---+ | |
482 ;; | |
483 ;; +---------+ +-----+ | |
484 ;; | | | | | |
485 ;; | C | | | | |
486 ;; | | | B | | |
487 ;; +---------+ | | | |
488 ;; | | | |
489 ;; +-----+ | |
490 ;; | |
491 ;; +-----------+ | |
492 ;; | W | | |
493 ;; +-----------+ | |
494 ;; | |
495 ;; Note that if ascending production sort is used, the productions A and B will | |
496 ;; be drawn in the same line instead of C and B. | |
497 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
498 ;; If consecutive actions occur, only the last one takes effect, so if you |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
499 ;; have: |
27451 | 500 ;; |
501 ;; A = X. | |
502 ;; ;< | |
503 ;; ^L | |
504 ;; ;> | |
505 ;; B = Y. | |
506 ;; | |
507 ;; Only the ;> will take effect, that is, A and B will be drawn in the same | |
508 ;; line. | |
509 ;; | |
54714 | 510 ;; In ISO EBNF the above actions are specified as (*^*), (*>*), (*<*), (*[EPS*) |
511 ;; and (*]EPS*). The first example above should be written: | |
27451 | 512 ;; |
513 ;; A = t; | |
514 ;; C = x; | |
515 ;; (*> C and B are drawn in the same line *) | |
516 ;; B = y; | |
517 ;; W = v; | |
518 ;; | |
519 ;; For an example of EPS action when executing `ebnf-eps-buffer' or | |
520 ;; `ebnf-eps-region': | |
521 ;; | |
522 ;; Z = B0. | |
523 ;; ;[CC | |
524 ;; ;[AA | |
525 ;; A = B1. | |
526 ;; ;[BB | |
527 ;; C = B2. | |
528 ;; ;]AA | |
529 ;; B = B3. | |
530 ;; ;]BB | |
531 ;; ;]CC | |
532 ;; D = B4. | |
533 ;; E = B5. | |
534 ;; ;[CC | |
535 ;; F = B6. | |
536 ;; ;]CC | |
537 ;; G = B7. | |
538 ;; | |
539 ;; The following table summarizes the results: | |
540 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
541 ;; EPS FILE NAME NO SORT ASCENDING SORT DESCENDING SORT |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
542 ;; ebnf--AA.eps A C A C C A |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
543 ;; ebnf--BB.eps C B B C C B |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
544 ;; ebnf--CC.eps A C B F A B C F F C B A |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
545 ;; ebnf--D.eps D D D |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
546 ;; ebnf--E.eps E E E |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
547 ;; ebnf--G.eps G G G |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
548 ;; ebnf--Z.eps Z Z Z |
27451 | 549 ;; |
550 ;; As you can see if EPS actions is not used, each single production is | |
551 ;; generated per EPS file. To avoid overriding EPS files, use names in ;[ that | |
552 ;; it's not an existing production name. | |
553 ;; | |
554 ;; In the following case: | |
555 ;; | |
556 ;; A = B0. | |
557 ;; ;[AA | |
558 ;; A = B1. | |
559 ;; ;[BB | |
560 ;; A = B2. | |
561 ;; | |
562 ;; The production A is generated in both files ebnf--AA.eps and ebnf--BB.eps. | |
563 ;; | |
564 ;; | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
565 ;; Log Messages |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
566 ;; ------------ |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
567 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
568 ;; The buffer *Ebnf2ps Log* is where the ebnf2ps log messages are inserted. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
569 ;; These messages are intended to help debugging ebnf2ps. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
570 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
571 ;; The log messages are enabled by `ebnf-log' option (which see). The default |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
572 ;; value is nil, that is, no log messages are generated. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
573 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
574 ;; |
27451 | 575 ;; Utilities |
576 ;; --------- | |
577 ;; | |
578 ;; Some tools are provided to help you. | |
579 ;; | |
580 ;; `ebnf-setup' returns the current setup. | |
581 ;; | |
54191 | 582 ;; `ebnf-syntax-directory' does a syntactic analysis of your EBNF files in the |
583 ;; given directory. | |
584 ;; | |
585 ;; `ebnf-syntax-file' does a syntactic analysis of your EBNF in the given | |
586 ;; file. | |
587 ;; | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
588 ;; `ebnf-syntax-buffer' does a syntactic analysis of your EBNF in the current |
27451 | 589 ;; buffer. |
590 ;; | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
591 ;; `ebnf-syntax-region' does a syntactic analysis of your EBNF in the current |
27451 | 592 ;; region. |
593 ;; | |
594 ;; `ebnf-customize' activates a customization buffer for ebnf2ps options. | |
595 ;; | |
54191 | 596 ;; `ebnf-syntax-directory', `ebnf-syntax-file', `ebnf-syntax-buffer', |
597 ;; `ebnf-syntax-region' and `ebnf-customize' can be bound to keys in the same | |
598 ;; way as `ebnf-' commands. | |
27451 | 599 ;; |
600 ;; | |
601 ;; Hooks | |
602 ;; ----- | |
603 ;; | |
604 ;; ebn2ps has the following hook variables: | |
605 ;; | |
606 ;; `ebnf-hook' | |
607 ;; It is evaluated once before any ebnf2ps process. | |
608 ;; | |
609 ;; `ebnf-production-hook' | |
610 ;; It is evaluated on each beginning of production. | |
611 ;; | |
612 ;; `ebnf-page-hook' | |
613 ;; It is evaluated on each beginning of page. | |
614 ;; | |
615 ;; | |
616 ;; Options | |
617 ;; ------- | |
618 ;; | |
619 ;; Below it's shown a brief description of ebnf2ps options, please, see the | |
620 ;; options declaration in the code for a long documentation. | |
621 ;; | |
622 ;; `ebnf-horizontal-orientation' Non-nil means productions are drawn | |
623 ;; horizontally. | |
624 ;; | |
625 ;; `ebnf-horizontal-max-height' Non-nil means to use maximum production | |
626 ;; height in horizontal orientation. | |
627 ;; | |
628 ;; `ebnf-production-horizontal-space' Specify horizontal space in points | |
629 ;; between productions. | |
630 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
631 ;; `ebnf-production-vertical-space' Specify vertical space in points |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
632 ;; between productions. |
27451 | 633 ;; |
634 ;; `ebnf-justify-sequence' Specify justification of terms in a | |
635 ;; sequence inside alternatives. | |
636 ;; | |
637 ;; `ebnf-terminal-regexp' Specify how it's a terminal name. | |
638 ;; | |
639 ;; `ebnf-case-fold-search' Non-nil means ignore case on matching. | |
640 ;; | |
641 ;; `ebnf-terminal-font' Specify terminal font. | |
642 ;; | |
643 ;; `ebnf-terminal-shape' Specify terminal box shape. | |
644 ;; | |
645 ;; `ebnf-terminal-shadow' Non-nil means terminal box will have a | |
646 ;; shadow. | |
647 ;; | |
648 ;; `ebnf-terminal-border-width' Specify border width for terminal box. | |
649 ;; | |
650 ;; `ebnf-terminal-border-color' Specify border color for terminal box. | |
651 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
652 ;; `ebnf-production-name-p' Non-nil means production name will be |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
653 ;; printed. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
654 ;; |
27451 | 655 ;; `ebnf-sort-production' Specify how productions are sorted. |
656 ;; | |
657 ;; `ebnf-production-font' Specify production font. | |
658 ;; | |
659 ;; `ebnf-non-terminal-font' Specify non-terminal font. | |
660 ;; | |
661 ;; `ebnf-non-terminal-shape' Specify non-terminal box shape. | |
662 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
663 ;; `ebnf-non-terminal-shadow' Non-nil means non-terminal box will |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
664 ;; have a shadow. |
27451 | 665 ;; |
666 ;; `ebnf-non-terminal-border-width' Specify border width for non-terminal | |
667 ;; box. | |
668 ;; | |
669 ;; `ebnf-non-terminal-border-color' Specify border color for non-terminal | |
670 ;; box. | |
671 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
672 ;; `ebnf-special-show-delimiter' Non-nil means special delimiter |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
673 ;; (character `?') is shown. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
674 ;; |
27451 | 675 ;; `ebnf-special-font' Specify special font. |
676 ;; | |
677 ;; `ebnf-special-shape' Specify special box shape. | |
678 ;; | |
679 ;; `ebnf-special-shadow' Non-nil means special box will have a | |
680 ;; shadow. | |
681 ;; | |
682 ;; `ebnf-special-border-width' Specify border width for special box. | |
683 ;; | |
684 ;; `ebnf-special-border-color' Specify border color for special box. | |
685 ;; | |
686 ;; `ebnf-except-font' Specify except font. | |
687 ;; | |
688 ;; `ebnf-except-shape' Specify except box shape. | |
689 ;; | |
690 ;; `ebnf-except-shadow' Non-nil means except box will have a | |
691 ;; shadow. | |
692 ;; | |
693 ;; `ebnf-except-border-width' Specify border width for except box. | |
694 ;; | |
695 ;; `ebnf-except-border-color' Specify border color for except box. | |
696 ;; | |
697 ;; `ebnf-repeat-font' Specify repeat font. | |
698 ;; | |
699 ;; `ebnf-repeat-shape' Specify repeat box shape. | |
700 ;; | |
701 ;; `ebnf-repeat-shadow' Non-nil means repeat box will have a | |
702 ;; shadow. | |
703 ;; | |
704 ;; `ebnf-repeat-border-width' Specify border width for repeat box. | |
705 ;; | |
706 ;; `ebnf-repeat-border-color' Specify border color for repeat box. | |
707 ;; | |
708 ;; `ebnf-entry-percentage' Specify entry height on alternatives. | |
709 ;; | |
710 ;; `ebnf-arrow-shape' Specify the arrow shape. | |
711 ;; | |
712 ;; `ebnf-chart-shape' Specify chart flow shape. | |
713 ;; | |
714 ;; `ebnf-color-p' Non-nil means use color. | |
715 ;; | |
716 ;; `ebnf-line-width' Specify flow line width. | |
717 ;; | |
718 ;; `ebnf-line-color' Specify flow line color. | |
719 ;; | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
720 ;; `ebnf-arrow-extra-width' Specify extra width for arrow shape |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
721 ;; drawing. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
722 ;; |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
723 ;; `ebnf-arrow-scale' Specify the arrow scale. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
724 ;; |
31255 | 725 ;; `ebnf-user-arrow' Specify a sexp for user arrow shape (a |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
726 ;; PostScript code). |
27451 | 727 ;; |
728 ;; `ebnf-debug-ps' Non-nil means to generate PostScript | |
729 ;; debug procedures. | |
730 ;; | |
731 ;; `ebnf-lex-comment-char' Specify the line comment character. | |
732 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
733 ;; `ebnf-lex-eop-char' Specify the end of production |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
734 ;; character. |
27451 | 735 ;; |
736 ;; `ebnf-syntax' Specify syntax to be recognized. | |
737 ;; | |
738 ;; `ebnf-iso-alternative-p' Non-nil means use alternative ISO EBNF. | |
739 ;; | |
740 ;; `ebnf-iso-normalize-p' Non-nil means normalize ISO EBNF syntax | |
741 ;; names. | |
742 ;; | |
743 ;; `ebnf-default-width' Specify additional border width over | |
744 ;; default terminal, non-terminal or | |
745 ;; special. | |
746 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
747 ;; `ebnf-file-suffix-regexp' Specify file name suffix that contains |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
748 ;; EBNF. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
749 ;; |
27451 | 750 ;; `ebnf-eps-prefix' Specify EPS prefix file name. |
751 ;; | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
752 ;; `ebnf-eps-header-font' Specify EPS header font. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
753 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
754 ;; `ebnf-eps-header' Specify EPS header. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
755 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
756 ;; `ebnf-eps-footer-font' Specify EPS footer font. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
757 ;; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
758 ;; `ebnf-eps-footer' Specify EPS footer. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
759 ;; |
27451 | 760 ;; `ebnf-use-float-format' Non-nil means use `%f' float format. |
761 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
762 ;; `ebnf-stop-on-error' Non-nil means signal error and stop. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
763 ;; Nil means signal error and continue. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
764 ;; |
27451 | 765 ;; `ebnf-yac-ignore-error-recovery' Non-nil means ignore error recovery. |
766 ;; | |
767 ;; `ebnf-ignore-empty-rule' Non-nil means ignore empty rules. | |
768 ;; | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
769 ;; `ebnf-optimize' Non-nil means optimize syntactic chart |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
770 ;; of rules. |
27451 | 771 ;; |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
772 ;; `ebnf-log' Non-nil means generate log messages. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
773 ;; |
27451 | 774 ;; To set the above options you may: |
775 ;; | |
776 ;; a) insert the code in your ~/.emacs, like: | |
777 ;; | |
778 ;; (setq ebnf-terminal-shape 'bevel) | |
779 ;; | |
780 ;; This way always keep your default settings when you enter a new Emacs | |
781 ;; session. | |
782 ;; | |
783 ;; b) or use `set-variable' in your Emacs session, like: | |
784 ;; | |
785 ;; M-x set-variable RET ebnf-terminal-shape RET bevel RET | |
786 ;; | |
787 ;; This way keep your settings only during the current Emacs session. | |
788 ;; | |
789 ;; c) or use customization, for example: | |
790 ;; click on menu-bar *Help* option, | |
791 ;; then click on *Customize*, | |
792 ;; then click on *Browse Customization Groups*, | |
793 ;; expand *PostScript* group, | |
794 ;; expand *Ebnf2ps* group | |
795 ;; and then customize ebnf2ps options. | |
796 ;; Through this way, you may choose if the settings are kept or not when | |
797 ;; you leave out the current Emacs session. | |
798 ;; | |
799 ;; d) or see the option value: | |
800 ;; | |
801 ;; C-h v ebnf-terminal-shape RET | |
802 ;; | |
803 ;; and click the *customize* hypertext button. | |
804 ;; Through this way, you may choose if the settings are kept or not when | |
805 ;; you leave out the current Emacs session. | |
806 ;; | |
807 ;; e) or invoke: | |
808 ;; | |
809 ;; M-x ebnf-customize RET | |
810 ;; | |
811 ;; and then customize ebnf2ps options. | |
812 ;; Through this way, you may choose if the settings are kept or not when | |
813 ;; you leave out the current Emacs session. | |
814 ;; | |
815 ;; | |
816 ;; Styles | |
817 ;; ------ | |
818 ;; | |
819 ;; Sometimes you need to change the EBNF style you are using, for example, | |
820 ;; change the shapes and colors. These changes may force you to set some | |
821 ;; variables and after use, set back the variables to the old values. | |
822 ;; | |
823 ;; To help to handle this situation, ebnf2ps has the following commands to | |
824 ;; handle styles: | |
825 ;; | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
826 ;; `ebnf-find-style' Return style definition if NAME is already defined; |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
827 ;; otherwise, return nil. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
828 ;; |
27451 | 829 ;; `ebnf-insert-style' Insert a new style NAME with inheritance INHERITS and |
830 ;; values VALUES. | |
831 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
832 ;; `ebnf-delete-style' Delete style NAME. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
833 ;; |
27451 | 834 ;; `ebnf-merge-style' Merge values of style NAME with style VALUES. |
835 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
836 ;; `ebnf-apply-style' Set STYLE as the current style. |
27451 | 837 ;; |
838 ;; `ebnf-reset-style' Reset current style. | |
839 ;; | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
840 ;; `ebnf-push-style' Push the current style and set STYLE as the current |
74086
5bc3fbbf9e9b
(ebnf-stop-on-error): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
73914
diff
changeset
|
841 ;; style. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
842 ;; |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
843 ;; `ebnf-pop-style' Pop a style and set it as the current style. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
844 ;; |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
845 ;; These commands help to put together a lot of variable settings in a group |
27451 | 846 ;; and name this group. So when you wish to apply these settings it's only |
847 ;; needed to give the name. | |
848 ;; | |
75624 | 849 ;; There is also a notion of simple inheritance of style: if you declare that |
850 ;; style A inherits from style B, all settings of B are applied first and then | |
851 ;; the settings of A are applied. This is useful when you wish to modify some | |
852 ;; aspects of an existing style, but at same time wish to keep it unmodified. | |
27451 | 853 ;; |
854 ;; See documentation for `ebnf-style-database'. | |
855 ;; | |
856 ;; | |
857 ;; Layout | |
858 ;; ------ | |
859 ;; | |
860 ;; Below it is the layout of minimum area to draw each element, and it's used | |
861 ;; the following terms: | |
862 ;; | |
863 ;; font height is given by: | |
864 ;; (terminal font height + non-terminal font height) / 2 | |
865 ;; | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
866 ;; entry is the vertical position used to know where it should |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
867 ;; be drawn the flow line in the current element. |
27451 | 868 ;; |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
869 ;; extra is given by `ebnf-arrow-extra-width'. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
870 ;; |
27451 | 871 ;; |
872 ;; * SPECIAL, TERMINAL and NON-TERMINAL | |
873 ;; | |
874 ;; +==============+................................... | |
875 ;; | | } font height / 2 } entry } | |
876 ;; | XXXXXXXX...|....... } } | |
877 ;; ====+ XXXXXXXX +==== } text height ...... } height | |
878 ;; : | XXXXXXXX...|...:... } | |
879 ;; : | : : | : } font height / 2 } | |
880 ;; : +==============+...:............................... | |
881 ;; : : : : : : | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
882 ;; : : : : : :......................... |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
883 ;; : : : : : } font height } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
884 ;; : : : : :....... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
885 ;; : : : : } font height / 2 } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
886 ;; : : : :........... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
887 ;; : : : } text width } width |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
888 ;; : : :.................. } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
889 ;; : : } font height / 2 } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
890 ;; : :...................... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
891 ;; : } font height + extra } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
892 ;; :................................................. |
27451 | 893 ;; |
894 ;; | |
895 ;; * OPTIONAL | |
896 ;; | |
897 ;; +==========+..................................... | |
898 ;; | | } } } | |
899 ;; | | } entry } } | |
900 ;; | | } } } | |
901 ;; ===+===+ +===+===... } element height } height | |
902 ;; : \ | | / : } } | |
903 ;; : + | | + : } } | |
904 ;; : | +==========+.|................. } | |
905 ;; : | : : | : } font height } | |
906 ;; : +==============+................................... | |
907 ;; : : : : | |
908 ;; : : : :...................... | |
909 ;; : : : } font height * 2 } | |
910 ;; : : :.......... } | |
911 ;; : : } element width } width | |
912 ;; : :..................... } | |
913 ;; : } font height * 2 } | |
914 ;; :............................................... | |
915 ;; | |
916 ;; | |
917 ;; * ALTERNATIVE | |
918 ;; | |
919 ;; +===+................................... | |
920 ;; +==+ A +==+ } A height } } | |
921 ;; | +===+..|........ } entry } | |
922 ;; + + } font height } } | |
923 ;; / +===+...\....... } } | |
924 ;; ===+====+ B +====+=== } B height ..... } height | |
925 ;; : \ +===+.../....... } | |
926 ;; : + + : } font height } | |
927 ;; : | +===+..|........ } | |
928 ;; : +==+ C +==+ : } C height } | |
929 ;; : : +===+................................... | |
930 ;; : : : : | |
931 ;; : : : :...................... | |
932 ;; : : : } font height * 2 } | |
933 ;; : : :......... } | |
934 ;; : : } max width } width | |
935 ;; : :................. } | |
936 ;; : } font height * 2 } | |
937 ;; :.......................................... | |
938 ;; | |
939 ;; NOTES: | |
940 ;; 1. An empty alternative has zero of height. | |
941 ;; | |
942 ;; 2. The variable `ebnf-entry-percentage' is used to determine the | |
943 ;; entry point. | |
944 ;; | |
945 ;; | |
946 ;; * ZERO OR MORE | |
947 ;; | |
948 ;; +===========+............................... | |
949 ;; +=+ separator +=+ } separator height } | |
950 ;; / +===========+..\........ } | |
951 ;; + + } } | |
952 ;; | | } font height } | |
953 ;; + + } } | |
954 ;; \ +===========+../........ } height = entry | |
955 ;; +=+ element +=+ } element height } | |
956 ;; /: +===========+..\........ } | |
957 ;; + : : + } } | |
958 ;; + : : + } font height } | |
959 ;; / : : \ } } | |
960 ;; ==+=======================+==....................... | |
961 ;; : : : : | |
962 ;; : : : :....................... | |
963 ;; : : : } font height * 2 } | |
964 ;; : : :......... } | |
965 ;; : : } max width } width | |
966 ;; : :......................... } | |
967 ;; : } font height * 2 } | |
968 ;; :................................................... | |
969 ;; | |
970 ;; | |
971 ;; * ONE OR MORE | |
972 ;; | |
973 ;; +===========+...................................... | |
974 ;; +=+ separator +=+ } separator height } } | |
975 ;; / +===========+..\...... } } | |
976 ;; + + } } entry } | |
977 ;; | | } font height } } height | |
978 ;; + + } } } | |
979 ;; \ +===========+../...... } } | |
980 ;; ===+=+ element +=+=== } element height .... } | |
981 ;; : : +===========+...................................... | |
982 ;; : : : : | |
983 ;; : : : :........................ | |
984 ;; : : : } font height * 2 } | |
985 ;; : : :....... } | |
986 ;; : : } max width } width | |
987 ;; : :....................... } | |
988 ;; : } font height * 2 } | |
989 ;; :.............................................. | |
990 ;; | |
991 ;; | |
992 ;; * PRODUCTION | |
993 ;; | |
994 ;; XXXXXX:...................................... | |
995 ;; XXXXXX: } production font height } | |
996 ;; XXXXXX:............ } | |
997 ;; } font height } | |
998 ;; +======+....... } height = entry | |
999 ;; | | } } | |
1000 ;; ====+ +==== } element height } | |
1001 ;; : | | : } } | |
1002 ;; : +======+................................. | |
1003 ;; : : : : | |
1004 ;; : : : :...................... | |
1005 ;; : : : } font height * 2 } | |
1006 ;; : : :....... } | |
1007 ;; : : } element width } width | |
1008 ;; : :.............. } | |
1009 ;; : } font height * 2 } | |
1010 ;; :..................................... | |
1011 ;; | |
1012 ;; | |
1013 ;; * REPEAT | |
1014 ;; | |
1015 ;; +================+................................... | |
1016 ;; | | } font height / 2 } entry } | |
1017 ;; | +===+...|....... } } | |
1018 ;; ====+ N * | X | +==== } X height ......... } height | |
1019 ;; : | : : +===+...|...:... } | |
1020 ;; : | : : : : | : } font height / 2 } | |
1021 ;; : +================+...:............................... | |
1022 ;; : : : : : : : : | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1023 ;; : : : : : : : :.......................... |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1024 ;; : : : : : : : } font height } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1025 ;; : : : : : : :....... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1026 ;; : : : : : : } font height / 2 } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1027 ;; : : : : : :........... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1028 ;; : : : : : } X width } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1029 ;; : : : : :............... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1030 ;; : : : : } font height / 2 } width |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1031 ;; : : : :.................. } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1032 ;; : : : } text width } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1033 ;; : : :..................... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1034 ;; : : } font height / 2 } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1035 ;; : :........................ } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1036 ;; : } font height + extra } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1037 ;; :................................................... |
27451 | 1038 ;; |
1039 ;; | |
1040 ;; * EXCEPT | |
1041 ;; | |
1042 ;; +==================+................................... | |
1043 ;; | | } font height / 2 } entry } | |
1044 ;; | +===+ +===+...|....... } } | |
1045 ;; ====+ | X | - | y | +==== } max height ....... } height | |
1046 ;; : | +===+ +===+...|...:... } | |
1047 ;; : | : : : : | : } font height / 2 } | |
1048 ;; : +==================+...:............................... | |
1049 ;; : : : : : : : : | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1050 ;; : : : : : : : :.......................... |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1051 ;; : : : : : : : } font height } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1052 ;; : : : : : : :....... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1053 ;; : : : : : : } font height / 2 } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1054 ;; : : : : : :........... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1055 ;; : : : : : } Y width } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1056 ;; : : : : :............... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1057 ;; : : : : } font height } width |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1058 ;; : : : :................... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1059 ;; : : : } X width } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1060 ;; : : :....................... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1061 ;; : : } font height / 2 } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1062 ;; : :.......................... } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1063 ;; : } font height + extra } |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1064 ;; :..................................................... |
27451 | 1065 ;; |
1066 ;; NOTE: If Y element is empty, it's draw nothing at Y place. | |
1067 ;; | |
1068 ;; | |
1069 ;; Internal Structures | |
1070 ;; ------------------- | |
1071 ;; | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1072 ;; ebnf2ps has two passes. The first pass does a lexical and syntactic analysis |
27451 | 1073 ;; of current buffer and generates an intermediate representation. The second |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1074 ;; pass uses the intermediate representation to generate the PostScript |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1075 ;; syntactic chart. |
27451 | 1076 ;; |
1077 ;; The intermediate representation is a list of vectors, the vector element | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1078 ;; represents a syntactic chart element. Below is a vector representation for |
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1079 ;; each syntactic chart element. |
27451 | 1080 ;; |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1081 ;; [production WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME PRODUCTION ACTION] |
27451 | 1082 ;; [alternative WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST] |
1083 ;; [sequence WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST] | |
1084 ;; [terminal WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME DEFAULT] | |
1085 ;; [non-terminal WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME DEFAULT] | |
1086 ;; [special WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME DEFAULT] | |
1087 ;; [empty WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH] | |
1088 ;; [optional WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH ELEMENT] | |
1089 ;; [one-or-more WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH ELEMENT SEPARATOR] | |
1090 ;; [zero-or-more WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH ELEMENT SEPARATOR] | |
1091 ;; [repeat WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH TIMES ELEMENT] | |
1092 ;; [except WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH ELEMENT ELEMENT] | |
1093 ;; | |
1094 ;; The first vector position is a function symbol used to generate PostScript | |
1095 ;; for this element. | |
1096 ;; WIDTH-FUN is a function symbol called to adjust the element width. | |
1097 ;; DIM-FUN is a function symbol called to set the element dimensions. | |
1098 ;; ENTRY is the element entry point. | |
1099 ;; HEIGHT and WIDTH are the element height and width, respectively. | |
1100 ;; NAME is a string that it's the element name. | |
1101 ;; DEFAULT is a boolean that indicates if it's a `default' element. | |
1102 ;; PRODUCTION and ELEMENT are vectors that represents sub-elements of current | |
1103 ;; one. | |
1104 ;; LIST is a list of vector that represents the list part for alternatives and | |
1105 ;; sequences. | |
1106 ;; SEPARATOR is a vector that represents the sub-element used to separate the | |
1107 ;; list elements. | |
1108 ;; TIMES is a string representing the number of times that ELEMENT is repeated | |
1109 ;; on a repeat construction. | |
1110 ;; ACTION indicates some action that should be done before production is | |
1111 ;; generated. The current actions are: | |
1112 ;; | |
1113 ;; nil no action. | |
1114 ;; | |
1115 ;; form-feed current production starts on a new page. | |
1116 ;; | |
1117 ;; newline current production starts on next line, this is useful | |
1118 ;; when `ebnf-horizontal-orientation' is non-nil. | |
1119 ;; | |
1120 ;; keep-line current production continues on the current line, this | |
1121 ;; is useful when `ebnf-horizontal-orientation' is nil. | |
1122 ;; | |
1123 ;; | |
1124 ;; Things To Change | |
1125 ;; ---------------- | |
1126 ;; | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1127 ;; . Handle situations when syntactic chart is out of paper. |
27451 | 1128 ;; . Use other alphabet than ascii. |
1129 ;; . Optimizations... | |
1130 ;; | |
1131 ;; | |
1132 ;; Acknowledgements | |
1133 ;; ---------------- | |
1134 ;; | |
75624 | 1135 ;; Thanks to Eli Zaretskii <eliz@gnu.org> for some doc fixes. |
1136 ;; | |
54145
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
1137 ;; Thanks to Drew Adams <drew.adams@oracle.com> for suggestions: |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1138 ;; - `ebnf-arrow-extra-width', `ebnf-arrow-scale', |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
1139 ;; `ebnf-production-name-p', `ebnf-stop-on-error', |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1140 ;; `ebnf-file-suffix-regexp'and `ebnf-special-show-delimiter' variables. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1141 ;; - `ebnf-delete-style', `ebnf-eps-file' and `ebnf-eps-directory' |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1142 ;; commands. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1143 ;; - some docs fix. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1144 ;; |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1145 ;; Thanks to Matthew K. Junker <junker@alum.mit.edu> for the suggestion to deal |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1146 ;; with some Bison features (%right, %left and %prec pragmas). His suggestion |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1147 ;; was extended to deal with %nonassoc pragma too. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1148 ;; |
27451 | 1149 ;; Thanks to all who emailed comments. |
1150 ;; | |
1151 ;; | |
1152 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1153 | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35888
diff
changeset
|
1154 ;;; Code: |
27451 | 1155 |
1156 | |
1157 (require 'ps-print) | |
1158 | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1159 (and (string< ps-print-version "5.2.3") |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1160 (error "`ebnf2ps' requires `ps-print' package version 5.2.3 or later")) |
27451 | 1161 |
54145
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
1162 |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
1163 ;; to avoid gripes with Emacs 20 |
58340
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1164 (or (fboundp 'assq-delete-all) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1165 (defun assq-delete-all (key alist) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1166 "Delete from ALIST all elements whose car is KEY. |
54145
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
1167 Return the modified alist. |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
1168 Elements of ALIST that are not conses are ignored." |
58340
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1169 (let ((tail alist)) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1170 (while tail |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1171 (if (and (consp (car tail)) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1172 (eq (car (car tail)) key)) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1173 (setq alist (delq (car tail) alist))) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1174 (setq tail (cdr tail))) |
6ae939127d99
eval-and-compile
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
58339
diff
changeset
|
1175 alist))) |
54145
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
1176 |
27451 | 1177 |
1178 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1179 ;; User Variables: | |
1180 | |
1181 | |
1182 ;;; Interface to the command system | |
1183 | |
1184 (defgroup postscript nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1185 "PostScript Group." |
27451 | 1186 :tag "PostScript" |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1187 :version "20" |
27451 | 1188 :group 'emacs) |
1189 | |
1190 | |
1191 (defgroup ebnf2ps nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1192 "Translate an EBNF to a syntactic chart on PostScript." |
27451 | 1193 :prefix "ebnf-" |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1194 :version "20" |
27451 | 1195 :group 'wp |
1196 :group 'postscript) | |
1197 | |
1198 | |
1199 (defgroup ebnf-special nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1200 "Special customization." |
27451 | 1201 :prefix "ebnf-" |
1202 :tag "Special" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1203 :version "20" |
27451 | 1204 :group 'ebnf2ps) |
1205 | |
1206 | |
1207 (defgroup ebnf-except nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1208 "Except customization." |
27451 | 1209 :prefix "ebnf-" |
1210 :tag "Except" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1211 :version "20" |
27451 | 1212 :group 'ebnf2ps) |
1213 | |
1214 | |
1215 (defgroup ebnf-repeat nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1216 "Repeat customization." |
27451 | 1217 :prefix "ebnf-" |
1218 :tag "Repeat" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1219 :version "20" |
27451 | 1220 :group 'ebnf2ps) |
1221 | |
1222 | |
1223 (defgroup ebnf-terminal nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1224 "Terminal customization." |
27451 | 1225 :prefix "ebnf-" |
1226 :tag "Terminal" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1227 :version "20" |
27451 | 1228 :group 'ebnf2ps) |
1229 | |
1230 | |
1231 (defgroup ebnf-non-terminal nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1232 "Non-Terminal customization." |
27451 | 1233 :prefix "ebnf-" |
1234 :tag "Non-Terminal" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1235 :version "20" |
27451 | 1236 :group 'ebnf2ps) |
1237 | |
1238 | |
1239 (defgroup ebnf-production nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1240 "Production customization." |
27451 | 1241 :prefix "ebnf-" |
1242 :tag "Production" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1243 :version "20" |
27451 | 1244 :group 'ebnf2ps) |
1245 | |
1246 | |
1247 (defgroup ebnf-shape nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1248 "Shapes customization." |
27451 | 1249 :prefix "ebnf-" |
1250 :tag "Shape" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1251 :version "20" |
27451 | 1252 :group 'ebnf2ps) |
1253 | |
1254 | |
1255 (defgroup ebnf-displacement nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1256 "Displacement customization." |
27451 | 1257 :prefix "ebnf-" |
1258 :tag "Displacement" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1259 :version "20" |
27451 | 1260 :group 'ebnf2ps) |
1261 | |
1262 | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1263 (defgroup ebnf-syntactic nil |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1264 "Syntactic customization." |
27451 | 1265 :prefix "ebnf-" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1266 :tag "Syntactic" |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1267 :version "20" |
27451 | 1268 :group 'ebnf2ps) |
1269 | |
1270 | |
1271 (defgroup ebnf-optimization nil | |
64042
a54bca38edbf
(postscript, ebnf2ps, ebnf-special, ebnf-except, ebnf-repeat, ebnf-terminal,
Juanma Barranquero <lekktu@gmail.com>
parents:
60917
diff
changeset
|
1272 "Optimization customization." |
27451 | 1273 :prefix "ebnf-" |
1274 :tag "Optimization" | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1275 :version "20" |
27451 | 1276 :group 'ebnf2ps) |
1277 | |
1278 | |
1279 (defcustom ebnf-horizontal-orientation nil | |
1280 "*Non-nil means productions are drawn horizontally." | |
1281 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1282 :version "20" |
27451 | 1283 :group 'ebnf-displacement) |
1284 | |
1285 | |
1286 (defcustom ebnf-horizontal-max-height nil | |
1287 "*Non-nil means to use maximum production height in horizontal orientation. | |
1288 | |
1289 It is only used when `ebnf-horizontal-orientation' is non-nil." | |
1290 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1291 :version "20" |
27451 | 1292 :group 'ebnf-displacement) |
1293 | |
1294 | |
1295 (defcustom ebnf-production-horizontal-space 0.0 ; use ebnf2ps default value | |
1296 "*Specify horizontal space in points between productions. | |
1297 | |
1298 Value less or equal to zero forces ebnf2ps to set a proper default value." | |
1299 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1300 :version "20" |
27451 | 1301 :group 'ebnf-displacement) |
1302 | |
1303 | |
1304 (defcustom ebnf-production-vertical-space 0.0 ; use ebnf2ps default value | |
1305 "*Specify vertical space in points between productions. | |
1306 | |
1307 Value less or equal to zero forces ebnf2ps to set a proper default value." | |
1308 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1309 :version "20" |
27451 | 1310 :group 'ebnf-displacement) |
1311 | |
1312 | |
1313 (defcustom ebnf-justify-sequence 'center | |
1314 "*Specify justification of terms in a sequence inside alternatives. | |
1315 | |
1316 Valid values are: | |
1317 | |
1318 `left' left justification | |
1319 `right' right justification | |
1320 any other value centralize" | |
1321 :type '(radio :tag "Sequence Justification" | |
1322 (const left) (const right) (other :tag "center" center)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1323 :version "20" |
27451 | 1324 :group 'ebnf-displacement) |
1325 | |
1326 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1327 (defcustom ebnf-special-show-delimiter t |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1328 "*Non-nil means special delimiter (character `?') is shown." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1329 :type 'boolean |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1330 :version "20" |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1331 :group 'ebnf-special) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1332 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1333 |
27451 | 1334 (defcustom ebnf-special-font '(7 Courier "Black" "Gray95" bold italic) |
1335 "*Specify special font. | |
1336 | |
1337 See documentation for `ebnf-production-font'." | |
1338 :type '(list :tag "Special Font" | |
1339 (number :tag "Font Size") | |
1340 (symbol :tag "Font Name") | |
1341 (choice :tag "Foreground Color" | |
1342 (string :tag "Name") | |
1343 (other :tag "Default" nil)) | |
1344 (choice :tag "Background Color" | |
1345 (string :tag "Name") | |
1346 (other :tag "Default" nil)) | |
1347 (repeat :tag "Font Attributes" :inline t | |
1348 (choice (const bold) (const italic) | |
1349 (const underline) (const strikeout) | |
1350 (const overline) (const shadow) | |
1351 (const box) (const outline)))) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1352 :version "20" |
27451 | 1353 :group 'ebnf-special) |
1354 | |
1355 | |
1356 (defcustom ebnf-special-shape 'bevel | |
1357 "*Specify special box shape. | |
1358 | |
1359 See documentation for `ebnf-non-terminal-shape'." | |
1360 :type '(radio :tag "Special Shape" | |
1361 (const miter) (const round) (const bevel)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1362 :version "20" |
27451 | 1363 :group 'ebnf-special) |
1364 | |
1365 | |
1366 (defcustom ebnf-special-shadow nil | |
1367 "*Non-nil means special box will have a shadow." | |
1368 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1369 :version "20" |
27451 | 1370 :group 'ebnf-special) |
1371 | |
1372 | |
1373 (defcustom ebnf-special-border-width 0.5 | |
1374 "*Specify border width for special box." | |
1375 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1376 :version "20" |
27451 | 1377 :group 'ebnf-special) |
1378 | |
1379 | |
1380 (defcustom ebnf-special-border-color "Black" | |
1381 "*Specify border color for special box." | |
1382 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1383 :version "20" |
27451 | 1384 :group 'ebnf-special) |
1385 | |
1386 | |
1387 (defcustom ebnf-except-font '(7 Courier "Black" "Gray90" bold italic) | |
1388 "*Specify except font. | |
1389 | |
1390 See documentation for `ebnf-production-font'." | |
1391 :type '(list :tag "Except Font" | |
1392 (number :tag "Font Size") | |
1393 (symbol :tag "Font Name") | |
1394 (choice :tag "Foreground Color" | |
1395 (string :tag "Name") | |
1396 (other :tag "Default" nil)) | |
1397 (choice :tag "Background Color" | |
1398 (string :tag "Name") | |
1399 (other :tag "Default" nil)) | |
1400 (repeat :tag "Font Attributes" :inline t | |
1401 (choice (const bold) (const italic) | |
1402 (const underline) (const strikeout) | |
1403 (const overline) (const shadow) | |
1404 (const box) (const outline)))) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1405 :version "20" |
27451 | 1406 :group 'ebnf-except) |
1407 | |
1408 | |
1409 (defcustom ebnf-except-shape 'bevel | |
1410 "*Specify except box shape. | |
1411 | |
1412 See documentation for `ebnf-non-terminal-shape'." | |
1413 :type '(radio :tag "Except Shape" | |
1414 (const miter) (const round) (const bevel)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1415 :version "20" |
27451 | 1416 :group 'ebnf-except) |
1417 | |
1418 | |
1419 (defcustom ebnf-except-shadow nil | |
1420 "*Non-nil means except box will have a shadow." | |
1421 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1422 :version "20" |
27451 | 1423 :group 'ebnf-except) |
1424 | |
1425 | |
1426 (defcustom ebnf-except-border-width 0.25 | |
1427 "*Specify border width for except box." | |
1428 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1429 :version "20" |
27451 | 1430 :group 'ebnf-except) |
1431 | |
1432 | |
1433 (defcustom ebnf-except-border-color "Black" | |
1434 "*Specify border color for except box." | |
1435 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1436 :version "20" |
27451 | 1437 :group 'ebnf-except) |
1438 | |
1439 | |
1440 (defcustom ebnf-repeat-font '(7 Courier "Black" "Gray85" bold italic) | |
1441 "*Specify repeat font. | |
1442 | |
1443 See documentation for `ebnf-production-font'." | |
1444 :type '(list :tag "Repeat Font" | |
1445 (number :tag "Font Size") | |
1446 (symbol :tag "Font Name") | |
1447 (choice :tag "Foreground Color" | |
1448 (string :tag "Name") | |
1449 (other :tag "Default" nil)) | |
1450 (choice :tag "Background Color" | |
1451 (string :tag "Name") | |
1452 (other :tag "Default" nil)) | |
1453 (repeat :tag "Font Attributes" :inline t | |
1454 (choice (const bold) (const italic) | |
1455 (const underline) (const strikeout) | |
1456 (const overline) (const shadow) | |
1457 (const box) (const outline)))) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1458 :version "20" |
27451 | 1459 :group 'ebnf-repeat) |
1460 | |
1461 | |
1462 (defcustom ebnf-repeat-shape 'bevel | |
1463 "*Specify repeat box shape. | |
1464 | |
1465 See documentation for `ebnf-non-terminal-shape'." | |
1466 :type '(radio :tag "Repeat Shape" | |
1467 (const miter) (const round) (const bevel)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1468 :version "20" |
27451 | 1469 :group 'ebnf-repeat) |
1470 | |
1471 | |
1472 (defcustom ebnf-repeat-shadow nil | |
1473 "*Non-nil means repeat box will have a shadow." | |
1474 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1475 :version "20" |
27451 | 1476 :group 'ebnf-repeat) |
1477 | |
1478 | |
1479 (defcustom ebnf-repeat-border-width 0.0 | |
1480 "*Specify border width for repeat box." | |
1481 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1482 :version "20" |
27451 | 1483 :group 'ebnf-repeat) |
1484 | |
1485 | |
1486 (defcustom ebnf-repeat-border-color "Black" | |
1487 "*Specify border color for repeat box." | |
1488 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1489 :version "20" |
27451 | 1490 :group 'ebnf-repeat) |
1491 | |
1492 | |
1493 (defcustom ebnf-terminal-font '(7 Courier "Black" "White") | |
1494 "*Specify terminal font. | |
1495 | |
1496 See documentation for `ebnf-production-font'." | |
1497 :type '(list :tag "Terminal Font" | |
1498 (number :tag "Font Size") | |
1499 (symbol :tag "Font Name") | |
1500 (choice :tag "Foreground Color" | |
1501 (string :tag "Name") | |
1502 (other :tag "Default" nil)) | |
1503 (choice :tag "Background Color" | |
1504 (string :tag "Name") | |
1505 (other :tag "Default" nil)) | |
1506 (repeat :tag "Font Attributes" :inline t | |
1507 (choice (const bold) (const italic) | |
1508 (const underline) (const strikeout) | |
1509 (const overline) (const shadow) | |
1510 (const box) (const outline)))) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1511 :version "20" |
27451 | 1512 :group 'ebnf-terminal) |
1513 | |
1514 | |
1515 (defcustom ebnf-terminal-shape 'miter | |
1516 "*Specify terminal box shape. | |
1517 | |
1518 See documentation for `ebnf-non-terminal-shape'." | |
1519 :type '(radio :tag "Terminal Shape" | |
1520 (const miter) (const round) (const bevel)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1521 :version "20" |
27451 | 1522 :group 'ebnf-terminal) |
1523 | |
1524 | |
1525 (defcustom ebnf-terminal-shadow nil | |
1526 "*Non-nil means terminal box will have a shadow." | |
1527 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1528 :version "20" |
27451 | 1529 :group 'ebnf-terminal) |
1530 | |
1531 | |
1532 (defcustom ebnf-terminal-border-width 1.0 | |
1533 "*Specify border width for terminal box." | |
1534 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1535 :version "20" |
27451 | 1536 :group 'ebnf-terminal) |
1537 | |
1538 | |
1539 (defcustom ebnf-terminal-border-color "Black" | |
1540 "*Specify border color for terminal box." | |
1541 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1542 :version "20" |
27451 | 1543 :group 'ebnf-terminal) |
1544 | |
1545 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1546 (defcustom ebnf-production-name-p t |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1547 "*Non-nil means production name will be printed." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1548 :type 'boolean |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1549 :version "20" |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1550 :group 'ebnf-production) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1551 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1552 |
27451 | 1553 (defcustom ebnf-sort-production nil |
1554 "*Specify how productions are sorted. | |
1555 | |
1556 Valid values are: | |
1557 | |
1558 nil don't sort productions. | |
1559 `ascending' ascending sort. | |
1560 any other value descending sort." | |
1561 :type '(radio :tag "Production Sort" | |
1562 (const :tag "Ascending" ascending) | |
1563 (const :tag "Descending" descending) | |
1564 (other :tag "No Sort" nil)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1565 :version "20" |
27451 | 1566 :group 'ebnf-production) |
1567 | |
1568 | |
1569 (defcustom ebnf-production-font '(10 Helvetica "Black" "White" bold) | |
1570 "*Specify production header font. | |
1571 | |
1572 It is a list with the following form: | |
1573 | |
1574 (SIZE NAME FOREGROUND BACKGROUND ATTRIBUTE...) | |
1575 | |
1576 Where: | |
1577 SIZE is the font size. | |
1578 NAME is the font name symbol. | |
1579 ATTRIBUTE is one of the following symbols: | |
1580 bold - use bold font. | |
1581 italic - use italic font. | |
1582 underline - put a line under text. | |
1583 strikeout - like underline, but the line is in middle of text. | |
1584 overline - like underline, but the line is over the text. | |
1585 shadow - text will have a shadow. | |
1586 box - text will be surrounded by a box. | |
1587 outline - print characters as hollow outlines. | |
1588 FOREGROUND is a foreground string color name; if it's nil, the default color is | |
1589 \"Black\". | |
1590 BACKGROUND is a background string color name; if it's nil, the default color is | |
1591 \"White\". | |
1592 | |
1593 See `ps-font-info-database' for valid font name." | |
1594 :type '(list :tag "Production Font" | |
1595 (number :tag "Font Size") | |
1596 (symbol :tag "Font Name") | |
1597 (choice :tag "Foreground Color" | |
1598 (string :tag "Name") | |
1599 (other :tag "Default" nil)) | |
1600 (choice :tag "Background Color" | |
1601 (string :tag "Name") | |
1602 (other :tag "Default" nil)) | |
1603 (repeat :tag "Font Attributes" :inline t | |
1604 (choice (const bold) (const italic) | |
1605 (const underline) (const strikeout) | |
1606 (const overline) (const shadow) | |
1607 (const box) (const outline)))) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1608 :version "20" |
27451 | 1609 :group 'ebnf-production) |
1610 | |
1611 | |
1612 (defcustom ebnf-non-terminal-font '(7 Helvetica "Black" "White") | |
1613 "*Specify non-terminal font. | |
1614 | |
1615 See documentation for `ebnf-production-font'." | |
1616 :type '(list :tag "Non-Terminal Font" | |
1617 (number :tag "Font Size") | |
1618 (symbol :tag "Font Name") | |
1619 (choice :tag "Foreground Color" | |
1620 (string :tag "Name") | |
1621 (other :tag "Default" nil)) | |
1622 (choice :tag "Background Color" | |
1623 (string :tag "Name") | |
1624 (other :tag "Default" nil)) | |
1625 (repeat :tag "Font Attributes" :inline t | |
1626 (choice (const bold) (const italic) | |
1627 (const underline) (const strikeout) | |
1628 (const overline) (const shadow) | |
1629 (const box) (const outline)))) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1630 :version "20" |
27451 | 1631 :group 'ebnf-non-terminal) |
1632 | |
1633 | |
1634 (defcustom ebnf-non-terminal-shape 'round | |
1635 "*Specify non-terminal box shape. | |
1636 | |
1637 Valid values are: | |
1638 | |
1639 `miter' +-------+ | |
1640 | | | |
1641 +-------+ | |
1642 | |
1643 `round' ------- | |
1644 ( ) | |
1645 ------- | |
1646 | |
1647 `bevel' /-------\\ | |
1648 | | | |
1649 \\-------/ | |
1650 | |
1651 Any other value is treated as `miter'." | |
1652 :type '(radio :tag "Non-Terminal Shape" | |
1653 (const miter) (const round) (const bevel)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1654 :version "20" |
27451 | 1655 :group 'ebnf-non-terminal) |
1656 | |
1657 | |
1658 (defcustom ebnf-non-terminal-shadow nil | |
1659 "*Non-nil means non-terminal box will have a shadow." | |
1660 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1661 :version "20" |
27451 | 1662 :group 'ebnf-non-terminal) |
1663 | |
1664 | |
1665 (defcustom ebnf-non-terminal-border-width 1.0 | |
1666 "*Specify border width for non-terminal box." | |
1667 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1668 :version "20" |
27451 | 1669 :group 'ebnf-non-terminal) |
1670 | |
1671 | |
1672 (defcustom ebnf-non-terminal-border-color "Black" | |
1673 "*Specify border color for non-terminal box." | |
1674 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1675 :version "20" |
27451 | 1676 :group 'ebnf-non-terminal) |
1677 | |
1678 | |
1679 (defcustom ebnf-arrow-shape 'hollow | |
1680 "*Specify the arrow shape. | |
1681 | |
1682 Valid values are: | |
1683 | |
1684 `none' ====== | |
1685 | |
1686 `semi-up' * `transparent' * | |
1687 * |* | |
1688 =====* | * | |
1689 ==+==* | |
1690 | * | |
1691 |* | |
1692 * | |
1693 | |
1694 `semi-down' =====* `hollow' * | |
1695 * |* | |
1696 * | * | |
1697 ==+ * | |
1698 | * | |
1699 |* | |
1700 * | |
1701 | |
1702 `simple' * `full' * | |
1703 * |* | |
1704 =====* |X* | |
1705 * ==+XX* | |
1706 * |X* | |
1707 |* | |
1708 * | |
1709 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1710 `semi-up-hollow' `semi-up-full' |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1711 * * |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1712 |* |* |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1713 | * |X* |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1714 ==+==* ==+==* |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1715 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1716 `semi-down-hollow' `semi-down-full' |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1717 ==+==* ==+==* |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1718 | * |X* |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1719 |* |* |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1720 * * |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1721 |
27451 | 1722 `user' See also documentation for variable `ebnf-user-arrow'. |
1723 | |
1724 Any other value is treated as `none'." | |
1725 :type '(radio :tag "Arrow Shape" | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1726 (const none) (const semi-up) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1727 (const semi-down) (const simple) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1728 (const transparent) (const hollow) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1729 (const full) (const semi-up-hollow) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1730 (const semi-down-hollow) (const semi-up-full) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1731 (const semi-down-full) (const user)) |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1732 :version "20" |
27451 | 1733 :group 'ebnf-shape) |
1734 | |
1735 | |
1736 (defcustom ebnf-chart-shape 'round | |
1737 "*Specify chart flow shape. | |
1738 | |
1739 See documentation for `ebnf-non-terminal-shape'." | |
1740 :type '(radio :tag "Chart Flow Shape" | |
1741 (const miter) (const round) (const bevel)) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1742 :version "20" |
27451 | 1743 :group 'ebnf-shape) |
1744 | |
1745 | |
1746 (defcustom ebnf-user-arrow nil | |
31255 | 1747 "*Specify a sexp for user arrow shape (a PostScript code). |
1748 | |
1749 When evaluated, the sexp should return nil or a string containing PostScript | |
1750 code. PostScript code should draw a right arrow. | |
27451 | 1751 |
1752 The anatomy of a right arrow is: | |
1753 | |
1754 ...... Initial position | |
1755 : | |
1756 : *................. | |
1757 : | * } } | |
1758 : | * } hT4 } | |
1759 v | * } } | |
1760 ======+======*... } hT2 | |
1761 : | *: } } | |
1762 : | * : } hT4 } | |
1763 : | * : } } | |
1764 : *................. | |
1765 : : : | |
1766 : : :.......... | |
1767 : : } hT2 } | |
1768 : :.......... } hT | |
1769 : } hT2 } | |
1770 :....................... | |
1771 | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1772 Where `hT', `hT2' and `hT4' are predefined PostScript variable names that can |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1773 be used to generate your own arrow. As these variables are used along |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1774 PostScript execution, *DON'T* modify the values of them. Instead, copy the |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
1775 values, if you need to modify them. |
27451 | 1776 |
1777 The relation between these variables is: hT = 2 * hT2 = 4 * hT4. | |
1778 | |
1779 The variable `ebnf-user-arrow' is only used when `ebnf-arrow-shape' is set to | |
31255 | 1780 symbol `user'." |
1781 :type '(sexp :tag "User Arrow Shape") | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1782 :version "20" |
27451 | 1783 :group 'ebnf-shape) |
1784 | |
1785 | |
1786 (defcustom ebnf-syntax 'ebnf | |
1787 "*Specify syntax to be recognized. | |
1788 | |
1789 Valid values are: | |
1790 | |
27495 | 1791 `ebnf' ebnf2ps recognizes the syntax described in ebnf2ps |
1792 documentation. | |
27451 | 1793 The following variables *ONLY* have effect with this |
1794 setting: | |
1795 `ebnf-terminal-regexp', `ebnf-case-fold-search', | |
1796 `ebnf-lex-comment-char' and `ebnf-lex-eop-char'. | |
1797 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1798 `abnf' ebnf2ps recognizes the syntax described in the URL: |
54189 | 1799 `http://www.ietf.org/rfc/rfc2234.txt' |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1800 (\"Augmented BNF for Syntax Specifications: ABNF\"). |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1801 |
27451 | 1802 `iso-ebnf' ebnf2ps recognizes the syntax described in the URL: |
1803 `http://www.cl.cam.ac.uk/~mgk25/iso-ebnf.html' | |
1804 (\"International Standard of the ISO EBNF Notation\"). | |
1805 The following variables *ONLY* have effect with this | |
1806 setting: | |
1807 `ebnf-iso-alternative-p' and `ebnf-iso-normalize-p'. | |
1808 | |
1809 `yacc' ebnf2ps recognizes the Yacc/Bison syntax. | |
1810 The following variable *ONLY* has effect with this | |
1811 setting: | |
1812 `ebnf-yac-ignore-error-recovery'. | |
1813 | |
54625 | 1814 `ebnfx' ebnf2ps recognizes the syntax described in the URL: |
1815 `http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation' | |
1816 (\"Extensible Markup Language (XML) 1.0 (Third Edition)\") | |
1817 | |
54714 | 1818 `dtd' ebnf2ps recognizes the syntax described in the URL: |
1819 `http://www.w3.org/TR/2004/REC-xml-20040204/' | |
1820 (\"Extensible Markup Language (XML) 1.0 (Third Edition)\") | |
1821 | |
27451 | 1822 Any other value is treated as `ebnf'." |
1823 :type '(radio :tag "Syntax" | |
54625 | 1824 (const ebnf) (const abnf) (const iso-ebnf) |
54714 | 1825 (const yacc) (const ebnfx) (const dtd)) |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1826 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1827 :group 'ebnf-syntactic) |
27451 | 1828 |
1829 | |
1830 (defcustom ebnf-lex-comment-char ?\; | |
1831 "*Specify the line comment character. | |
1832 | |
1833 It's used only when `ebnf-syntax' is `ebnf'." | |
1834 :type 'character | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1835 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1836 :group 'ebnf-syntactic) |
27451 | 1837 |
1838 | |
1839 (defcustom ebnf-lex-eop-char ?. | |
1840 "*Specify the end of production character. | |
1841 | |
1842 It's used only when `ebnf-syntax' is `ebnf'." | |
1843 :type 'character | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1844 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1845 :group 'ebnf-syntactic) |
27451 | 1846 |
1847 | |
1848 (defcustom ebnf-terminal-regexp nil | |
1849 "*Specify how it's a terminal name. | |
1850 | |
1851 If it's nil, the terminal name must be enclosed by `\"'. | |
1852 If it's a string, it should be a regexp that it'll be used to determine a | |
1853 terminal name; terminal name may also be enclosed by `\"'. | |
1854 | |
1855 It's used only when `ebnf-syntax' is `ebnf'." | |
1856 :type '(radio :tag "Terminal Name" | |
1857 (const nil) regexp) | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1858 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1859 :group 'ebnf-syntactic) |
27451 | 1860 |
1861 | |
1862 (defcustom ebnf-case-fold-search nil | |
1863 "*Non-nil means ignore case on matching. | |
1864 | |
1865 It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is | |
1866 `ebnf'." | |
1867 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1868 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1869 :group 'ebnf-syntactic) |
27451 | 1870 |
1871 | |
1872 (defcustom ebnf-iso-alternative-p nil | |
1873 "*Non-nil means use alternative ISO EBNF. | |
1874 | |
1875 It's only used when `ebnf-syntax' is `iso-ebnf'. | |
1876 | |
1877 This variable affects the following symbol set: | |
1878 | |
1879 STANDARD ALTERNATIVE | |
1880 | ==> / or ! | |
1881 [ ==> (/ | |
1882 ] ==> /) | |
1883 { ==> (: | |
1884 } ==> :) | |
1885 ; ==> ." | |
1886 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1887 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1888 :group 'ebnf-syntactic) |
27451 | 1889 |
1890 | |
1891 (defcustom ebnf-iso-normalize-p nil | |
1892 "*Non-nil means normalize ISO EBNF syntax names. | |
1893 | |
1894 Normalize a name means that several contiguous spaces inside name become a | |
1895 single space, so \"A B C\" is normalized to \"A B C\". | |
1896 | |
1897 It's only used when `ebnf-syntax' is `iso-ebnf'." | |
1898 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1899 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
1900 :group 'ebnf-syntactic) |
27451 | 1901 |
1902 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1903 (defcustom ebnf-file-suffix-regexp "\.[Bb][Nn][Ff]$" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1904 "*Specify file name suffix that contains EBNF. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1905 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1906 See `ebnf-eps-directory' command." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1907 :type 'regexp |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1908 :version "20" |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1909 :group 'ebnf2ps) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1910 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
1911 |
27451 | 1912 (defcustom ebnf-eps-prefix "ebnf--" |
1913 "*Specify EPS prefix file name. | |
1914 | |
1915 See `ebnf-eps-buffer' and `ebnf-eps-region' commands." | |
1916 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
1917 :version "20" |
27451 | 1918 :group 'ebnf2ps) |
1919 | |
1920 | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1921 (defcustom ebnf-eps-header-font '(11 Helvetica "Black" "White" bold) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1922 "*Specify EPS header font. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1923 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1924 See documentation for `ebnf-production-font'. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1925 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1926 See `ebnf-eps-buffer' and `ebnf-eps-region' commands." |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1927 :type '(list :tag "EPS Header Font" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1928 (number :tag "Font Size") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1929 (symbol :tag "Font Name") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1930 (choice :tag "Foreground Color" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1931 (string :tag "Name") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1932 (other :tag "Default" nil)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1933 (choice :tag "Background Color" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1934 (string :tag "Name") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1935 (other :tag "Default" nil)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1936 (repeat :tag "Font Attributes" :inline t |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1937 (choice (const bold) (const italic) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1938 (const underline) (const strikeout) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1939 (const overline) (const shadow) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1940 (const box) (const outline)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1941 :version "22" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1942 :group 'ebnf2ps) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1943 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1944 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1945 (defcustom ebnf-eps-header nil |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1946 "*Specify EPS header. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1947 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1948 The value should be a string, a symbol or nil. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1949 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1950 String is inserted unchanged. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1951 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1952 For symbol bounded to a function, the function is called and should return a |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1953 string. For symbol bounded to a value, the value should be a string. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1954 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1955 If symbol is unbounded, it is silently ignored. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1956 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1957 Empty string or nil mean that no header will be generated. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1958 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1959 Note that when the header action comment (;H in EBNF syntax) is specified, the |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1960 string in the header action comment is processed and, if it returns a non-empty |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1961 string, it's used to generate the header. The header action comment accepts |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1962 the following formats: |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1963 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1964 %% prints a % character. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1965 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1966 %H prints the `ebnf-eps-header' value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1967 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1968 %F prints the `ebnf-eps-footer' (which see) value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1969 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1970 Any other format is ignored, that is, if, for example, it's used %s then %s |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1971 characters are stripped out from the header. If header action comment is an |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1972 empty string, no header is generated until a non-empty header is specified or |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1973 `ebnf-eps-header' has a non-empty string value." |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1974 :type '(repeat (choice :menu-tag "EPS Header" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1975 :tag "EPS Header" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1976 string symbol (const :tag "No Header" nil ))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1977 :version "22" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1978 :group 'ebnf2ps) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1979 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1980 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1981 (defcustom ebnf-eps-footer-font '(7 Helvetica "Black" "White" bold) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1982 "*Specify EPS footer font. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1983 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1984 See documentation for `ebnf-production-font'. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1985 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1986 See `ebnf-eps-buffer' and `ebnf-eps-region' commands." |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1987 :type '(list :tag "EPS Footer Font" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1988 (number :tag "Font Size") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1989 (symbol :tag "Font Name") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1990 (choice :tag "Foreground Color" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1991 (string :tag "Name") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1992 (other :tag "Default" nil)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1993 (choice :tag "Background Color" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1994 (string :tag "Name") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1995 (other :tag "Default" nil)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1996 (repeat :tag "Font Attributes" :inline t |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1997 (choice (const bold) (const italic) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1998 (const underline) (const strikeout) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
1999 (const overline) (const shadow) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2000 (const box) (const outline)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2001 :version "22" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2002 :group 'ebnf2ps) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2003 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2004 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2005 (defcustom ebnf-eps-footer nil |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2006 "*Specify EPS footer. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2007 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2008 The value should be a string, a symbol or nil. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2009 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2010 String is inserted unchanged. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2011 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2012 For symbol bounded to a function, the function is called and should return a |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2013 string. For symbol bounded to a value, the value should be a string. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2014 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2015 If symbol is unbounded, it is silently ignored. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2016 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2017 Empty string or nil mean that no footer will be generated. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2018 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2019 Note that when the footer action comment (;F in EBNF syntax) is specified, the |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2020 string in the footer action comment is processed and, if it returns a non-empty |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2021 string, it's used to generate the footer. The footer action comment accepts |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2022 the following formats: |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2023 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2024 %% prints a % character. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2025 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2026 %H prints the `ebnf-eps-header' (which see) value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2027 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2028 %F prints the `ebnf-eps-footer' value. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2029 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2030 Any other format is ignored, that is, if, for example, it's used %s then %s |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2031 characters are stripped out from the footer. If footer action comment is an |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2032 empty string, no footer is generated until a non-empty footer is specified or |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2033 `ebnf-eps-footer' has a non-empty string value." |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2034 :type '(repeat (choice :menu-tag "EPS Footer" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2035 :tag "EPS Footer" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2036 string symbol (const :tag "No Footer" nil ))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2037 :version "22" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2038 :group 'ebnf2ps) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2039 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2040 |
27451 | 2041 (defcustom ebnf-entry-percentage 0.5 ; middle |
2042 "*Specify entry height on alternatives. | |
2043 | |
2044 It must be a float between 0.0 (top) and 1.0 (bottom)." | |
2045 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2046 :version "20" |
27451 | 2047 :group 'ebnf2ps) |
2048 | |
2049 | |
2050 (defcustom ebnf-default-width 0.6 | |
2051 "*Specify additional border width over default terminal, non-terminal or | |
2052 special." | |
2053 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2054 :version "20" |
27451 | 2055 :group 'ebnf2ps) |
2056 | |
2057 | |
2058 ;; Printing color requires x-color-values. | |
2059 (defcustom ebnf-color-p (or (fboundp 'x-color-values) ; Emacs | |
2060 (fboundp 'color-instance-rgb-components)) ; XEmacs | |
2061 "*Non-nil means use color." | |
2062 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2063 :version "20" |
27451 | 2064 :group 'ebnf2ps) |
2065 | |
2066 | |
2067 (defcustom ebnf-line-width 1.0 | |
2068 "*Specify flow line width." | |
2069 :type 'number | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2070 :version "20" |
27451 | 2071 :group 'ebnf2ps) |
2072 | |
2073 | |
2074 (defcustom ebnf-line-color "Black" | |
2075 "*Specify flow line color." | |
2076 :type 'string | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2077 :version "20" |
27451 | 2078 :group 'ebnf2ps) |
2079 | |
2080 | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2081 (defcustom ebnf-arrow-extra-width |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2082 (if (eq ebnf-arrow-shape 'none) |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2083 0.0 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2084 (* (sqrt 5.0) 0.65 ebnf-line-width)) |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2085 "*Specify extra width for arrow shape drawing. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2086 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2087 The extra width is used to avoid that the arrowhead and the terminal border |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2088 overlap. It depens on `ebnf-arrow-shape' and `ebnf-line-width'." |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2089 :type 'number |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2090 :version "22" |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2091 :group 'ebnf-shape) |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2092 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2093 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2094 (defcustom ebnf-arrow-scale 1.0 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2095 "*Specify the arrow scale. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2096 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2097 Values lower than 1.0, shrink the arrow. |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2098 Values greater than 1.0, expand the arrow." |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2099 :type 'number |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2100 :version "22" |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2101 :group 'ebnf-shape) |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2102 |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
2103 |
27451 | 2104 (defcustom ebnf-debug-ps nil |
2105 "*Non-nil means to generate PostScript debug procedures. | |
2106 | |
2107 It is intended to help PostScript programmers in debugging." | |
2108 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2109 :version "20" |
27451 | 2110 :group 'ebnf2ps) |
2111 | |
2112 | |
2113 (defcustom ebnf-use-float-format t | |
2114 "*Non-nil means use `%f' float format. | |
2115 | |
2116 The advantage of using float format is that ebnf2ps generates a little short | |
2117 PostScript file. | |
2118 | |
2119 If it occurs the error message: | |
2120 | |
2121 Invalid format operation %f | |
2122 | |
2123 when executing ebnf2ps, set `ebnf-use-float-format' to nil." | |
2124 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2125 :version "20" |
27451 | 2126 :group 'ebnf2ps) |
2127 | |
2128 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2129 (defcustom ebnf-stop-on-error nil |
74086
5bc3fbbf9e9b
(ebnf-stop-on-error): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
73914
diff
changeset
|
2130 "*Non-nil means signal error and stop. Otherwise, signal error and continue." |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2131 :type 'boolean |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2132 :version "20" |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2133 :group 'ebnf2ps) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2134 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2135 |
27451 | 2136 (defcustom ebnf-yac-ignore-error-recovery nil |
2137 "*Non-nil means ignore error recovery. | |
2138 | |
2139 It's only used when `ebnf-syntax' is `yacc'." | |
2140 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2141 :version "20" |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
2142 :group 'ebnf-syntactic) |
27451 | 2143 |
2144 | |
2145 (defcustom ebnf-ignore-empty-rule nil | |
2146 "*Non-nil means ignore empty rules. | |
2147 | |
2148 It's interesting to set this variable if your Yacc/Bison grammar has a lot of | |
2149 middle action rule." | |
2150 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2151 :version "20" |
27451 | 2152 :group 'ebnf-optimization) |
2153 | |
2154 | |
2155 (defcustom ebnf-optimize nil | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
2156 "*Non-nil means optimize syntactic chart of rules. |
27451 | 2157 |
2158 The following optimizations are done: | |
2159 | |
2160 left recursion: | |
2161 1. A = B | A C. ==> A = B {C}*. | |
2162 2. A = B | A B. ==> A = {B}+. | |
2163 3. A = | A B. ==> A = {B}*. | |
2164 4. A = B | A C B. ==> A = {B || C}+. | |
2165 5. A = B | D | A C | A E. ==> A = ( B | D ) { C | E }*. | |
2166 | |
2167 optional: | |
2168 6. A = B | . ==> A = [B]. | |
2169 7. A = | B . ==> A = [B]. | |
2170 | |
58339 | 2171 factorization: |
27451 | 2172 8. A = B C | B D. ==> A = B (C | D). |
2173 9. A = C B | D B. ==> A = (C | D) B. | |
2174 10. A = B C E | B D E. ==> A = B (C | D) E. | |
2175 | |
2176 The above optimizations are specially useful when `ebnf-syntax' is `yacc'." | |
2177 :type 'boolean | |
58338
16486fc50b5e
:version tag
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54714
diff
changeset
|
2178 :version "20" |
27451 | 2179 :group 'ebnf-optimization) |
2180 | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2181 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2182 (defcustom ebnf-log nil |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2183 "*Non-nil means generate log messages. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2184 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2185 The log messages are generated into the buffer *Ebnf2ps Log*. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2186 These messages are intended to help debugging ebnf2ps." |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2187 :type 'boolean |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2188 :version "22" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2189 :group 'ebnf2ps) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2190 |
27451 | 2191 |
2192 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
54714 | 2193 ;; To make this file smaller, some commands go in a separate file. |
2194 ;; But autoload them here to make the separation invisible. | |
2195 ;; Autoload is here to avoid compilation gripes. | |
2196 | |
2197 (autoload 'ebnf-eliminate-empty-rules "ebnf-otz" | |
2198 "Eliminate empty rules.") | |
2199 | |
2200 (autoload 'ebnf-optimize "ebnf-otz" | |
2201 "Syntactic chart optimizer.") | |
2202 | |
2203 (autoload 'ebnf-otz-initialize "ebnf-otz" | |
2204 "Initialize optimizer.") | |
2205 | |
2206 | |
2207 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
27451 | 2208 ;; Customization |
2209 | |
2210 | |
2211 ;;;###autoload | |
2212 (defun ebnf-customize () | |
2213 "Customization for ebnf group." | |
2214 (interactive) | |
2215 (customize-group 'ebnf2ps)) | |
2216 | |
2217 | |
2218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2219 ;; User commands | |
2220 | |
2221 | |
2222 ;;;###autoload | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2223 (defun ebnf-print-directory (&optional directory) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2224 "Generate and print a PostScript syntactic chart image of DIRECTORY. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2225 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2226 If DIRECTORY is nil, it's used `default-directory'. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2227 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2228 The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2229 processed. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2230 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2231 See also `ebnf-print-buffer'." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2232 (interactive |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2233 (list (read-file-name "Directory containing EBNF files (print): " |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2234 nil default-directory))) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2235 (ebnf-log-header "(ebnf-print-directory %S)" directory) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2236 (ebnf-directory 'ebnf-print-buffer directory)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2237 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2238 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2239 ;;;###autoload |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2240 (defun ebnf-print-file (file &optional do-not-kill-buffer-when-done) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2241 "Generate and print a PostScript syntactic chart image of the file FILE. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2242 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2243 If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2244 killed after process termination. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2245 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2246 See also `ebnf-print-buffer'." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2247 (interactive "fEBNF file to generate PostScript and print from: ") |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2248 (ebnf-log-header "(ebnf-print-file %S %S)" file do-not-kill-buffer-when-done) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2249 (ebnf-file 'ebnf-print-buffer file do-not-kill-buffer-when-done)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2250 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2251 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2252 ;;;###autoload |
27451 | 2253 (defun ebnf-print-buffer (&optional filename) |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
2254 "Generate and print a PostScript syntactic chart image of the buffer. |
27451 | 2255 |
2256 When called with a numeric prefix argument (C-u), prompts the user for | |
2257 the name of a file to save the PostScript image in, instead of sending | |
2258 it to the printer. | |
2259 | |
2260 More specifically, the FILENAME argument is treated as follows: if it | |
2261 is nil, send the image to the printer. If FILENAME is a string, save | |
2262 the PostScript image in a file with that name. If FILENAME is a | |
2263 number, prompt the user for the name of the file to save in." | |
2264 (interactive (list (ps-print-preprint current-prefix-arg))) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2265 (ebnf-log-header "(ebnf-print-buffer %S)" filename) |
27451 | 2266 (ebnf-print-region (point-min) (point-max) filename)) |
2267 | |
2268 | |
2269 ;;;###autoload | |
2270 (defun ebnf-print-region (from to &optional filename) | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
2271 "Generate and print a PostScript syntactic chart image of the region. |
27451 | 2272 Like `ebnf-print-buffer', but prints just the current region." |
2273 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg))) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2274 (ebnf-log-header "(ebnf-print-region %S %S %S)" from to filename) |
27451 | 2275 (run-hooks 'ebnf-hook) |
2276 (or (ebnf-spool-region from to) | |
2277 (ps-do-despool filename))) | |
2278 | |
2279 | |
2280 ;;;###autoload | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2281 (defun ebnf-spool-directory (&optional directory) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2282 "Generate and spool a PostScript syntactic chart image of DIRECTORY. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2283 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2284 If DIRECTORY is nil, it's used `default-directory'. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2285 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2286 The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2287 processed. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2288 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2289 See also `ebnf-spool-buffer'." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2290 (interactive |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2291 (list (read-file-name "Directory containing EBNF files (spool): " |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2292 nil default-directory))) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2293 (ebnf-log-header "(ebnf-spool-directory %S)" directory) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2294 (ebnf-directory 'ebnf-spool-buffer directory)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2295 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2296 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2297 ;;;###autoload |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2298 (defun ebnf-spool-file (file &optional do-not-kill-buffer-when-done) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2299 "Generate and spool a PostScript syntactic chart image of the file FILE. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2300 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2301 If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2302 killed after process termination. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2303 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2304 See also `ebnf-spool-buffer'." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2305 (interactive "fEBNF file to generate PostScript and spool from: ") |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2306 (ebnf-log-header "(ebnf-spool-file %S %S)" file do-not-kill-buffer-when-done) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2307 (ebnf-file 'ebnf-spool-buffer file do-not-kill-buffer-when-done)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2308 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2309 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2310 ;;;###autoload |
27451 | 2311 (defun ebnf-spool-buffer () |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
2312 "Generate and spool a PostScript syntactic chart image of the buffer. |
27451 | 2313 Like `ebnf-print-buffer' except that the PostScript image is saved in a |
2314 local buffer to be sent to the printer later. | |
2315 | |
2316 Use the command `ebnf-despool' to send the spooled images to the printer." | |
2317 (interactive) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2318 (ebnf-log-header "(ebnf-spool-buffer)") |
27451 | 2319 (ebnf-spool-region (point-min) (point-max))) |
2320 | |
2321 | |
2322 ;;;###autoload | |
2323 (defun ebnf-spool-region (from to) | |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
2324 "Generate a PostScript syntactic chart image of the region and spool locally. |
27451 | 2325 Like `ebnf-spool-buffer', but spools just the current region. |
2326 | |
2327 Use the command `ebnf-despool' to send the spooled images to the printer." | |
2328 (interactive "r") | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2329 (ebnf-log-header "(ebnf-spool-region %S)" from to) |
27451 | 2330 (ebnf-generate-region from to 'ebnf-generate)) |
2331 | |
2332 | |
2333 ;;;###autoload | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2334 (defun ebnf-eps-directory (&optional directory) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2335 "Generate EPS files from EBNF files in DIRECTORY. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2336 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2337 If DIRECTORY is nil, it's used `default-directory'. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2338 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2339 The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2340 processed. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2341 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2342 See also `ebnf-eps-buffer'." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2343 (interactive |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2344 (list (read-file-name "Directory containing EBNF files (EPS): " |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2345 nil default-directory))) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2346 (ebnf-log-header "(ebnf-eps-directory %S)" directory) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2347 (ebnf-directory 'ebnf-eps-buffer directory)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2348 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2349 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2350 ;;;###autoload |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2351 (defun ebnf-eps-file (file &optional do-not-kill-buffer-when-done) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2352 "Generate an EPS file from EBNF file FILE. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2353 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2354 If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2355 killed after EPS generation. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2356 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2357 See also `ebnf-eps-buffer'." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2358 (interactive "fEBNF file to generate EPS file from: ") |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2359 (ebnf-log-header "(ebnf-eps-file %S %S)" file do-not-kill-buffer-when-done) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2360 (ebnf-file 'ebnf-eps-buffer file do-not-kill-buffer-when-done)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2361 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2362 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2363 ;;;###autoload |
27451 | 2364 (defun ebnf-eps-buffer () |
75624 | 2365 "Generate a PostScript syntactic chart image of the buffer in an EPS file. |
27451 | 2366 |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2367 Generate an EPS file for each production in the buffer. |
27451 | 2368 The EPS file name has the following form: |
2369 | |
2370 <PREFIX><PRODUCTION>.eps | |
2371 | |
2372 <PREFIX> is given by variable `ebnf-eps-prefix'. | |
2373 The default value is \"ebnf--\". | |
2374 | |
2375 <PRODUCTION> is the production name. | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2376 Some characters in the production file name are replaced to |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2377 produce a valid file name. For example, the production name |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2378 \"A/B + C\" is modified to produce \"A_B_+_C\", and the EPS |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2379 file name used in this case will be \"ebnf--A_B_+_C.eps\". |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2380 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2381 WARNING: This function does *NOT* ask any confirmation to override existing |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2382 files." |
27451 | 2383 (interactive) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2384 (ebnf-log-header "(ebnf-eps-buffer)") |
27451 | 2385 (ebnf-eps-region (point-min) (point-max))) |
2386 | |
2387 | |
2388 ;;;###autoload | |
2389 (defun ebnf-eps-region (from to) | |
75624 | 2390 "Generate a PostScript syntactic chart image of the region in an EPS file. |
27451 | 2391 |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2392 Generate an EPS file for each production in the region. |
27451 | 2393 The EPS file name has the following form: |
2394 | |
2395 <PREFIX><PRODUCTION>.eps | |
2396 | |
2397 <PREFIX> is given by variable `ebnf-eps-prefix'. | |
2398 The default value is \"ebnf--\". | |
2399 | |
2400 <PRODUCTION> is the production name. | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2401 Some characters in the production file name are replaced to |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2402 produce a valid file name. For example, the production name |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2403 \"A/B + C\" is modified to produce \"A_B_+_C\", and the EPS |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2404 file name used in this case will be \"ebnf--A_B_+_C.eps\". |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2405 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2406 WARNING: This function does *NOT* ask any confirmation to override existing |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2407 files." |
27451 | 2408 (interactive "r") |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2409 (ebnf-log-header "(ebnf-eps-region %S %S)" from to) |
27451 | 2410 (let ((ebnf-eps-executing t)) |
2411 (ebnf-generate-region from to 'ebnf-generate-eps))) | |
2412 | |
2413 | |
2414 ;;;###autoload | |
2415 (defalias 'ebnf-despool 'ps-despool) | |
2416 | |
2417 | |
2418 ;;;###autoload | |
54191 | 2419 (defun ebnf-syntax-directory (&optional directory) |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2420 "Do a syntactic analysis of the files in DIRECTORY. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2421 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2422 If DIRECTORY is nil, use `default-directory'. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2423 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2424 Only the files in DIRECTORY that match `ebnf-file-suffix-regexp' (which see) |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2425 are processed. |
54191 | 2426 |
2427 See also `ebnf-syntax-buffer'." | |
2428 (interactive | |
2429 (list (read-file-name "Directory containing EBNF files (syntax): " | |
2430 nil default-directory))) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2431 (ebnf-log-header "(ebnf-syntax-directory %S)" directory) |
54191 | 2432 (ebnf-directory 'ebnf-syntax-buffer directory)) |
2433 | |
2434 | |
2435 ;;;###autoload | |
2436 (defun ebnf-syntax-file (file &optional do-not-kill-buffer-when-done) | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2437 "Do a syntactic analysis of the named FILE. |
54191 | 2438 |
2439 If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't | |
54192 | 2440 killed after syntax checking. |
54191 | 2441 |
2442 See also `ebnf-syntax-buffer'." | |
2443 (interactive "fEBNF file to check syntax: ") | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2444 (ebnf-log-header "(ebnf-syntax-file %S %S)" file do-not-kill-buffer-when-done) |
54191 | 2445 (ebnf-file 'ebnf-syntax-buffer file do-not-kill-buffer-when-done)) |
2446 | |
2447 | |
2448 ;;;###autoload | |
27451 | 2449 (defun ebnf-syntax-buffer () |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2450 "Do a syntactic analysis of the current buffer." |
27451 | 2451 (interactive) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2452 (ebnf-log-header "(ebnf-syntax-buffer)") |
27451 | 2453 (ebnf-syntax-region (point-min) (point-max))) |
2454 | |
2455 | |
2456 ;;;###autoload | |
2457 (defun ebnf-syntax-region (from to) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2458 "Do a syntactic analysis of a region." |
27451 | 2459 (interactive "r") |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2460 (ebnf-log-header "(ebnf-syntax-region %S %S)" from to) |
27451 | 2461 (ebnf-generate-region from to nil)) |
2462 | |
2463 | |
2464 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2465 ;; Utilities | |
2466 | |
2467 | |
2468 ;;;###autoload | |
2469 (defun ebnf-setup () | |
2470 "Return the current ebnf2ps setup." | |
2471 (format | |
2472 " | |
34803
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
2473 ;;; ebnf2ps.el version %s |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
2474 |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2475 ;;; Emacs version %S |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2476 |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2477 \(setq ebnf-special-show-delimiter %S |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2478 ebnf-special-font %s |
27451 | 2479 ebnf-special-shape %s |
2480 ebnf-special-shadow %S | |
2481 ebnf-special-border-width %S | |
2482 ebnf-special-border-color %S | |
2483 ebnf-except-font %s | |
2484 ebnf-except-shape %s | |
2485 ebnf-except-shadow %S | |
2486 ebnf-except-border-width %S | |
2487 ebnf-except-border-color %S | |
2488 ebnf-repeat-font %s | |
2489 ebnf-repeat-shape %s | |
2490 ebnf-repeat-shadow %S | |
2491 ebnf-repeat-border-width %S | |
2492 ebnf-repeat-border-color %S | |
2493 ebnf-terminal-regexp %S | |
2494 ebnf-case-fold-search %S | |
2495 ebnf-terminal-font %s | |
2496 ebnf-terminal-shape %s | |
2497 ebnf-terminal-shadow %S | |
2498 ebnf-terminal-border-width %S | |
2499 ebnf-terminal-border-color %S | |
2500 ebnf-non-terminal-font %s | |
2501 ebnf-non-terminal-shape %s | |
2502 ebnf-non-terminal-shadow %S | |
2503 ebnf-non-terminal-border-width %S | |
2504 ebnf-non-terminal-border-color %S | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2505 ebnf-production-name-p %S |
27451 | 2506 ebnf-sort-production %s |
2507 ebnf-production-font %s | |
2508 ebnf-arrow-shape %s | |
2509 ebnf-chart-shape %s | |
2510 ebnf-user-arrow %s | |
2511 ebnf-horizontal-orientation %S | |
2512 ebnf-horizontal-max-height %S | |
2513 ebnf-production-horizontal-space %S | |
2514 ebnf-production-vertical-space %S | |
2515 ebnf-justify-sequence %s | |
2516 ebnf-lex-comment-char ?\\%03o | |
2517 ebnf-lex-eop-char ?\\%03o | |
2518 ebnf-syntax %s | |
2519 ebnf-iso-alternative-p %S | |
2520 ebnf-iso-normalize-p %S | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2521 ebnf-file-suffix-regexp %S |
27451 | 2522 ebnf-eps-prefix %S |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2523 ebnf-eps-header-font %s |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2524 ebnf-eps-header %s |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2525 ebnf-eps-footer-font %s |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2526 ebnf-eps-footer %s |
27451 | 2527 ebnf-entry-percentage %S |
2528 ebnf-color-p %S | |
2529 ebnf-line-width %S | |
2530 ebnf-line-color %S | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2531 ebnf-arrow-extra-width %S |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2532 ebnf-arrow-scale %S |
27451 | 2533 ebnf-debug-ps %S |
2534 ebnf-use-float-format %S | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2535 ebnf-stop-on-error %S |
27451 | 2536 ebnf-yac-ignore-error-recovery %S |
2537 ebnf-ignore-empty-rule %S | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2538 ebnf-optimize %S |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2539 ebnf-log %S) |
34803
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
2540 |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
2541 ;;; ebnf2ps.el - end of settings |
27451 | 2542 " |
34803
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
2543 ebnf-version |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2544 emacs-version |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2545 ebnf-special-show-delimiter |
27451 | 2546 (ps-print-quote ebnf-special-font) |
2547 (ps-print-quote ebnf-special-shape) | |
2548 ebnf-special-shadow | |
2549 ebnf-special-border-width | |
2550 ebnf-special-border-color | |
2551 (ps-print-quote ebnf-except-font) | |
2552 (ps-print-quote ebnf-except-shape) | |
2553 ebnf-except-shadow | |
2554 ebnf-except-border-width | |
2555 ebnf-except-border-color | |
2556 (ps-print-quote ebnf-repeat-font) | |
2557 (ps-print-quote ebnf-repeat-shape) | |
2558 ebnf-repeat-shadow | |
2559 ebnf-repeat-border-width | |
2560 ebnf-repeat-border-color | |
2561 ebnf-terminal-regexp | |
2562 ebnf-case-fold-search | |
2563 (ps-print-quote ebnf-terminal-font) | |
2564 (ps-print-quote ebnf-terminal-shape) | |
2565 ebnf-terminal-shadow | |
2566 ebnf-terminal-border-width | |
2567 ebnf-terminal-border-color | |
2568 (ps-print-quote ebnf-non-terminal-font) | |
2569 (ps-print-quote ebnf-non-terminal-shape) | |
2570 ebnf-non-terminal-shadow | |
2571 ebnf-non-terminal-border-width | |
2572 ebnf-non-terminal-border-color | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2573 ebnf-production-name-p |
27451 | 2574 (ps-print-quote ebnf-sort-production) |
2575 (ps-print-quote ebnf-production-font) | |
2576 (ps-print-quote ebnf-arrow-shape) | |
2577 (ps-print-quote ebnf-chart-shape) | |
2578 (ps-print-quote ebnf-user-arrow) | |
2579 ebnf-horizontal-orientation | |
2580 ebnf-horizontal-max-height | |
2581 ebnf-production-horizontal-space | |
2582 ebnf-production-vertical-space | |
2583 (ps-print-quote ebnf-justify-sequence) | |
2584 ebnf-lex-comment-char | |
2585 ebnf-lex-eop-char | |
2586 (ps-print-quote ebnf-syntax) | |
2587 ebnf-iso-alternative-p | |
2588 ebnf-iso-normalize-p | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2589 ebnf-file-suffix-regexp |
27451 | 2590 ebnf-eps-prefix |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2591 (ps-print-quote ebnf-eps-header-font) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2592 (ps-print-quote ebnf-eps-header) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2593 (ps-print-quote ebnf-eps-footer-font) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2594 (ps-print-quote ebnf-eps-footer) |
27451 | 2595 ebnf-entry-percentage |
2596 ebnf-color-p | |
2597 ebnf-line-width | |
2598 ebnf-line-color | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2599 ebnf-arrow-extra-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2600 ebnf-arrow-scale |
27451 | 2601 ebnf-debug-ps |
2602 ebnf-use-float-format | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2603 ebnf-stop-on-error |
27451 | 2604 ebnf-yac-ignore-error-recovery |
2605 ebnf-ignore-empty-rule | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2606 ebnf-optimize |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2607 ebnf-log)) |
27451 | 2608 |
2609 | |
2610 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2611 ;; Style variables | |
2612 | |
2613 | |
2614 (defvar ebnf-stack-style nil | |
2615 "Used in functions `ebnf-reset-style', `ebnf-push-style' and | |
2616 `ebnf-pop-style'.") | |
2617 | |
2618 | |
2619 (defvar ebnf-current-style 'default | |
2620 "Used in functions `ebnf-apply-style' and `ebnf-push-style'.") | |
2621 | |
2622 | |
2623 (defconst ebnf-style-custom-list | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2624 '(ebnf-special-show-delimiter |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2625 ebnf-special-font |
27451 | 2626 ebnf-special-shape |
2627 ebnf-special-shadow | |
2628 ebnf-special-border-width | |
2629 ebnf-special-border-color | |
2630 ebnf-except-font | |
2631 ebnf-except-shape | |
2632 ebnf-except-shadow | |
2633 ebnf-except-border-width | |
2634 ebnf-except-border-color | |
2635 ebnf-repeat-font | |
2636 ebnf-repeat-shape | |
2637 ebnf-repeat-shadow | |
2638 ebnf-repeat-border-width | |
2639 ebnf-repeat-border-color | |
2640 ebnf-terminal-regexp | |
2641 ebnf-case-fold-search | |
2642 ebnf-terminal-font | |
2643 ebnf-terminal-shape | |
2644 ebnf-terminal-shadow | |
2645 ebnf-terminal-border-width | |
2646 ebnf-terminal-border-color | |
2647 ebnf-non-terminal-font | |
2648 ebnf-non-terminal-shape | |
2649 ebnf-non-terminal-shadow | |
2650 ebnf-non-terminal-border-width | |
2651 ebnf-non-terminal-border-color | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2652 ebnf-production-name-p |
27451 | 2653 ebnf-sort-production |
2654 ebnf-production-font | |
2655 ebnf-arrow-shape | |
2656 ebnf-chart-shape | |
2657 ebnf-user-arrow | |
2658 ebnf-horizontal-orientation | |
2659 ebnf-horizontal-max-height | |
2660 ebnf-production-horizontal-space | |
2661 ebnf-production-vertical-space | |
2662 ebnf-justify-sequence | |
2663 ebnf-lex-comment-char | |
2664 ebnf-lex-eop-char | |
2665 ebnf-syntax | |
2666 ebnf-iso-alternative-p | |
2667 ebnf-iso-normalize-p | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2668 ebnf-file-suffix-regexp |
27451 | 2669 ebnf-eps-prefix |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2670 ebnf-eps-header-font |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2671 ebnf-eps-header |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2672 ebnf-eps-footer-font |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2673 ebnf-eps-footer |
27451 | 2674 ebnf-entry-percentage |
2675 ebnf-color-p | |
2676 ebnf-line-width | |
2677 ebnf-line-color | |
2678 ebnf-debug-ps | |
2679 ebnf-use-float-format | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2680 ebnf-stop-on-error |
27451 | 2681 ebnf-yac-ignore-error-recovery |
2682 ebnf-ignore-empty-rule | |
2683 ebnf-optimize) | |
2684 "List of valid symbol custom variable.") | |
2685 | |
2686 | |
2687 (defvar ebnf-style-database | |
2688 '(;; EBNF default | |
2689 (default | |
2690 nil | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2691 (ebnf-special-show-delimiter . t) |
27451 | 2692 (ebnf-special-font . '(7 Courier "Black" "Gray95" bold italic)) |
2693 (ebnf-special-shape . 'bevel) | |
2694 (ebnf-special-shadow . nil) | |
2695 (ebnf-special-border-width . 0.5) | |
2696 (ebnf-special-border-color . "Black") | |
2697 (ebnf-except-font . '(7 Courier "Black" "Gray90" bold italic)) | |
2698 (ebnf-except-shape . 'bevel) | |
2699 (ebnf-except-shadow . nil) | |
2700 (ebnf-except-border-width . 0.25) | |
2701 (ebnf-except-border-color . "Black") | |
2702 (ebnf-repeat-font . '(7 Courier "Black" "Gray85" bold italic)) | |
2703 (ebnf-repeat-shape . 'bevel) | |
2704 (ebnf-repeat-shadow . nil) | |
2705 (ebnf-repeat-border-width . 0.0) | |
2706 (ebnf-repeat-border-color . "Black") | |
2707 (ebnf-terminal-regexp . nil) | |
2708 (ebnf-case-fold-search . nil) | |
2709 (ebnf-terminal-font . '(7 Courier "Black" "White")) | |
2710 (ebnf-terminal-shape . 'miter) | |
2711 (ebnf-terminal-shadow . nil) | |
2712 (ebnf-terminal-border-width . 1.0) | |
2713 (ebnf-terminal-border-color . "Black") | |
2714 (ebnf-non-terminal-font . '(7 Helvetica "Black" "White")) | |
2715 (ebnf-non-terminal-shape . 'round) | |
2716 (ebnf-non-terminal-shadow . nil) | |
2717 (ebnf-non-terminal-border-width . 1.0) | |
2718 (ebnf-non-terminal-border-color . "Black") | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2719 (ebnf-production-name-p . t) |
27451 | 2720 (ebnf-sort-production . nil) |
2721 (ebnf-production-font . '(10 Helvetica "Black" "White" bold)) | |
2722 (ebnf-arrow-shape . 'hollow) | |
2723 (ebnf-chart-shape . 'round) | |
2724 (ebnf-user-arrow . nil) | |
2725 (ebnf-horizontal-orientation . nil) | |
2726 (ebnf-horizontal-max-height . nil) | |
2727 (ebnf-production-horizontal-space . 0.0) | |
2728 (ebnf-production-vertical-space . 0.0) | |
2729 (ebnf-justify-sequence . 'center) | |
2730 (ebnf-lex-comment-char . ?\;) | |
2731 (ebnf-lex-eop-char . ?.) | |
2732 (ebnf-syntax . 'ebnf) | |
2733 (ebnf-iso-alternative-p . nil) | |
2734 (ebnf-iso-normalize-p . nil) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2735 (ebnf-file-suffix-regexp . "\.[Bb][Nn][Ff]$") |
27451 | 2736 (ebnf-eps-prefix . "ebnf--") |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2737 (ebnf-eps-header-font . '(11 Helvetica "Black" "White" bold)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2738 (ebnf-eps-header . nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2739 (ebnf-eps-footer-font . '(7 Helvetica "Black" "White" bold)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2740 (ebnf-eps-footer . nil) |
27451 | 2741 (ebnf-entry-percentage . 0.5) |
2742 (ebnf-color-p . (or (fboundp 'x-color-values) ; Emacs | |
2743 (fboundp 'color-instance-rgb-components))) ; XEmacs | |
2744 (ebnf-line-width . 1.0) | |
2745 (ebnf-line-color . "Black") | |
2746 (ebnf-debug-ps . nil) | |
2747 (ebnf-use-float-format . t) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2748 (ebnf-stop-on-error . nil) |
27451 | 2749 (ebnf-yac-ignore-error-recovery . nil) |
2750 (ebnf-ignore-empty-rule . nil) | |
2751 (ebnf-optimize . nil)) | |
2752 ;; Happy EBNF default | |
2753 (happy | |
2754 default | |
2755 (ebnf-justify-sequence . 'left) | |
2756 (ebnf-lex-comment-char . ?\#) | |
2757 (ebnf-lex-eop-char . ?\;)) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2758 ;; ABNF default |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2759 (abnf |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2760 default |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2761 (ebnf-syntax . 'abnf)) |
27451 | 2762 ;; ISO EBNF default |
2763 (iso-ebnf | |
2764 default | |
2765 (ebnf-syntax . 'iso-ebnf)) | |
2766 ;; Yacc/Bison default | |
2767 (yacc | |
2768 default | |
2769 (ebnf-syntax . 'yacc)) | |
54625 | 2770 ;; ebnfx default |
2771 (ebnfx | |
2772 default | |
2773 (ebnf-syntax . 'ebnfx)) | |
54714 | 2774 ;; dtd default |
2775 (dtd | |
2776 default | |
2777 (ebnf-syntax . 'dtd)) | |
27451 | 2778 ) |
2779 "Style database. | |
2780 | |
2781 Each element has the following form: | |
2782 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2783 (NAME INHERITS (VAR . VALUE)...) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2784 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2785 Where: |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2786 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2787 NAME is a symbol name style. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2788 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2789 INHERITS is a symbol name style from which the current style inherits |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2790 the context. If INHERITS is nil, then there is no inheritance. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2791 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2792 This is a simple inheritance of style: if you declare that |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2793 style A inherits from style B, all settings of B are applied |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2794 first, and then the settings of A are applied. This is useful |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2795 when you wish to modify some aspects of an existing style, but |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2796 at the same time wish to keep it unmodified. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2797 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2798 VAR is a valid ebnf2ps symbol custom variable. |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2799 See `ebnf-style-custom-list' for valid symbol variables. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2800 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2801 VALUE is a sexp which will be evaluated to set the value of VAR. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2802 Don't forget to quote symbols and constant lists. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2803 See `default' style for an example. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2804 |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2805 Don't use this variable directly. Use functions `ebnf-insert-style', |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2806 `ebnf-delete-style' and `ebnf-merge-style'.") |
27451 | 2807 |
2808 | |
2809 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2810 ;; Style commands | |
2811 | |
2812 | |
2813 ;;;###autoload | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2814 (defun ebnf-find-style (name) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2815 "Return style definition if NAME is already defined; otherwise, return nil. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2816 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2817 See `ebnf-style-database' documentation." |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2818 (interactive "SStyle name: ") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2819 (assoc name ebnf-style-database)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2820 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2821 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2822 ;;;###autoload |
27451 | 2823 (defun ebnf-insert-style (name inherits &rest values) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2824 "Insert a new style NAME with inheritance INHERITS and values VALUES. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2825 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2826 See `ebnf-style-database' documentation." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2827 (interactive "SStyle name: \nSStyle inherits from: \nXStyle values: ") |
27451 | 2828 (and (assoc name ebnf-style-database) |
2829 (error "Style name already exists: %s" name)) | |
2830 (or (assoc inherits ebnf-style-database) | |
77172
4c69a90220e3
(ebnf-insert-style, ebnf-merge-style): Fix typos in error messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
75624
diff
changeset
|
2831 (error "Style inheritance name doesn't exist: %s" inherits)) |
27451 | 2832 (setq ebnf-style-database |
2833 (cons (cons name (cons inherits (ebnf-check-style-values values))) | |
2834 ebnf-style-database))) | |
2835 | |
2836 | |
2837 ;;;###autoload | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2838 (defun ebnf-delete-style (name) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2839 "Delete style NAME. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2840 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2841 See `ebnf-style-database' documentation." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2842 (interactive "SDelete style name: ") |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2843 (or (assoc name ebnf-style-database) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2844 (error "Style name doesn't exist: %s" name)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2845 (let ((db ebnf-style-database)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2846 (while db |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2847 (and (eq (nth 1 (car db)) name) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2848 (error "Style name `%s' is inherited by `%s' style" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2849 name (nth 0 (car db)))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2850 (setq db (cdr db)))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2851 (setq ebnf-style-database (assq-delete-all name ebnf-style-database))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2852 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2853 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2854 ;;;###autoload |
27451 | 2855 (defun ebnf-merge-style (name &rest values) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2856 "Merge values of style NAME with style VALUES. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2857 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2858 See `ebnf-style-database' documentation." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2859 (interactive "SStyle name: \nXStyle values: ") |
27451 | 2860 (let ((style (or (assoc name ebnf-style-database) |
77172
4c69a90220e3
(ebnf-insert-style, ebnf-merge-style): Fix typos in error messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
75624
diff
changeset
|
2861 (error "Style name doesn't exist: %s" name))) |
27451 | 2862 (merge (ebnf-check-style-values values)) |
2863 val elt new check) | |
2864 ;; modify value of existing variables | |
2865 (setq val (nthcdr 2 style)) | |
2866 (while merge | |
2867 (setq check (car merge) | |
2868 merge (cdr merge) | |
2869 elt (assoc (car check) val)) | |
2870 (if elt | |
2871 (setcdr elt (cdr check)) | |
2872 (setq new (cons check new)))) | |
2873 ;; insert new variables | |
2874 (nconc style (nreverse new)))) | |
2875 | |
2876 | |
2877 ;;;###autoload | |
2878 (defun ebnf-apply-style (style) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2879 "Set STYLE as the current style. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2880 |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2881 Returns the old style symbol. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2882 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2883 See `ebnf-style-database' documentation." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2884 (interactive "SApply style: ") |
27451 | 2885 (prog1 |
2886 ebnf-current-style | |
2887 (and (ebnf-apply-style1 style) | |
2888 (setq ebnf-current-style style)))) | |
2889 | |
2890 | |
2891 ;;;###autoload | |
2892 (defun ebnf-reset-style (&optional style) | |
2893 "Reset current style. | |
2894 | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2895 Returns the old style symbol. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2896 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2897 See `ebnf-style-database' documentation." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2898 (interactive "SReset style: ") |
27451 | 2899 (setq ebnf-stack-style nil) |
2900 (ebnf-apply-style (or style 'default))) | |
2901 | |
2902 | |
2903 ;;;###autoload | |
2904 (defun ebnf-push-style (&optional style) | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2905 "Push the current style onto a stack and set STYLE as the current style. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2906 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2907 Returns the old style symbol. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2908 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2909 See also `ebnf-pop-style'. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2910 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2911 See `ebnf-style-database' documentation." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2912 (interactive "SPush style: ") |
27451 | 2913 (prog1 |
2914 ebnf-current-style | |
2915 (setq ebnf-stack-style (cons ebnf-current-style ebnf-stack-style)) | |
2916 (and style | |
2917 (ebnf-apply-style style)))) | |
2918 | |
2919 | |
2920 ;;;###autoload | |
2921 (defun ebnf-pop-style () | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2922 "Pop a style from the stack of pushed styles and set it as the current style. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2923 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2924 Returns the old style symbol. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2925 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
2926 See also `ebnf-push-style'. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2927 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2928 See `ebnf-style-database' documentation." |
27451 | 2929 (interactive) |
2930 (prog1 | |
2931 (ebnf-apply-style (car ebnf-stack-style)) | |
2932 (setq ebnf-stack-style (cdr ebnf-stack-style)))) | |
2933 | |
2934 | |
2935 (defun ebnf-apply-style1 (style) | |
2936 (let ((value (cdr (assoc style ebnf-style-database)))) | |
2937 (prog1 | |
2938 value | |
2939 (and (car value) (ebnf-apply-style1 (car value))) | |
2940 (while (setq value (cdr value)) | |
2941 (set (caar value) (eval (cdar value))))))) | |
2942 | |
2943 | |
2944 (defun ebnf-check-style-values (values) | |
2945 (let (style) | |
2946 (while values | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
2947 (and (memq (caar values) ebnf-style-custom-list) |
27451 | 2948 (setq style (cons (car values) style))) |
2949 (setq values (cdr values))) | |
2950 (nreverse style))) | |
2951 | |
2952 | |
2953 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2954 ;; Internal variables | |
2955 | |
2956 | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2957 (defvar ebnf-eps-buffer-name " *EPS*") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2958 (defvar ebnf-parser-func nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2959 (defvar ebnf-eps-executing nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2960 (defvar ebnf-eps-header-comment nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2961 (defvar ebnf-eps-footer-comment nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2962 (defvar ebnf-eps-upper-x 0.0) |
27451 | 2963 (make-variable-buffer-local 'ebnf-eps-upper-x) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2964 (defvar ebnf-eps-upper-y 0.0) |
27451 | 2965 (make-variable-buffer-local 'ebnf-eps-upper-y) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2966 (defvar ebnf-eps-prod-width 0.0) |
27451 | 2967 (make-variable-buffer-local 'ebnf-eps-prod-width) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2968 (defvar ebnf-eps-max-height 0.0) |
27451 | 2969 (make-variable-buffer-local 'ebnf-eps-max-height) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2970 (defvar ebnf-eps-max-width 0.0) |
27451 | 2971 (make-variable-buffer-local 'ebnf-eps-max-width) |
2972 | |
2973 | |
2974 (defvar ebnf-eps-context nil | |
2975 "List of EPS file name during parsing. | |
2976 | |
2977 See section \"Actions in Comments\" in ebnf2ps documentation.") | |
2978 | |
2979 | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2980 (defvar ebnf-eps-file-alist nil |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2981 "Alist associating file name with EPS header and footer. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2982 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2983 Each element has the following form: |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2984 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2985 (EPS-FILENAME HEADER FOOTER) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2986 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2987 EPS-FILENAME is the EPS file name. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2988 HEADER is the header string or nil. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2989 FOOTER is the footer string or nil. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2990 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2991 It's generated during parsing and used during EPS generation. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2992 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2993 See `ebnf-eps-context' and section \"Actions in Comments\" in ebnf2ps |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2994 documentation.") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2995 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
2996 |
27451 | 2997 (defvar ebnf-eps-production-list nil |
2998 "Alist associating production name with EPS file name list. | |
2999 | |
3000 Each element has the following form: | |
3001 | |
3002 (PRODUCTION EPS-FILENAME...) | |
3003 | |
3004 PRODUCTION is the production name. | |
3005 EPS-FILENAME is the EPS file name. | |
3006 | |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
3007 This is generated during parsing and used during EPS generation. |
27451 | 3008 |
3009 See `ebnf-eps-context' and section \"Actions in Comments\" in ebnf2ps | |
3010 documentation.") | |
3011 | |
3012 | |
3013 (defconst ebnf-arrow-shape-alist | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3014 '((none . 0) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3015 (semi-up . 1) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3016 (semi-down . 2) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3017 (simple . 3) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3018 (transparent . 4) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3019 (hollow . 5) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3020 (full . 6) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3021 (semi-up-hollow . 7) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3022 (semi-up-full . 8) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3023 (semi-down-hollow . 9) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3024 (semi-down-full . 10) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3025 (user . 11)) |
27451 | 3026 "Alist associating values for `ebnf-arrow-shape'. |
3027 | |
3028 See documentation for `ebnf-arrow-shape'.") | |
3029 | |
3030 | |
3031 (defconst ebnf-terminal-shape-alist | |
3032 '((miter . 0) | |
3033 (round . 1) | |
3034 (bevel . 2)) | |
3035 "Alist associating values from `ebnf-terminal-shape' to a bit vector. | |
3036 | |
3037 See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and | |
3038 `ebnf-chart-shape'.") | |
3039 | |
3040 | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3041 (defvar ebnf-limit nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3042 (defvar ebnf-action nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3043 (defvar ebnf-action-list nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3044 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3045 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3046 (defvar ebnf-default-p nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3047 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3048 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3049 (defvar ebnf-font-height-P 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3050 (defvar ebnf-font-height-T 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3051 (defvar ebnf-font-height-NT 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3052 (defvar ebnf-font-height-S 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3053 (defvar ebnf-font-height-E 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3054 (defvar ebnf-font-height-R 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3055 (defvar ebnf-font-width-P 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3056 (defvar ebnf-font-width-T 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3057 (defvar ebnf-font-width-NT 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3058 (defvar ebnf-font-width-S 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3059 (defvar ebnf-font-width-E 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3060 (defvar ebnf-font-width-R 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3061 (defvar ebnf-space-T 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3062 (defvar ebnf-space-NT 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3063 (defvar ebnf-space-S 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3064 (defvar ebnf-space-E 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3065 (defvar ebnf-space-R 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3066 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3067 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3068 (defvar ebnf-basic-width-extra 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3069 (defvar ebnf-basic-width 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3070 (defvar ebnf-basic-height 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3071 (defvar ebnf-basic-empty-height 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3072 (defvar ebnf-vertical-space 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3073 (defvar ebnf-horizontal-space 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3074 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3075 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3076 (defvar ebnf-settings nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3077 (defvar ebnf-fonts-required nil) |
27451 | 3078 |
3079 | |
3080 (defconst ebnf-debug | |
3081 " | |
3082 % === begin EBNF procedures to help debugging | |
3083 | |
3084 % Mark visually current point: string debug | |
3085 /debug | |
3086 {/-s- exch def | |
3087 currentpoint | |
3088 gsave -s- show grestore | |
3089 gsave | |
3090 20 20 rlineto | |
3091 0 -40 rlineto | |
3092 -40 40 rlineto | |
3093 0 -40 rlineto | |
3094 20 20 rlineto | |
3095 stroke | |
3096 grestore | |
3097 moveto | |
3098 }def | |
3099 | |
3100 % Show number value: number string debug-number | |
3101 /debug-number | |
3102 {gsave | |
3103 20 0 rmoveto show ([) show 60 string cvs show (]) show | |
3104 grestore | |
3105 }def | |
3106 | |
3107 % === end EBNF procedures to help debugging | |
3108 | |
3109 " | |
3110 "This is intended to help debugging PostScript programming.") | |
3111 | |
3112 | |
3113 (defconst ebnf-prologue | |
3114 " | |
3115 % === begin EBNF engine | |
3116 | |
3117 % --- Basic Definitions | |
3118 | |
3119 /fS F | |
3120 /SpaceS FontHeight 0.5 mul def | |
3121 /HeightS FontHeight FontHeight add def | |
3122 | |
3123 /fE F | |
3124 /SpaceE FontHeight 0.5 mul def | |
3125 /HeightE FontHeight FontHeight add def | |
3126 | |
3127 /fR F | |
3128 /SpaceR FontHeight 0.5 mul def | |
3129 /HeightR FontHeight FontHeight add def | |
3130 | |
3131 /fT F | |
3132 /SpaceT FontHeight 0.5 mul def | |
3133 /HeightT FontHeight FontHeight add def | |
3134 | |
3135 /fNT F | |
3136 /SpaceNT FontHeight 0.5 mul def | |
3137 /HeightNT FontHeight FontHeight add def | |
3138 | |
3139 /T HeightT HeightNT add 0.5 mul def | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
3140 /hT T 0.5 mul def |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
3141 /hT2 hT 0.5 mul ArrowScale mul def |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
3142 /hT4 hT 0.25 mul ArrowScale mul def |
27451 | 3143 |
3144 /Er 0.1 def % Error factor | |
3145 | |
3146 | |
3147 /c{currentpoint}bind def | |
3148 /xyi{/xi c /yi exch def def}bind def | |
3149 /xyo{/xo c /yo exch def def}bind def | |
3150 /xyp{/xp c /yp exch def def}bind def | |
3151 /xyt{/xt c /yt exch def def}bind def | |
3152 | |
3153 % vertical movement: x y height vm | |
3154 /vm{add moveto}bind def | |
3155 | |
3156 % horizontal movement: x y width hm | |
3157 /hm{3 -1 roll exch add exch moveto}bind def | |
3158 | |
3159 % set color: [R G B] SetRGB | |
3160 /SetRGB{aload pop setrgbcolor}bind def | |
3161 | |
3162 % filling gray area: gray-scale FillGray | |
3163 /FillGray{gsave setgray fill grestore}bind def | |
3164 | |
3165 % filling color area: [R G B] FillRGB | |
3166 /FillRGB{gsave SetRGB fill grestore}bind def | |
3167 | |
3168 /Stroke{LineWidth setlinewidth LineColor SetRGB stroke}bind def | |
3169 /StrokeShape{borderwidth setlinewidth bordercolor SetRGB stroke}bind def | |
3170 /Gstroke{gsave Stroke grestore}bind def | |
3171 | |
3172 % Empty Line: width EL | |
3173 /EL{0 rlineto Gstroke}bind def | |
3174 | |
3175 % --- Arrows | |
3176 | |
3177 /Down{hT2 neg hT4 neg rlineto}bind def | |
3178 | |
3179 /Arrow | |
3180 {hT2 neg hT4 rmoveto | |
3181 hT2 hT4 neg rlineto | |
3182 Down | |
3183 }bind def | |
3184 | |
3185 /ArrowPath{c newpath moveto Arrow closepath}bind def | |
3186 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3187 /UpPath |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3188 {c newpath moveto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3189 hT2 neg 0 rmoveto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3190 0 hT4 rlineto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3191 hT2 hT4 neg rlineto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3192 closepath |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3193 }bind def |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3194 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3195 /DownPath |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3196 {c newpath moveto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3197 hT2 neg 0 rmoveto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3198 0 hT4 neg rlineto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3199 hT2 hT4 rlineto |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3200 closepath |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3201 }bind def |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3202 |
27451 | 3203 %>Right Arrow: RA |
3204 % \\ | |
3205 % *---+ | |
3206 % / | |
3207 /RA-vector | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3208 [{} % 0 - none |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3209 {hT2 neg hT4 rlineto} % 1 - semi-up |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3210 {Down} % 2 - semi-down |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3211 {Arrow} % 3 - simple |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3212 {Gstroke ArrowPath} % 4 - transparent |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3213 {Gstroke ArrowPath 1 FillGray} % 5 - hollow |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3214 {Gstroke ArrowPath LineColor FillRGB} % 6 - full |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3215 {Gstroke UpPath 1 FillGray} % 7 - semi-up-hollow |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3216 {Gstroke UpPath LineColor FillRGB} % 8 - semi-up-full |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3217 {Gstroke DownPath 1 FillGray} % 9 - semi-down-hollow |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3218 {Gstroke DownPath LineColor FillRGB} % 10 - semi-down-full |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3219 {Gstroke gsave UserArrow grestore} % 11 - user |
27451 | 3220 ]def |
3221 | |
3222 /RA | |
3223 {hT 0 rlineto | |
3224 c | |
3225 RA-vector ArrowShape get exec | |
3226 Gstroke | |
3227 moveto | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
3228 ExtraWidth 0 rmoveto |
27451 | 3229 }def |
3230 | |
3231 % rotation DrawArrow | |
3232 /DrawArrow | |
3233 {gsave | |
3234 0 0 translate | |
3235 rotate | |
3236 RA | |
3237 c | |
3238 grestore | |
3239 rmoveto | |
3240 }def | |
3241 | |
3242 %>Left Arrow: LA | |
3243 % / | |
3244 % +---* | |
3245 % \\ | |
3246 /LA{180 DrawArrow}def | |
3247 | |
3248 %>Up Arrow: UA | |
3249 % + | |
3250 % /|\\ | |
3251 % | | |
3252 % * | |
3253 /UA{90 DrawArrow}def | |
3254 | |
3255 %>Down Arrow: DA | |
3256 % * | |
3257 % | | |
3258 % \\|/ | |
3259 % + | |
3260 /DA{270 DrawArrow}def | |
3261 | |
3262 % --- Corners | |
3263 | |
3264 %>corner Right Descendent: height arrow corner_RD | |
3265 % _ | arrow | |
3266 % / height > 0 | 0 - none | |
3267 % | | 1 - right | |
3268 % * ---------- | 2 - left | |
3269 % | | 3 - vertical | |
3270 % \\ height < 0 | | |
3271 % - | | |
3272 /cRD0-vector | |
3273 [% 0 - none | |
3274 {0 h rlineto | |
3275 hT 0 rlineto} | |
3276 % 1 - right | |
3277 {0 h rlineto | |
3278 RA} | |
3279 % 2 - left | |
3280 {hT 0 rmoveto xyi | |
3281 LA | |
3282 0 h neg rlineto | |
3283 xi yi moveto} | |
3284 % 3 - vertical | |
3285 {hT h rmoveto xyi | |
3286 hT neg 0 rlineto | |
3287 h 0 gt{DA}{UA}ifelse | |
3288 xi yi moveto} | |
3289 ]def | |
3290 | |
3291 /cRD-vector | |
3292 [{cRD0-vector arrow get exec} % 0 - miter | |
3293 {0 0 0 h hT h rcurveto} % 1 - rounded | |
3294 {hT h rlineto} % 2 - bevel | |
3295 ]def | |
3296 | |
3297 /corner_RD | |
3298 {/arrow exch def /h exch def | |
3299 cRD-vector ChartShape get exec | |
3300 Gstroke | |
3301 }def | |
3302 | |
3303 %>corner Right Ascendent: height arrow corner_RA | |
3304 % | arrow | |
3305 % | height > 0 | 0 - none | |
3306 % / | 1 - right | |
3307 % *- ---------- | 2 - left | |
3308 % \\ | 3 - vertical | |
3309 % | height < 0 | | |
3310 % | | |
3311 /cRA0-vector | |
3312 [% 0 - none | |
3313 {hT 0 rlineto | |
3314 0 h rlineto} | |
3315 % 1 - right | |
3316 {RA | |
3317 0 h rlineto} | |
3318 % 2 - left | |
3319 {hT h rmoveto xyi | |
3320 0 h neg rlineto | |
3321 LA | |
3322 xi yi moveto} | |
3323 % 3 - vertical | |
3324 {hT h rmoveto xyi | |
3325 h 0 gt{DA}{UA}ifelse | |
3326 hT neg 0 rlineto | |
3327 xi yi moveto} | |
3328 ]def | |
3329 | |
3330 /cRA-vector | |
3331 [{cRA0-vector arrow get exec} % 0 - miter | |
3332 {0 0 hT 0 hT h rcurveto} % 1 - rounded | |
3333 {hT h rlineto} % 2 - bevel | |
3334 ]def | |
3335 | |
3336 /corner_RA | |
3337 {/arrow exch def /h exch def | |
3338 cRA-vector ChartShape get exec | |
3339 Gstroke | |
3340 }def | |
3341 | |
3342 %>corner Left Descendent: height arrow corner_LD | |
3343 % _ | arrow | |
3344 % \\ height > 0 | 0 - none | |
3345 % | | 1 - right | |
3346 % * ---------- | 2 - left | |
3347 % | | 3 - vertical | |
3348 % / height < 0 | | |
3349 % - | | |
3350 /cLD0-vector | |
3351 [% 0 - none | |
3352 {0 h rlineto | |
3353 hT neg 0 rlineto} | |
3354 % 1 - right | |
3355 {hT neg h rmoveto xyi | |
3356 RA | |
3357 0 h neg rlineto | |
3358 xi yi moveto} | |
3359 % 2 - left | |
3360 {0 h rlineto | |
3361 LA} | |
3362 % 3 - vertical | |
3363 {hT neg h rmoveto xyi | |
3364 hT 0 rlineto | |
3365 h 0 gt{DA}{UA}ifelse | |
3366 xi yi moveto} | |
3367 ]def | |
3368 | |
3369 /cLD-vector | |
3370 [{cLD0-vector arrow get exec} % 0 - miter | |
3371 {0 0 0 h hT neg h rcurveto} % 1 - rounded | |
3372 {hT neg h rlineto} % 2 - bevel | |
3373 ]def | |
3374 | |
3375 /corner_LD | |
3376 {/arrow exch def /h exch def | |
3377 cLD-vector ChartShape get exec | |
3378 Gstroke | |
3379 }def | |
3380 | |
3381 %>corner Left Ascendent: height arrow corner_LA | |
3382 % | arrow | |
3383 % | height > 0 | 0 - none | |
3384 % \\ | 1 - right | |
3385 % -* ---------- | 2 - left | |
3386 % / | 3 - vertical | |
3387 % | height < 0 | | |
3388 % | | |
3389 /cLA0-vector | |
3390 [% 0 - none | |
3391 {hT neg 0 rlineto | |
3392 0 h rlineto} | |
3393 % 1 - right | |
3394 {hT neg h rmoveto xyi | |
3395 0 h neg rlineto | |
3396 RA | |
3397 xi yi moveto} | |
3398 % 2 - left | |
3399 {LA | |
3400 0 h rlineto} | |
3401 % 3 - vertical | |
3402 {hT neg h rmoveto xyi | |
3403 h 0 gt{DA}{UA}ifelse | |
3404 hT 0 rlineto | |
3405 xi yi moveto} | |
3406 ]def | |
3407 | |
3408 /cLA-vector | |
3409 [{cLA0-vector arrow get exec} % 0 - miter | |
3410 {0 0 hT neg 0 hT neg h rcurveto} % 1 - rounded | |
3411 {hT neg h rlineto} % 2 - bevel | |
3412 ]def | |
3413 | |
3414 /corner_LA | |
3415 {/arrow exch def /h exch def | |
3416 cLA-vector ChartShape get exec | |
3417 Gstroke | |
3418 }def | |
3419 | |
3420 % --- Flow Stuff | |
3421 | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3422 % height prepare-height |- line_height corner_height corner_height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3423 /prepare-height |
27451 | 3424 {dup 0 gt |
3425 {T sub hT} | |
3426 {T add hT neg}ifelse | |
3427 dup | |
3428 }def | |
3429 | |
3430 %>Left Alternative: height LAlt | |
3431 % _ | |
3432 % / | |
3433 % | height > 0 | |
3434 % | | |
3435 % / | |
3436 % *- ---------- | |
3437 % \\ | |
3438 % | | |
3439 % | height < 0 | |
3440 % \\ | |
3441 % - | |
3442 /LAlt | |
3443 {dup 0 eq | |
3444 {T exch rlineto} | |
3445 {dup abs T lt | |
3446 {0.5 mul dup | |
3447 1 corner_RA | |
3448 0 corner_RD} | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3449 {prepare-height |
27451 | 3450 1 corner_RA |
3451 exch 0 exch rlineto | |
3452 0 corner_RD | |
3453 }ifelse | |
3454 }ifelse | |
3455 }def | |
3456 | |
3457 %>Left Loop: height LLoop | |
3458 % _ | |
3459 % / | |
3460 % | height > 0 | |
3461 % | | |
3462 % \\ | |
3463 % -* ---------- | |
3464 % / | |
3465 % | | |
3466 % | height < 0 | |
3467 % \\ | |
3468 % - | |
3469 /LLoop | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3470 {prepare-height |
27451 | 3471 3 corner_LA |
3472 exch 0 exch rlineto | |
3473 0 corner_RD | |
3474 }def | |
3475 | |
3476 %>Right Alternative: height RAlt | |
3477 % _ | |
3478 % \\ | |
3479 % | height > 0 | |
3480 % | | |
3481 % \\ | |
3482 % -* ---------- | |
3483 % / | |
3484 % | | |
3485 % | height < 0 | |
3486 % / | |
3487 % - | |
3488 /RAlt | |
3489 {dup 0 eq | |
3490 {T neg exch rlineto} | |
3491 {dup abs T lt | |
3492 {0.5 mul dup | |
3493 1 corner_LA | |
3494 0 corner_LD} | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3495 {prepare-height |
27451 | 3496 1 corner_LA |
3497 exch 0 exch rlineto | |
3498 0 corner_LD | |
3499 }ifelse | |
3500 }ifelse | |
3501 }def | |
3502 | |
3503 %>Right Loop: height RLoop | |
3504 % _ | |
3505 % \\ | |
3506 % | height > 0 | |
3507 % | | |
3508 % / | |
3509 % *- ---------- | |
3510 % \\ | |
3511 % | | |
3512 % | height < 0 | |
3513 % / | |
3514 % - | |
3515 /RLoop | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
3516 {prepare-height |
27451 | 3517 1 corner_RA |
3518 exch 0 exch rlineto | |
3519 0 corner_LD | |
3520 }def | |
3521 | |
3522 % --- Terminal, Non-terminal and Special Basics | |
3523 | |
3524 % string width prepare-width |- string | |
3525 /prepare-width | |
3526 {/width exch def | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
3527 dup stringwidth pop space add space add width exch sub ExtraWidth sub 0.5 mul |
27451 | 3528 /w exch def |
3529 }def | |
3530 | |
3531 % string width begin-right | |
3532 /begin-right | |
3533 {xyo | |
3534 prepare-width | |
3535 w hT sub EL | |
3536 RA | |
3537 }def | |
3538 | |
3539 % end-right | |
3540 /end-right | |
3541 {xo width add Er add yo moveto | |
3542 w Er add neg EL | |
3543 xo yo moveto | |
3544 }def | |
3545 | |
3546 % string width begin-left | |
3547 /begin-left | |
3548 {xyo | |
3549 prepare-width | |
3550 w EL | |
3551 }def | |
3552 | |
3553 % end-left | |
3554 /end-left | |
3555 {xo width add Er add yo moveto | |
3556 hT w sub Er add EL | |
3557 LA | |
3558 xo yo moveto | |
3559 }def | |
3560 | |
3561 /ShapePath-vector | |
3562 [% 0 - miter | |
3563 {xx yy moveto | |
3564 xx YY lineto | |
3565 XX YY lineto | |
3566 XX yy lineto} | |
3567 % 1 - rounded | |
3568 {/half YY yy sub 0.5 mul abs def | |
3569 xx half add YY moveto | |
3570 0 0 half neg 0 half neg half neg rcurveto | |
3571 0 0 0 half neg half half neg rcurveto | |
3572 XX xx sub abs half sub half sub 0 rlineto | |
3573 0 0 half 0 half half rcurveto | |
3574 0 0 0 half half neg half rcurveto} | |
3575 % 2 - bevel | |
3576 {/quarter YY yy sub 0.25 mul abs def | |
3577 xx quarter add YY moveto | |
3578 quarter neg quarter neg rlineto | |
3579 0 quarter quarter add neg rlineto | |
3580 quarter quarter neg rlineto | |
3581 XX xx sub abs quarter sub quarter sub 0 rlineto | |
3582 quarter quarter rlineto | |
3583 0 quarter quarter add rlineto | |
3584 quarter neg quarter rlineto} | |
3585 ]def | |
3586 | |
3587 /doShapePath | |
3588 {newpath | |
3589 ShapePath-vector shape get exec | |
3590 closepath | |
3591 }def | |
3592 | |
3593 /doShapeShadow | |
3594 {gsave | |
3595 Xshadow Xshadow add Xshadow add | |
3596 Yshadow Yshadow add Yshadow add translate | |
3597 doShapePath | |
3598 0.9 FillGray | |
3599 grestore | |
3600 }def | |
3601 | |
3602 /doShape | |
3603 {gsave | |
3604 doShapePath | |
3605 shapecolor FillRGB | |
3606 StrokeShape | |
3607 grestore | |
3608 }def | |
3609 | |
3610 % string SBound |- string | |
3611 /SBound | |
3612 {/xx c dup /yy exch def | |
3613 FontHeight add /YY exch def def | |
3614 dup stringwidth pop xx add /XX exch def | |
3615 Effect 8 and 0 ne | |
3616 {/yy yy YShadow add def | |
3617 /XX XX XShadow add def | |
3618 }if | |
3619 }def | |
3620 | |
3621 % string SBox | |
3622 /SBox | |
3623 {gsave | |
3624 c space sub moveto | |
3625 SBound | |
3626 /XX XX space add space add def | |
3627 /YY YY space add def | |
3628 /yy yy space sub def | |
3629 shadow{doShapeShadow}if | |
3630 doShape | |
3631 space Descent abs rmoveto | |
3632 foreground SetRGB S | |
3633 grestore | |
3634 }def | |
3635 | |
3636 % --- Terminal | |
3637 | |
3638 % TeRminal: string TR | |
3639 /TR | |
3640 {/Effect EffectT def | |
3641 /shape ShapeT def | |
3642 /shapecolor BackgroundT def | |
3643 /borderwidth BorderWidthT def | |
3644 /bordercolor BorderColorT def | |
3645 /foreground ForegroundT def | |
3646 /shadow ShadowT def | |
3647 SBox | |
3648 }def | |
3649 | |
3650 %>Right Terminal: string width RT |- x y | |
3651 /RT | |
3652 {xyt | |
3653 /fT F | |
3654 /space SpaceT def | |
3655 begin-right | |
3656 TR | |
3657 end-right | |
3658 xt yt | |
3659 }def | |
3660 | |
3661 %>Left Terminal: string width LT |- x y | |
3662 /LT | |
3663 {xyt | |
3664 /fT F | |
3665 /space SpaceT def | |
3666 begin-left | |
3667 TR | |
3668 end-left | |
3669 xt yt | |
3670 }def | |
3671 | |
3672 %>Right Terminal Default: string width RTD |- x y | |
3673 /RTD | |
3674 {/-save- BorderWidthT def | |
3675 /BorderWidthT BorderWidthT DefaultWidth add def | |
3676 RT | |
3677 /BorderWidthT -save- def | |
3678 }def | |
3679 | |
3680 %>Left Terminal Default: string width LTD |- x y | |
3681 /LTD | |
3682 {/-save- BorderWidthT def | |
3683 /BorderWidthT BorderWidthT DefaultWidth add def | |
3684 LT | |
3685 /BorderWidthT -save- def | |
3686 }def | |
3687 | |
3688 % --- Non-Terminal | |
3689 | |
3690 % Non-Terminal: string NT | |
3691 /NT | |
3692 {/Effect EffectNT def | |
3693 /shape ShapeNT def | |
3694 /shapecolor BackgroundNT def | |
3695 /borderwidth BorderWidthNT def | |
3696 /bordercolor BorderColorNT def | |
3697 /foreground ForegroundNT def | |
3698 /shadow ShadowNT def | |
3699 SBox | |
3700 }def | |
3701 | |
3702 %>Right Non-Terminal: string width RNT |- x y | |
3703 /RNT | |
3704 {xyt | |
3705 /fNT F | |
3706 /space SpaceNT def | |
3707 begin-right | |
3708 NT | |
3709 end-right | |
3710 xt yt | |
3711 }def | |
3712 | |
3713 %>Left Non-Terminal: string width LNT |- x y | |
3714 /LNT | |
3715 {xyt | |
3716 /fNT F | |
3717 /space SpaceNT def | |
3718 begin-left | |
3719 NT | |
3720 end-left | |
3721 xt yt | |
3722 }def | |
3723 | |
3724 %>Right Non-Terminal Default: string width RNTD |- x y | |
3725 /RNTD | |
3726 {/-save- BorderWidthNT def | |
3727 /BorderWidthNT BorderWidthNT DefaultWidth add def | |
3728 RNT | |
3729 /BorderWidthNT -save- def | |
3730 }def | |
3731 | |
3732 %>Left Non-Terminal Default: string width LNTD |- x y | |
3733 /LNTD | |
3734 {/-save- BorderWidthNT def | |
3735 /BorderWidthNT BorderWidthNT DefaultWidth add def | |
3736 LNT | |
3737 /BorderWidthNT -save- def | |
3738 }def | |
3739 | |
3740 % --- Special | |
3741 | |
3742 % SPecial: string SP | |
3743 /SP | |
3744 {/Effect EffectS def | |
3745 /shape ShapeS def | |
3746 /shapecolor BackgroundS def | |
3747 /borderwidth BorderWidthS def | |
3748 /bordercolor BorderColorS def | |
3749 /foreground ForegroundS def | |
3750 /shadow ShadowS def | |
3751 SBox | |
3752 }def | |
3753 | |
3754 %>Right SPecial: string width RSP |- x y | |
3755 /RSP | |
3756 {xyt | |
3757 /fS F | |
3758 /space SpaceS def | |
3759 begin-right | |
3760 SP | |
3761 end-right | |
3762 xt yt | |
3763 }def | |
3764 | |
3765 %>Left SPecial: string width LSP |- x y | |
3766 /LSP | |
3767 {xyt | |
3768 /fS F | |
3769 /space SpaceS def | |
3770 begin-left | |
3771 SP | |
3772 end-left | |
3773 xt yt | |
3774 }def | |
3775 | |
3776 %>Right SPecial Default: string width RSPD |- x y | |
3777 /RSPD | |
3778 {/-save- BorderWidthS def | |
3779 /BorderWidthS BorderWidthS DefaultWidth add def | |
3780 RSP | |
3781 /BorderWidthS -save- def | |
3782 }def | |
3783 | |
3784 %>Left SPecial Default: string width LSPD |- x y | |
3785 /LSPD | |
3786 {/-save- BorderWidthS def | |
3787 /BorderWidthS BorderWidthS DefaultWidth add def | |
3788 LSP | |
3789 /BorderWidthS -save- def | |
3790 }def | |
3791 | |
3792 % --- Repeat and Except basics | |
3793 | |
3794 /begin-direction | |
3795 {/w width rwidth sub 0.5 mul def | |
3796 width 0 rmoveto}def | |
3797 | |
3798 /end-direction | |
3799 {gsave | |
3800 /xx c entry add /YY exch def def | |
3801 /yy YY height sub def | |
3802 /XX xx rwidth add def | |
3803 shadow{doShapeShadow}if | |
3804 doShape | |
3805 grestore | |
3806 }def | |
3807 | |
3808 /right-direction | |
3809 {begin-direction | |
3810 w neg EL | |
3811 xt yt moveto | |
3812 w hT sub EL RA | |
3813 end-direction | |
3814 }def | |
3815 | |
3816 /left-direction | |
3817 {begin-direction | |
3818 hT w sub EL LA | |
3819 xt yt moveto | |
3820 w EL | |
3821 end-direction | |
3822 }def | |
3823 | |
3824 % --- Repeat | |
3825 | |
3826 % entry height width rwidth begin-repeat | |
3827 /begin-repeat | |
3828 {/rwidth exch def | |
3829 /width exch def | |
3830 /height exch def | |
3831 /entry exch def | |
3832 /fR F | |
3833 /space SpaceR def | |
3834 /Effect EffectR def | |
3835 /shape ShapeR def | |
3836 /shapecolor BackgroundR def | |
3837 /borderwidth BorderWidthR def | |
3838 /bordercolor BorderColorR def | |
3839 /foreground ForegroundR def | |
3840 /shadow ShadowR def | |
3841 xyt | |
3842 }def | |
3843 | |
3844 % string end-repeat |- x y | |
3845 /end-repeat | |
3846 {gsave | |
3847 space Descent rmoveto | |
3848 foreground SetRGB S | |
3849 c Descent sub | |
3850 grestore | |
3851 exch space add exch moveto | |
3852 xt yt | |
3853 }def | |
3854 | |
3855 %>Right RePeat: string entry height width rwidth RRP |- x y | |
3856 /RRP{begin-repeat right-direction end-repeat}def | |
3857 | |
3858 %>Left RePeat: string entry height width rwidth LRP |- x y | |
3859 /LRP{begin-repeat left-direction end-repeat}def | |
3860 | |
3861 % --- Except | |
3862 | |
3863 % entry height width rwidth begin-except | |
3864 /begin-except | |
3865 {/rwidth exch def | |
3866 /width exch def | |
3867 /height exch def | |
3868 /entry exch def | |
3869 /fE F | |
3870 /space SpaceE def | |
3871 /Effect EffectE def | |
3872 /shape ShapeE def | |
3873 /shapecolor BackgroundE def | |
3874 /borderwidth BorderWidthE def | |
3875 /bordercolor BorderColorE def | |
3876 /foreground ForegroundE def | |
3877 /shadow ShadowE def | |
3878 xyt | |
3879 }def | |
3880 | |
3881 % x-width end-except |- x y | |
3882 /end-except | |
3883 {gsave | |
3884 space space add add Descent rmoveto | |
3885 (-) foreground SetRGB S | |
3886 grestore | |
3887 space 0 rmoveto | |
3888 xt yt | |
3889 }def | |
3890 | |
3891 %>Right EXcept: x-width entry height width rwidth REX |- x y | |
3892 /REX{begin-except right-direction end-except}def | |
3893 | |
3894 %>Left EXcept: x-width entry height width rwidth LEX |- x y | |
3895 /LEX{begin-except left-direction end-except}def | |
3896 | |
3897 % --- Sequence | |
3898 | |
3899 %>Beginning Of Sequence: BOS |- x y | |
3900 /BOS{currentpoint}bind def | |
3901 | |
3902 %>End Of Sequence: x y x1 y1 EOS |- x y | |
3903 /EOS{pop pop}bind def | |
3904 | |
3905 % --- Production | |
3906 | |
3907 %>Beginning Of Production: string width height BOP |- y x | |
3908 /BOP | |
3909 {xyp | |
3910 neg yp add /yw exch def | |
3911 xp add T sub /xw exch def | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3912 dup length 0 gt % empty string ==> no production name |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3913 {/Effect EffectP def |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3914 /fP F ForegroundP SetRGB BackgroundP aload pop true BG S |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3915 /Effect 0 def |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
3916 ( :) S false BG}if |
27451 | 3917 xw yw moveto |
3918 hT EL RA | |
3919 xp yw moveto | |
3920 T EL | |
3921 yp xp | |
3922 }def | |
3923 | |
3924 %>End Of Production: y x delta EOP | |
3925 /EOPH{add exch moveto}bind def % horizontal | |
3926 /EOPV{exch pop sub 0 exch moveto}bind def % vertical | |
3927 | |
3928 % --- Empty Alternative | |
3929 | |
3930 %>Empty Alternative: width EA |- x y | |
3931 /EA | |
3932 {gsave | |
3933 Er add 0 rlineto | |
3934 Stroke | |
3935 grestore | |
3936 c | |
3937 }def | |
3938 | |
3939 % --- Alternative | |
3940 | |
3941 %>AlTernative: h1 h2 ... hn n width AT |- x y | |
3942 /AT | |
3943 {xyo xo add /xw exch def | |
3944 xw yo moveto | |
3945 Er EL | |
3946 {xw yo moveto | |
3947 dup RAlt | |
3948 xo yo moveto | |
3949 LAlt}repeat | |
3950 xo yo | |
3951 }def | |
3952 | |
3953 % --- Optional | |
3954 | |
3955 %>OPtional: height width OP |- x y | |
3956 /OP | |
3957 {xyo | |
3958 T sub /ow exch def | |
3959 ow Er sub 0 rmoveto | |
3960 T Er add EL | |
3961 neg dup RAlt | |
3962 ow T sub neg EL | |
3963 xo yo moveto | |
3964 LAlt | |
3965 xo yo moveto | |
3966 T EL | |
3967 xo yo | |
3968 }def | |
3969 | |
3970 % --- List Flow | |
3971 | |
3972 %>One or More: height width OM |- x y | |
3973 /OM | |
3974 {xyo | |
3975 /ow exch def | |
3976 ow Er add 0 rmoveto | |
3977 T Er add neg EL | |
3978 dup RLoop | |
3979 xo T add yo moveto | |
3980 LLoop | |
3981 xo yo moveto | |
3982 T EL | |
3983 xo yo | |
3984 }def | |
3985 | |
3986 %>Zero or More: h2 h1 width ZM |- x y | |
3987 /ZM | |
3988 {xyo | |
3989 Er add EL | |
3990 Er neg 0 rmoveto | |
3991 dup RAlt | |
3992 exch dup RLoop | |
3993 xo yo moveto | |
3994 exch dup LAlt | |
3995 exch LLoop | |
3996 yo add xo T add exch moveto | |
3997 xo yo | |
3998 }def | |
3999 | |
4000 % === end EBNF engine | |
4001 | |
4002 " | |
4003 "EBNF PostScript prologue") | |
4004 | |
4005 | |
4006 (defconst ebnf-eps-prologue | |
4007 " | |
4008 /#ebnf2ps#dict 230 dict def | |
4009 #ebnf2ps#dict begin | |
4010 | |
4011 % Initiliaze variables to avoid name-conflicting with document variables. | |
4012 % This is the case when using `bind' operator. | |
4013 /-fillp- 0 def /h 0 def | |
4014 /-ox- 0 def /half 0 def | |
4015 /-oy- 0 def /height 0 def | |
4016 /-save- 0 def /ow 0 def | |
4017 /Ascent 0 def /quarter 0 def | |
4018 /Descent 0 def /rXX 0 def | |
4019 /Effect 0 def /rYY 0 def | |
4020 /FontHeight 0 def /rwidth 0 def | |
4021 /LineThickness 0 def /rxx 0 def | |
4022 /OverlinePosition 0 def /ryy 0 def | |
4023 /SpaceBackground 0 def /shadow 0 def | |
4024 /StrikeoutPosition 0 def /shape 0 def | |
4025 /UnderlinePosition 0 def /shapecolor 0 def | |
4026 /XBox 0 def /space 0 def | |
4027 /XX 0 def /st 1 string def | |
4028 /Xshadow 0 def /w 0 def | |
4029 /YBox 0 def /width 0 def | |
4030 /YY 0 def /xi 0 def | |
4031 /Yshadow 0 def /xo 0 def | |
4032 /arrow 0 def /xp 0 def | |
4033 /bg false def /xt 0 def | |
4034 /bgcolor 0 def /xw 0 def | |
4035 /bordercolor 0 def /xx 0 def | |
4036 /borderwidth 0 def /yi 0 def | |
4037 /dd 0 def /yo 0 def | |
4038 /entry 0 def /yp 0 def | |
4039 /foreground 0 def /yt 0 def | |
4040 /yy 0 def | |
4041 | |
4042 | |
4043 % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4: | |
4044 /ISOLatin1Encoding where | |
4045 {pop} | |
4046 {% -- The ISO Latin-1 encoding vector isn't known, so define it. | |
4047 % -- The first half is the same as the standard encoding, | |
4048 % -- except for minus instead of hyphen at code 055. | |
4049 /ISOLatin1Encoding | |
4050 StandardEncoding 0 45 getinterval aload pop | |
4051 /minus | |
4052 StandardEncoding 46 82 getinterval aload pop | |
4053 %*** NOTE: the following are missing in the Adobe documentation, | |
4054 %*** but appear in the displayed table: | |
4055 %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240. | |
4056 % 0200 (128) | |
4057 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
4058 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
4059 /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent | |
4060 /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron | |
4061 % 0240 (160) | |
4062 /space /exclamdown /cent /sterling | |
4063 /currency /yen /brokenbar /section | |
4064 /dieresis /copyright /ordfeminine /guillemotleft | |
4065 /logicalnot /hyphen /registered /macron | |
4066 /degree /plusminus /twosuperior /threesuperior | |
4067 /acute /mu /paragraph /periodcentered | |
4068 /cedilla /onesuperior /ordmasculine /guillemotright | |
4069 /onequarter /onehalf /threequarters /questiondown | |
4070 % 0300 (192) | |
4071 /Agrave /Aacute /Acircumflex /Atilde | |
4072 /Adieresis /Aring /AE /Ccedilla | |
4073 /Egrave /Eacute /Ecircumflex /Edieresis | |
4074 /Igrave /Iacute /Icircumflex /Idieresis | |
4075 /Eth /Ntilde /Ograve /Oacute | |
4076 /Ocircumflex /Otilde /Odieresis /multiply | |
4077 /Oslash /Ugrave /Uacute /Ucircumflex | |
4078 /Udieresis /Yacute /Thorn /germandbls | |
4079 % 0340 (224) | |
4080 /agrave /aacute /acircumflex /atilde | |
4081 /adieresis /aring /ae /ccedilla | |
4082 /egrave /eacute /ecircumflex /edieresis | |
4083 /igrave /iacute /icircumflex /idieresis | |
4084 /eth /ntilde /ograve /oacute | |
4085 /ocircumflex /otilde /odieresis /divide | |
4086 /oslash /ugrave /uacute /ucircumflex | |
4087 /udieresis /yacute /thorn /ydieresis | |
4088 256 packedarray def | |
4089 }ifelse | |
4090 | |
4091 /reencodeFontISO %def | |
4092 {dup | |
4093 length 12 add dict % Make a new font (a new dict the same size | |
4094 % as the old one) with room for our new symbols. | |
4095 | |
4096 begin % Make the new font the current dictionary. | |
4097 {1 index /FID ne | |
4098 {def}{pop pop}ifelse | |
4099 }forall % Copy each of the symbols from the old dictionary | |
4100 % to the new one except for the font ID. | |
4101 | |
4102 currentdict /FontType get 0 ne | |
4103 {/Encoding ISOLatin1Encoding def}if % Override the encoding with | |
4104 % the ISOLatin1 encoding. | |
4105 | |
4106 % Use the font's bounding box to determine the ascent, descent, | |
4107 % and overall height; don't forget that these values have to be | |
4108 % transformed using the font's matrix. | |
4109 | |
4110 % ^ (x2 y2) | |
4111 % | | | |
4112 % | v | |
4113 % | +----+ - - | |
4114 % | | | ^ | |
4115 % | | | | Ascent (usually > 0) | |
4116 % | | | | | |
4117 % (0 0) -> +--+----+--------> | |
4118 % | | | | |
4119 % | | v Descent (usually < 0) | |
4120 % (x1 y1) --> +----+ - - | |
4121 | |
4122 currentdict /FontType get 0 ne | |
4123 {/FontBBox load aload pop % -- x1 y1 x2 y2 | |
4124 FontMatrix transform /Ascent exch def pop | |
4125 FontMatrix transform /Descent exch def pop} | |
4126 {/PrimaryFont FDepVector 0 get def | |
4127 PrimaryFont /FontBBox get aload pop | |
4128 PrimaryFont /FontMatrix get transform /Ascent exch def pop | |
4129 PrimaryFont /FontMatrix get transform /Descent exch def pop | |
4130 }ifelse | |
4131 | |
4132 /FontHeight Ascent Descent sub def % use `sub' because descent < 0 | |
4133 | |
4134 % Define these in case they're not in the FontInfo | |
4135 % (also, here they're easier to get to). | |
4136 /UnderlinePosition Descent 0.70 mul def | |
4137 /OverlinePosition Descent UnderlinePosition sub Ascent add def | |
4138 /StrikeoutPosition Ascent 0.30 mul def | |
4139 /LineThickness FontHeight 0.05 mul def | |
4140 /Xshadow FontHeight 0.08 mul def | |
4141 /Yshadow FontHeight -0.09 mul def | |
4142 /SpaceBackground Descent neg UnderlinePosition add def | |
4143 /XBox Descent neg def | |
4144 /YBox LineThickness 0.7 mul def | |
4145 | |
4146 currentdict % Leave the new font on the stack | |
4147 end % Stop using the font as the current dictionary | |
4148 definefont % Put the font into the font dictionary | |
4149 pop % Discard the returned font | |
4150 }bind def | |
4151 | |
4152 % Font definition | |
4153 /DefFont{findfont exch scalefont reencodeFontISO}def | |
4154 | |
4155 % Font selection | |
4156 /F | |
4157 {findfont | |
4158 dup /Ascent get /Ascent exch def | |
4159 dup /Descent get /Descent exch def | |
4160 dup /FontHeight get /FontHeight exch def | |
4161 dup /UnderlinePosition get /UnderlinePosition exch def | |
4162 dup /OverlinePosition get /OverlinePosition exch def | |
4163 dup /StrikeoutPosition get /StrikeoutPosition exch def | |
4164 dup /LineThickness get /LineThickness exch def | |
4165 dup /Xshadow get /Xshadow exch def | |
4166 dup /Yshadow get /Yshadow exch def | |
4167 dup /SpaceBackground get /SpaceBackground exch def | |
4168 dup /XBox get /XBox exch def | |
4169 dup /YBox get /YBox exch def | |
4170 setfont | |
4171 }def | |
4172 | |
4173 /BG | |
4174 {dup /bg exch def | |
4175 {mark 4 1 roll ]} | |
4176 {[ 1.0 1.0 1.0 ]} | |
4177 ifelse | |
4178 /bgcolor exch def | |
4179 }def | |
4180 | |
4181 % stack: -- | |
4182 /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def | |
4183 | |
4184 % stack: fill-or-not lower-x lower-y upper-x upper-y |- -- | |
4185 /doRect | |
4186 {/rYY exch def | |
4187 /rXX exch def | |
4188 /ryy exch def | |
4189 /rxx exch def | |
4190 gsave | |
4191 newpath | |
4192 rXX rYY moveto | |
4193 rxx rYY lineto | |
4194 rxx ryy lineto | |
4195 rXX ryy lineto | |
4196 closepath | |
4197 % top of stack: fill-or-not | |
4198 {FillBgColor} | |
4199 {LineThickness setlinewidth stroke} | |
4200 ifelse | |
4201 grestore | |
4202 }bind def | |
4203 | |
4204 % stack: string fill-or-not |- -- | |
4205 /doOutline | |
4206 {/-fillp- exch def | |
4207 /-ox- currentpoint /-oy- exch def def | |
4208 gsave | |
4209 LineThickness setlinewidth | |
4210 {st 0 3 -1 roll put | |
4211 st dup true charpath | |
4212 -fillp- {gsave FillBgColor grestore}if | |
4213 stroke stringwidth | |
4214 -oy- add /-oy- exch def | |
4215 -ox- add /-ox- exch def | |
4216 -ox- -oy- moveto | |
4217 }forall | |
4218 grestore | |
4219 -ox- -oy- moveto | |
4220 }bind def | |
4221 | |
4222 % stack: fill-or-not delta |- -- | |
4223 /doBox | |
4224 {/dd exch def | |
4225 xx XBox sub dd sub yy YBox sub dd sub | |
4226 XX XBox add dd add YY YBox add dd add | |
4227 doRect | |
4228 }bind def | |
4229 | |
4230 % stack: string |- -- | |
4231 /doShadow | |
4232 {gsave | |
4233 Xshadow Yshadow rmoveto | |
4234 false doOutline | |
4235 grestore | |
4236 }bind def | |
4237 | |
4238 % stack: position |- -- | |
4239 /Hline | |
4240 {currentpoint exch pop add dup | |
4241 gsave | |
4242 newpath | |
4243 xx exch moveto | |
4244 XX exch lineto | |
4245 closepath | |
4246 LineThickness setlinewidth stroke | |
4247 grestore | |
4248 }bind def | |
4249 | |
4250 % stack: string |- -- | |
4251 % effect: 1 - underline 2 - strikeout 4 - overline | |
4252 % 8 - shadow 16 - box 32 - outline | |
4253 /S | |
4254 {/xx currentpoint dup Descent add /yy exch def | |
4255 Ascent add /YY exch def def | |
4256 dup stringwidth pop xx add /XX exch def | |
4257 Effect 8 and 0 ne | |
4258 {/yy yy Yshadow add def | |
4259 /XX XX Xshadow add def | |
4260 }if | |
4261 bg | |
4262 {true | |
4263 Effect 16 and 0 ne | |
4264 {SpaceBackground doBox} | |
4265 {xx yy XX YY doRect} | |
4266 ifelse | |
4267 }if % background | |
4268 Effect 16 and 0 ne{false 0 doBox}if % box | |
4269 Effect 8 and 0 ne{dup doShadow}if % shadow | |
4270 Effect 32 and 0 ne | |
4271 {true doOutline} % outline | |
4272 {show} % normal text | |
4273 ifelse | |
4274 Effect 1 and 0 ne{UnderlinePosition Hline}if % underline | |
4275 Effect 2 and 0 ne{StrikeoutPosition Hline}if % strikeout | |
4276 Effect 4 and 0 ne{OverlinePosition Hline}if % overline | |
4277 }bind def | |
4278 | |
4279 " | |
4280 "EBNF EPS prologue") | |
4281 | |
4282 | |
4283 (defconst ebnf-eps-begin | |
4284 " | |
4285 end | |
4286 | |
4287 % x y #ebnf2ps#begin | |
4288 /#ebnf2ps#begin | |
4289 {#ebnf2ps#dict begin /#ebnf2ps#save save def | |
4290 moveto false BG 0.0 0.0 0.0 setrgbcolor}def | |
4291 | |
4292 /#ebnf2ps#end{showpage #ebnf2ps#save restore end}def | |
4293 | |
39342
73061d0eb82e
Replace "Prologue" by "Prolog" in PostScript
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
4294 %%EndProlog |
27451 | 4295 " |
4296 "EBNF EPS begin") | |
4297 | |
4298 | |
4299 (defconst ebnf-eps-end | |
4300 "#ebnf2ps#end | |
4301 %%EOF | |
4302 " | |
4303 "EBNF EPS end") | |
4304 | |
4305 | |
4306 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4307 ;; Header & Footer |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4308 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4309 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4310 (defun ebnf-eps-header-footer (value) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4311 ;; evaluate header/footer value |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4312 ;; return a string or nil |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4313 (let ((tmp (if (symbolp value) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4314 (cond ((fboundp value) (funcall value)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4315 ((boundp value) (symbol-value value)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4316 (t nil)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4317 value))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4318 (and (stringp tmp) tmp))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4319 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4320 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4321 (defun ebnf-eps-header () |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4322 ;; evaluate header value |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4323 (ebnf-eps-header-footer ebnf-eps-header)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4324 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4325 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4326 (defun ebnf-eps-footer () |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4327 ;; evaluate footer value |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4328 (ebnf-eps-header-footer ebnf-eps-footer)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4329 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4330 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4331 ;; hacked fom `ps-output-string-prim' (ps-print.el) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4332 (defun ebnf-eps-string (string) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4333 (let* ((str (string-as-unibyte string)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4334 (len (length str)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4335 (index 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4336 (new "(") ; insert start-string delimiter |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4337 start special) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4338 ;; Find and quote special characters as necessary for PS |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4339 ;; This skips everything except control chars, non-ASCII chars, (, ) and \. |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4340 (while (setq start (string-match "[^]-~ -'*-[]" str index)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4341 (setq special (aref str start) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4342 new (concat new |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4343 (substring str index start) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4344 (if (and (<= 0 special) (<= special 255)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4345 (aref ps-string-escape-codes special) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4346 ;; insert hexadecimal representation if character |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4347 ;; code is out of range |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4348 (format "\\%04X" special))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4349 index (1+ start))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4350 (concat new |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4351 (and (< index len) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4352 (substring str index len)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4353 ")"))) ; insert end-string delimiter |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4354 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4355 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4356 (defun ebnf-eps-header-footer-comment (str) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4357 ;; parse header/footer comment string |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4358 (let ((len (1- (length str))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4359 (index 0) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4360 new start fmt) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4361 (while (setq start (string-match "%" str index)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4362 (setq fmt (if (< start len) (aref str (1+ start)) ?\?) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4363 new (concat new |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4364 (substring str index start) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4365 (cond ((= fmt ?%) "%") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4366 ((= fmt ?H) (ebnf-eps-header)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4367 ((= fmt ?F) (ebnf-eps-footer)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4368 (t nil) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4369 )) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4370 index (+ start 2))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4371 (ebnf-eps-string (concat new |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4372 (and (<= index len) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4373 (substring str index (1+ len))))))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4374 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4375 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4376 (defun ebnf-eps-header-footer-p (value) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4377 ;; return t if value is non-nil and is not an empty string |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4378 (not (or (null value) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4379 (and (stringp value) (string= value ""))))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4380 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4381 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4382 (defun ebnf-eps-header-comment (str) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4383 ;; set header comment if header is on |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4384 (when (ebnf-eps-header-footer-p ebnf-eps-header) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4385 (setq ebnf-eps-header-comment (ebnf-eps-header-footer-comment str)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4386 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4387 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4388 (defun ebnf-eps-footer-comment (str) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4389 ;; set footer comment if footer is on |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4390 (when (ebnf-eps-header-footer-p ebnf-eps-footer) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4391 (setq ebnf-eps-footer-comment (ebnf-eps-header-footer-comment str)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4392 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4393 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4394 (defun ebnf-eps-header-footer-file (filename) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4395 ;; associate header and footer with a filename |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4396 (let ((filehf (assoc filename ebnf-eps-file-alist)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4397 (header (or ebnf-eps-header-comment (ebnf-eps-header))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4398 (footer (or ebnf-eps-footer-comment (ebnf-eps-footer)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4399 (if (null filehf) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4400 (setq ebnf-eps-file-alist (cons (list filename header footer) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4401 ebnf-eps-file-alist)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4402 (setcar (nthcdr 1 filehf) header) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4403 (setcar (nthcdr 2 filehf) footer)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4404 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4405 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4406 (defun ebnf-eps-header-footer-set (filename) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4407 ;; set header and footer from a filename |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4408 (let ((header-footer (assoc filename ebnf-eps-file-alist))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4409 (setq ebnf-eps-header-comment (nth 1 header-footer) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4410 ebnf-eps-footer-comment (nth 2 header-footer)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4411 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4412 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4413 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
27451 | 4414 ;; Formatting |
4415 | |
4416 | |
4417 (defvar ebnf-format-float "%1.3f") | |
4418 | |
4419 | |
4420 (defun ebnf-format-float (&rest floats) | |
4421 (mapconcat | |
4422 #'(lambda (float) | |
4423 (format ebnf-format-float float)) | |
4424 floats | |
4425 " ")) | |
4426 | |
4427 | |
4428 (defun ebnf-format-color (format-str color default) | |
4429 (let* ((the-color (or color default)) | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
4430 (rgb (ps-color-scale the-color))) |
27451 | 4431 (format format-str |
4432 (concat "[" | |
4433 (ebnf-format-float (nth 0 rgb) (nth 1 rgb) (nth 2 rgb)) | |
4434 "]") | |
4435 the-color))) | |
4436 | |
4437 | |
4438 (defvar ebnf-message-float "%3.2f") | |
4439 | |
4440 | |
4441 (defsubst ebnf-message-float (format-str value) | |
4442 (message format-str | |
4443 (format ebnf-message-float value))) | |
4444 | |
4445 | |
52168
282da92e75ee
Move defvar before first use.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52163
diff
changeset
|
4446 (defvar ebnf-total 0) |
282da92e75ee
Move defvar before first use.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52163
diff
changeset
|
4447 (defvar ebnf-nprod 0) |
282da92e75ee
Move defvar before first use.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52163
diff
changeset
|
4448 |
282da92e75ee
Move defvar before first use.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52163
diff
changeset
|
4449 |
27451 | 4450 (defsubst ebnf-message-info (messag) |
4451 (message "%s...%3d%%" | |
4452 messag | |
4453 (round (/ (* (setq ebnf-nprod (1+ ebnf-nprod)) 100.0) ebnf-total)))) | |
4454 | |
4455 | |
4456 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4457 ;; Macros | |
4458 | |
4459 | |
4460 (defmacro ebnf-node-kind (vec &optional value) | |
4461 (if value | |
4462 `(aset ,vec 0 ,value) | |
4463 `(aref ,vec 0))) | |
4464 | |
4465 | |
4466 (defmacro ebnf-node-width-func (node width) | |
4467 `(funcall (aref ,node 1) ,node ,width)) | |
4468 | |
4469 | |
4470 (defmacro ebnf-node-dimension-func (node &optional value) | |
4471 (if value | |
4472 `(aset ,node 2 ,value) | |
4473 `(funcall (aref ,node 2) ,node))) | |
4474 | |
4475 | |
4476 (defmacro ebnf-node-entry (vec &optional value) | |
4477 (if value | |
4478 `(aset ,vec 3 ,value) | |
4479 `(aref ,vec 3))) | |
4480 | |
4481 | |
4482 (defmacro ebnf-node-height (vec &optional value) | |
4483 (if value | |
4484 `(aset ,vec 4 ,value) | |
4485 `(aref ,vec 4))) | |
4486 | |
4487 | |
4488 (defmacro ebnf-node-width (vec &optional value) | |
4489 (if value | |
4490 `(aset ,vec 5 ,value) | |
4491 `(aref ,vec 5))) | |
4492 | |
4493 | |
4494 (defmacro ebnf-node-name (vec) | |
4495 `(aref ,vec 6)) | |
4496 | |
4497 | |
4498 (defmacro ebnf-node-list (vec &optional value) | |
4499 (if value | |
4500 `(aset ,vec 6 ,value) | |
4501 `(aref ,vec 6))) | |
4502 | |
4503 | |
4504 (defmacro ebnf-node-default (vec) | |
4505 `(aref ,vec 7)) | |
4506 | |
4507 | |
4508 (defmacro ebnf-node-production (vec &optional value) | |
4509 (if value | |
4510 `(aset ,vec 7 ,value) | |
4511 `(aref ,vec 7))) | |
4512 | |
4513 | |
4514 (defmacro ebnf-node-separator (vec &optional value) | |
4515 (if value | |
4516 `(aset ,vec 7 ,value) | |
4517 `(aref ,vec 7))) | |
4518 | |
4519 | |
4520 (defmacro ebnf-node-action (vec &optional value) | |
4521 (if value | |
4522 `(aset ,vec 8 ,value) | |
4523 `(aref ,vec 8))) | |
4524 | |
4525 | |
4526 (defmacro ebnf-node-generation (node) | |
4527 `(funcall (ebnf-node-kind ,node) ,node)) | |
4528 | |
4529 | |
4530 (defmacro ebnf-max-width (prod) | |
4531 `(max (ebnf-node-width ,prod) | |
4532 (+ (* (length (ebnf-node-name ,prod)) | |
4533 ebnf-font-width-P) | |
4534 ebnf-production-horizontal-space))) | |
4535 | |
4536 | |
4537 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4538 ;; PostScript generation | |
4539 | |
4540 | |
4541 (defun ebnf-generate-eps (ebnf-tree) | |
4542 (let* ((ps-color-p (and ebnf-color-p (ps-color-device))) | |
4543 (ps-print-color-scale (if ps-color-p | |
4544 (float (car (ps-color-values "white"))) | |
4545 1.0)) | |
4546 (ebnf-total (length ebnf-tree)) | |
4547 (ebnf-nprod 0) | |
4548 (old-ps-output (symbol-function 'ps-output)) | |
4549 (old-ps-output-string (symbol-function 'ps-output-string)) | |
4550 (eps-buffer (get-buffer-create ebnf-eps-buffer-name)) | |
4551 ebnf-debug-ps error-msg horizontal | |
4552 prod prod-name prod-width prod-height prod-list file-list) | |
4553 ;; redefines `ps-output' and `ps-output-string' | |
4554 (defalias 'ps-output 'ebnf-eps-output) | |
4555 (defalias 'ps-output-string 'ps-output-string-prim) | |
4556 ;; generate EPS file | |
4557 (save-excursion | |
4558 (condition-case data | |
4559 (progn | |
4560 (while ebnf-tree | |
4561 (setq prod (car ebnf-tree) | |
4562 prod-name (ebnf-node-name prod) | |
4563 prod-width (ebnf-max-width prod) | |
4564 prod-height (ebnf-node-height prod) | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
4565 horizontal (memq (ebnf-node-action prod) |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
4566 ebnf-action-list)) |
27451 | 4567 ;; generate production in EPS buffer |
4568 (save-excursion | |
4569 (set-buffer eps-buffer) | |
4570 (setq ebnf-eps-upper-x 0.0 | |
4571 ebnf-eps-upper-y 0.0 | |
4572 ebnf-eps-max-width prod-width | |
4573 ebnf-eps-max-height prod-height) | |
4574 (ebnf-generate-production prod)) | |
4575 (if (setq prod-list (cdr (assoc prod-name | |
4576 ebnf-eps-production-list))) | |
4577 ;; insert EPS buffer in all buffer associated with production | |
4578 (ebnf-eps-production-list prod-list 'file-list horizontal | |
4579 prod-width prod-height eps-buffer) | |
4580 ;; write EPS file for production | |
4581 (ebnf-eps-finish-and-write eps-buffer | |
4582 (ebnf-eps-filename prod-name))) | |
4583 ;; prepare for next loop | |
4584 (save-excursion | |
4585 (set-buffer eps-buffer) | |
4586 (erase-buffer)) | |
4587 (setq ebnf-tree (cdr ebnf-tree))) | |
4588 ;; write and kill temporary buffers | |
4589 (ebnf-eps-write-kill-temp file-list t) | |
4590 (setq file-list nil)) | |
4591 ;; handler | |
4592 ((quit error) | |
4593 (setq error-msg (error-message-string data))))) | |
4594 ;; restore `ps-output' and `ps-output-string' | |
4595 (defalias 'ps-output old-ps-output) | |
4596 (defalias 'ps-output-string old-ps-output-string) | |
4597 ;; kill temporary buffers | |
4598 (kill-buffer eps-buffer) | |
4599 (ebnf-eps-write-kill-temp file-list nil) | |
4600 (and error-msg (error error-msg)) | |
4601 (message " "))) | |
4602 | |
4603 | |
4604 ;; write and kill temporary buffers | |
4605 (defun ebnf-eps-write-kill-temp (file-list write-p) | |
4606 (while file-list | |
4607 (let ((buffer (get-buffer (concat " *" (car file-list) "*")))) | |
4608 (when buffer | |
4609 (and write-p | |
4610 (ebnf-eps-finish-and-write buffer (car file-list))) | |
4611 (kill-buffer buffer))) | |
4612 (setq file-list (cdr file-list)))) | |
4613 | |
4614 | |
4615 ;; insert EPS buffer in all buffer associated with production | |
4616 (defun ebnf-eps-production-list (prod-list file-list-sym horizontal | |
4617 prod-width prod-height eps-buffer) | |
4618 (while prod-list | |
4619 (add-to-list file-list-sym (car prod-list)) | |
4620 (save-excursion | |
4621 (set-buffer (get-buffer-create (concat " *" (car prod-list) "*"))) | |
4622 (goto-char (point-max)) | |
4623 (cond | |
4624 ;; first production | |
4625 ((zerop (buffer-size)) | |
4626 (setq ebnf-eps-upper-x 0.0 | |
4627 ebnf-eps-upper-y 0.0 | |
4628 ebnf-eps-max-width prod-width | |
4629 ebnf-eps-max-height prod-height)) | |
4630 ;; horizontal | |
4631 (horizontal | |
4632 (ebnf-eop-horizontal ebnf-eps-prod-width) | |
4633 (setq ebnf-eps-max-width (+ ebnf-eps-max-width | |
4634 ebnf-production-horizontal-space | |
4635 prod-width) | |
4636 ebnf-eps-max-height (max ebnf-eps-max-height prod-height))) | |
4637 ;; vertical | |
4638 (t | |
4639 (ebnf-eop-vertical ebnf-eps-max-height) | |
4640 (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width) | |
4641 ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y) | |
4642 ebnf-eps-max-height | |
4643 (+ ebnf-eps-upper-y | |
4644 ebnf-production-vertical-space | |
4645 ebnf-eps-max-height)) | |
4646 ebnf-eps-max-width prod-width | |
4647 ebnf-eps-max-height prod-height)) | |
4648 ) | |
4649 (setq ebnf-eps-prod-width prod-width) | |
65793
acecec3cf059
(ebnf-eps-production-list): Use insert-buffer-substring.
Richard M. Stallman <rms@gnu.org>
parents:
65584
diff
changeset
|
4650 (insert-buffer-substring eps-buffer)) |
27451 | 4651 (setq prod-list (cdr prod-list)))) |
4652 | |
4653 | |
4654 (defun ebnf-generate (ebnf-tree) | |
4655 (let* ((ps-color-p (and ebnf-color-p (ps-color-device))) | |
4656 (ps-print-color-scale (if ps-color-p | |
4657 (float (car (ps-color-values "white"))) | |
4658 1.0)) | |
4659 ps-zebra-stripes ps-line-number ps-razzle-dazzle | |
4660 ps-print-hook | |
4661 ps-print-begin-sheet-hook | |
4662 ps-print-begin-page-hook | |
4663 ps-print-begin-column-hook) | |
4664 (ps-generate (current-buffer) (point-min) (point-max) | |
4665 'ebnf-generate-postscript))) | |
4666 | |
4667 | |
4668 (defvar ebnf-tree nil) | |
4669 (defvar ebnf-direction "R") | |
4670 | |
4671 | |
4672 (defun ebnf-generate-postscript (from to) | |
4673 (ebnf-begin-file) | |
4674 (if ebnf-horizontal-max-height | |
4675 (ebnf-generate-with-max-height) | |
4676 (ebnf-generate-without-max-height)) | |
4677 (message " ")) | |
4678 | |
4679 | |
4680 (defun ebnf-generate-with-max-height () | |
4681 (let ((ebnf-total (length ebnf-tree)) | |
4682 (ebnf-nprod 0) | |
4683 next-line max-height prod the-width) | |
4684 (while ebnf-tree | |
4685 ;; find next line point | |
4686 (setq next-line ebnf-tree | |
4687 prod (car ebnf-tree) | |
4688 max-height (ebnf-node-height prod)) | |
4689 (ebnf-begin-line prod (ebnf-max-width prod)) | |
4690 (while (and (setq next-line (cdr next-line)) | |
4691 (setq prod (car next-line)) | |
4692 (memq (ebnf-node-action prod) ebnf-action-list) | |
4693 (setq the-width (ebnf-max-width prod)) | |
4694 (<= the-width ps-width-remaining)) | |
4695 (setq max-height (max max-height (ebnf-node-height prod)) | |
4696 ps-width-remaining (- ps-width-remaining | |
4697 (+ the-width | |
4698 ebnf-production-horizontal-space)))) | |
4699 ;; generate current line | |
4700 (ebnf-newline max-height) | |
4701 (setq prod (car ebnf-tree)) | |
4702 (ebnf-generate-production prod) | |
4703 (while (not (eq (setq ebnf-tree (cdr ebnf-tree)) next-line)) | |
4704 (ebnf-eop-horizontal (ebnf-max-width prod)) | |
4705 (setq prod (car ebnf-tree)) | |
4706 (ebnf-generate-production prod)) | |
4707 (ebnf-eop-vertical max-height)))) | |
4708 | |
4709 | |
4710 (defun ebnf-generate-without-max-height () | |
4711 (let ((ebnf-total (length ebnf-tree)) | |
4712 (ebnf-nprod 0) | |
4713 max-height prod bef-width cur-width) | |
4714 (while ebnf-tree | |
4715 ;; generate current line | |
4716 (setq prod (car ebnf-tree) | |
4717 max-height (ebnf-node-height prod) | |
4718 bef-width (ebnf-max-width prod)) | |
4719 (ebnf-begin-line prod bef-width) | |
4720 (ebnf-generate-production prod) | |
4721 (while (and (setq ebnf-tree (cdr ebnf-tree)) | |
4722 (setq prod (car ebnf-tree)) | |
4723 (memq (ebnf-node-action prod) ebnf-action-list) | |
4724 (setq cur-width (ebnf-max-width prod)) | |
4725 (<= cur-width ps-width-remaining) | |
4726 (<= (ebnf-node-height prod) ps-height-remaining)) | |
4727 (ebnf-eop-horizontal bef-width) | |
4728 (ebnf-generate-production prod) | |
4729 (setq bef-width cur-width | |
4730 max-height (max max-height (ebnf-node-height prod)) | |
4731 ps-width-remaining (- ps-width-remaining | |
4732 (+ cur-width | |
4733 ebnf-production-horizontal-space)))) | |
4734 (ebnf-eop-vertical max-height) | |
4735 ;; prepare next line | |
4736 (ebnf-newline max-height)))) | |
4737 | |
4738 | |
4739 (defun ebnf-begin-line (prod width) | |
4740 (and (or (eq (ebnf-node-action prod) 'form-feed) | |
4741 (> (ebnf-node-height prod) ps-height-remaining)) | |
4742 (ebnf-new-page)) | |
4743 (setq ps-width-remaining (- ps-width-remaining | |
4744 (+ width | |
4745 ebnf-production-horizontal-space)))) | |
4746 | |
4747 | |
4748 (defun ebnf-newline (height) | |
4749 (and (> height ps-height-remaining) | |
4750 (ebnf-new-page)) | |
4751 (setq ps-width-remaining ps-print-width | |
4752 ps-height-remaining (- ps-height-remaining | |
4753 (+ height | |
4754 ebnf-production-vertical-space)))) | |
4755 | |
4756 | |
4757 ;; [production width-fun dim-fun entry height width name production action] | |
4758 (defun ebnf-generate-production (production) | |
4759 (ebnf-message-info "Generating") | |
4760 (run-hooks 'ebnf-production-hook) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4761 (ps-output-string (if ebnf-production-name-p |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4762 (ebnf-node-name production) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4763 "")) |
27451 | 4764 (ps-output " " |
4765 (ebnf-format-float | |
4766 (ebnf-node-width production) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4767 (+ (if ebnf-production-name-p |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4768 ebnf-basic-height |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4769 0.0) |
27451 | 4770 (ebnf-node-entry (ebnf-node-production production)))) |
4771 " BOP\n") | |
4772 (ebnf-node-generation (ebnf-node-production production)) | |
4773 (ps-output "EOS\n")) | |
4774 | |
4775 | |
4776 ;; [alternative width-fun dim-fun entry height width list] | |
4777 (defun ebnf-generate-alternative (alternative) | |
4778 (let ((alt (ebnf-node-list alternative)) | |
4779 (entry (ebnf-node-entry alternative)) | |
4780 (nlist 0) | |
4781 alt-height alt-entry) | |
4782 (while alt | |
4783 (ps-output (ebnf-format-float (- entry (ebnf-node-entry (car alt)))) | |
4784 " ") | |
4785 (setq entry (- entry (ebnf-node-height (car alt)) ebnf-vertical-space) | |
4786 nlist (1+ nlist) | |
4787 alt (cdr alt))) | |
4788 (ps-output (format "%d " nlist) | |
4789 (ebnf-format-float (ebnf-node-width alternative)) | |
4790 " AT\n") | |
4791 (setq alt (ebnf-node-list alternative)) | |
4792 (when alt | |
4793 (ebnf-node-generation (car alt)) | |
4794 (setq alt-height (- (ebnf-node-height (car alt)) | |
4795 (ebnf-node-entry (car alt))))) | |
4796 (while (setq alt (cdr alt)) | |
4797 (setq alt-entry (ebnf-node-entry (car alt))) | |
4798 (ebnf-vertical-movement | |
4799 (- (+ alt-height ebnf-vertical-space alt-entry))) | |
4800 (ebnf-node-generation (car alt)) | |
4801 (setq alt-height (- (ebnf-node-height (car alt)) alt-entry)))) | |
4802 (ps-output "EOS\n")) | |
4803 | |
4804 | |
4805 ;; [sequence width-fun dim-fun entry height width list] | |
4806 (defun ebnf-generate-sequence (sequence) | |
4807 (ps-output "BOS\n") | |
4808 (let ((seq (ebnf-node-list sequence)) | |
4809 seq-width) | |
4810 (when seq | |
4811 (ebnf-node-generation (car seq)) | |
4812 (setq seq-width (ebnf-node-width (car seq)))) | |
4813 (while (setq seq (cdr seq)) | |
4814 (ebnf-horizontal-movement seq-width) | |
4815 (ebnf-node-generation (car seq)) | |
4816 (setq seq-width (ebnf-node-width (car seq))))) | |
4817 (ps-output "EOS\n")) | |
4818 | |
4819 | |
4820 ;; [terminal width-fun dim-fun entry height width name] | |
4821 (defun ebnf-generate-terminal (terminal) | |
4822 (ebnf-gen-terminal terminal "T")) | |
4823 | |
4824 | |
4825 ;; [non-terminal width-fun dim-fun entry height width name] | |
4826 (defun ebnf-generate-non-terminal (non-terminal) | |
4827 (ebnf-gen-terminal non-terminal "NT")) | |
4828 | |
4829 | |
4830 ;; [empty width-fun dim-fun entry height width] | |
4831 (defun ebnf-generate-empty (empty) | |
4832 (ebnf-empty-alternative (ebnf-node-width empty))) | |
4833 | |
4834 | |
4835 ;; [optional width-fun dim-fun entry height width element] | |
4836 (defun ebnf-generate-optional (optional) | |
4837 (let ((the-optional (ebnf-node-list optional))) | |
4838 (ps-output (ebnf-format-float | |
4839 (+ (- (ebnf-node-height the-optional) | |
4840 (ebnf-node-entry optional)) | |
4841 ebnf-vertical-space) | |
4842 (ebnf-node-width optional)) | |
4843 " OP\n") | |
4844 (ebnf-node-generation the-optional) | |
4845 (ps-output "EOS\n"))) | |
4846 | |
4847 | |
4848 ;; [one-or-more width-fun dim-fun entry height width element separator] | |
4849 (defun ebnf-generate-one-or-more (one-or-more) | |
4850 (let* ((width (ebnf-node-width one-or-more)) | |
4851 (sep (ebnf-node-separator one-or-more)) | |
4852 (entry (- (ebnf-node-entry one-or-more) | |
4853 (if sep | |
4854 (ebnf-node-entry sep) | |
4855 0)))) | |
4856 (ps-output (ebnf-format-float entry width) | |
4857 " OM\n") | |
4858 (ebnf-node-generation (ebnf-node-list one-or-more)) | |
4859 (ebnf-vertical-movement entry) | |
4860 (if sep | |
4861 (let ((ebnf-direction "L")) | |
4862 (ebnf-node-generation sep)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4863 (ebnf-empty-alternative (- width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4864 ebnf-horizontal-space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4865 ebnf-basic-width-extra)))) |
27451 | 4866 (ps-output "EOS\n")) |
4867 | |
4868 | |
4869 ;; [zero-or-more width-fun dim-fun entry height width element separator] | |
4870 (defun ebnf-generate-zero-or-more (zero-or-more) | |
4871 (let* ((width (ebnf-node-width zero-or-more)) | |
4872 (node-list (ebnf-node-list zero-or-more)) | |
4873 (list-entry (ebnf-node-entry node-list)) | |
4874 (node-sep (ebnf-node-separator zero-or-more)) | |
4875 (entry (+ list-entry | |
4876 ebnf-vertical-space | |
4877 (if node-sep | |
4878 (- (ebnf-node-height node-sep) | |
4879 (ebnf-node-entry node-sep)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4880 ebnf-basic-empty-height)))) |
27451 | 4881 (ps-output (ebnf-format-float entry |
4882 (+ (- (ebnf-node-height node-list) | |
4883 list-entry) | |
4884 ebnf-vertical-space) | |
4885 width) | |
4886 " ZM\n") | |
4887 (ebnf-node-generation (ebnf-node-list zero-or-more)) | |
4888 (ebnf-vertical-movement entry) | |
4889 (if (ebnf-node-separator zero-or-more) | |
4890 (let ((ebnf-direction "L")) | |
4891 (ebnf-node-generation (ebnf-node-separator zero-or-more))) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4892 (ebnf-empty-alternative (- width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4893 ebnf-horizontal-space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
4894 ebnf-basic-width-extra)))) |
27451 | 4895 (ps-output "EOS\n")) |
4896 | |
4897 | |
4898 ;; [special width-fun dim-fun entry height width name] | |
4899 (defun ebnf-generate-special (special) | |
4900 (ebnf-gen-terminal special "SP")) | |
4901 | |
4902 | |
4903 ;; [repeat width-fun dim-fun entry height width times element] | |
4904 (defun ebnf-generate-repeat (repeat) | |
4905 (let ((times (ebnf-node-name repeat)) | |
4906 (element (ebnf-node-separator repeat))) | |
4907 (ps-output-string times) | |
4908 (ps-output " " | |
4909 (ebnf-format-float | |
4910 (ebnf-node-entry repeat) | |
4911 (ebnf-node-height repeat) | |
4912 (ebnf-node-width repeat) | |
4913 (if element | |
4914 (+ (ebnf-node-width element) | |
4915 ebnf-space-R ebnf-space-R ebnf-space-R | |
4916 (* (length times) ebnf-font-width-R)) | |
4917 0.0)) | |
4918 " " ebnf-direction "RP\n") | |
4919 (and element | |
4920 (ebnf-node-generation element))) | |
4921 (ps-output "EOS\n")) | |
4922 | |
4923 | |
4924 ;; [except width-fun dim-fun entry height width element element] | |
4925 (defun ebnf-generate-except (except) | |
4926 (let* ((element (ebnf-node-list except)) | |
4927 (exception (ebnf-node-separator except)) | |
4928 (width (ebnf-node-width element))) | |
4929 (ps-output (ebnf-format-float | |
4930 width | |
4931 (ebnf-node-entry except) | |
4932 (ebnf-node-height except) | |
4933 (ebnf-node-width except) | |
4934 (+ width | |
4935 ebnf-space-E ebnf-space-E ebnf-space-E | |
4936 ebnf-font-width-E | |
4937 (if exception | |
4938 (+ (ebnf-node-width exception) ebnf-space-E) | |
4939 0.0))) | |
4940 " " ebnf-direction "EX\n") | |
4941 (ebnf-node-generation (ebnf-node-list except)) | |
4942 (when exception | |
4943 (ebnf-horizontal-movement (+ width ebnf-space-E | |
4944 ebnf-font-width-E ebnf-space-E)) | |
4945 (ebnf-node-generation exception))) | |
4946 (ps-output "EOS\n")) | |
4947 | |
4948 | |
4949 (defun ebnf-gen-terminal (node code) | |
4950 (ps-output-string (ebnf-node-name node)) | |
4951 (ps-output " " (ebnf-format-float (ebnf-node-width node)) | |
4952 " " ebnf-direction code | |
4953 (if (ebnf-node-default node) | |
4954 "D\n" | |
4955 "\n"))) | |
4956 | |
4957 | |
4958 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4959 ;; Internal functions | |
4960 | |
4961 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4962 (defun ebnf-directory (fun &optional directory) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4963 "Process files in DIRECTORY applying function FUN on each file. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4964 |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
4965 If DIRECTORY is nil, use `default-directory'. |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
4966 |
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
4967 Only files in DIRECTORY that match `ebnf-file-suffix-regexp' (which see) are |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4968 processed." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4969 (let ((files (directory-files (or directory default-directory) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4970 t ebnf-file-suffix-regexp))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4971 (while files |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4972 (set-buffer (find-file-noselect (car files))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4973 (funcall fun) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4974 (setq buffer-backed-up t) ; Do not back it up. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4975 (save-buffer) ; Just save new version. |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4976 (kill-buffer (current-buffer)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4977 (setq files (cdr files))))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4978 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4979 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4980 (defun ebnf-file (fun file &optional do-not-kill-buffer-when-done) |
75605
c33174e3988a
(ebnf-eps-buffer, ebnf-eps-region)
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
4981 "Process the named FILE applying function FUN. |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4982 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4983 If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4984 killed after process termination." |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4985 (set-buffer (find-file-noselect file)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4986 (funcall fun) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4987 (or do-not-kill-buffer-when-done |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4988 (kill-buffer (current-buffer)))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4989 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
4990 |
34803
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4991 ;; function `ebnf-range-regexp' is used to avoid a bug of `skip-chars-forward' |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4992 ;; on version 20.4.1, that is, it doesn't accept ranges like "\240-\377" (or |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4993 ;; "\177-\237"), but it accepts the character sequence from \240 to \377 (or |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4994 ;; from \177 to \237). It seems that version 20.7 has the same problem. |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4995 (defun ebnf-range-regexp (prefix from to) |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4996 (let (str) |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4997 (while (<= from to) |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4998 (setq str (concat str (char-to-string from)) |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
4999 from (1+ from))) |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
5000 (concat prefix str))) |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
5001 |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
5002 |
27451 | 5003 (defvar ebnf-map-name |
5004 (let ((map (make-vector 256 ?\_))) | |
85221
dab83b846830
(ebnf-map-name, ebnf-dimensions): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
82143
diff
changeset
|
5005 (mapc #'(lambda (char) |
dab83b846830
(ebnf-map-name, ebnf-dimensions): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
82143
diff
changeset
|
5006 (aset map char char)) |
dab83b846830
(ebnf-map-name, ebnf-dimensions): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
82143
diff
changeset
|
5007 (concat "#$%&+-.0123456789=?@~" |
dab83b846830
(ebnf-map-name, ebnf-dimensions): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
82143
diff
changeset
|
5008 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
dab83b846830
(ebnf-map-name, ebnf-dimensions): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
82143
diff
changeset
|
5009 "abcdefghijklmnopqrstuvwxyz")) |
27451 | 5010 map)) |
5011 | |
5012 | |
5013 (defun ebnf-eps-filename (str) | |
5014 (let* ((len (length str)) | |
5015 (stri 0) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5016 ;; to keep compatibility with Emacs 20 & 21: |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5017 ;; DO NOT REPLACE `?\ ' BY `?\s' |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5018 (new (make-string len ?\ ))) |
27451 | 5019 (while (< stri len) |
5020 (aset new stri (aref ebnf-map-name (aref str stri))) | |
5021 (setq stri (1+ stri))) | |
5022 (concat ebnf-eps-prefix new ".eps"))) | |
5023 | |
5024 | |
5025 (defun ebnf-eps-output (&rest args) | |
5026 (while args | |
5027 (insert (car args)) | |
5028 (setq args (cdr args)))) | |
5029 | |
5030 | |
5031 (defun ebnf-generate-region (from to gen-func) | |
5032 (run-hooks 'ebnf-hook) | |
5033 (let ((ebnf-limit (max from to)) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5034 (error-msg "SYNTAX") |
27451 | 5035 the-point) |
5036 (save-excursion | |
5037 (save-restriction | |
5038 (save-match-data | |
5039 (condition-case data | |
5040 (let ((tree (ebnf-parse-and-sort (min from to)))) | |
5041 (when gen-func | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5042 (setq error-msg "EMPTY RULES" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5043 tree (ebnf-eliminate-empty-rules tree)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5044 (setq error-msg "OPTMIZE" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5045 tree (ebnf-optimize tree)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5046 (setq error-msg "DIMENSIONS" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5047 tree (ebnf-dimensions tree)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5048 (setq error-msg "GENERATION") |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5049 (funcall gen-func tree)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5050 (setq error-msg nil)) ; here it's ok |
27451 | 5051 ;; handler |
5052 ((quit error) | |
5053 (ding) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5054 (setq the-point (max (1- (point)) (point-min)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5055 error-msg (concat error-msg ": " |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5056 (error-message-string data) |
54145
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
5057 ", " |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
5058 (and (string= error-msg "SYNTAX") |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
5059 (format "at position %d " |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
5060 the-point)) |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
5061 (format "in buffer \"%s\"." |
e3765a3df826
For compatibility with Emacs 20, define assq-delete-all if it's not defined.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54140
diff
changeset
|
5062 (buffer-name))))))))) |
27451 | 5063 (cond |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5064 ;; error occurred |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5065 (error-msg |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5066 (goto-char the-point) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5067 (if ebnf-stop-on-error |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5068 (error error-msg) |
65584
6dbba0bd58df
Message format fixes, commit no. 3
Deepak Goel <deego@gnufans.org>
parents:
64085
diff
changeset
|
5069 (message "%s" error-msg))) |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5070 ;; generated output OK |
27451 | 5071 (gen-func |
5072 nil) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5073 ;; syntax checked OK |
27451 | 5074 (t |
49671
265858431838
(ebnf2ps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
39421
diff
changeset
|
5075 (message "EBNF syntactic analysis: NO ERRORS."))))) |
27451 | 5076 |
5077 | |
5078 (defun ebnf-parse-and-sort (start) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5079 (ebnf-log "(ebnf-parse-and-sort %S)" start) |
27451 | 5080 (ebnf-begin-job) |
5081 (let ((tree (funcall ebnf-parser-func start))) | |
5082 (if ebnf-sort-production | |
5083 (progn | |
5084 (message "Sorting...") | |
5085 (sort tree | |
5086 (if (eq ebnf-sort-production 'ascending) | |
5087 'ebnf-sorter-ascending | |
5088 'ebnf-sorter-descending))) | |
5089 (nreverse tree)))) | |
5090 | |
5091 | |
5092 (defun ebnf-sorter-ascending (first second) | |
5093 (string< (ebnf-node-name first) | |
5094 (ebnf-node-name second))) | |
5095 | |
5096 | |
5097 (defun ebnf-sorter-descending (first second) | |
5098 (string< (ebnf-node-name second) | |
5099 (ebnf-node-name first))) | |
5100 | |
5101 | |
5102 (defun ebnf-empty-alternative (width) | |
5103 (ps-output (ebnf-format-float width) " EA\n")) | |
5104 | |
5105 | |
5106 (defun ebnf-vertical-movement (height) | |
5107 (ps-output (ebnf-format-float height) " vm\n")) | |
5108 | |
5109 | |
5110 (defun ebnf-horizontal-movement (width) | |
5111 (ps-output (ebnf-format-float width) " hm\n")) | |
5112 | |
5113 | |
5114 (defun ebnf-entry (height) | |
5115 (* height ebnf-entry-percentage)) | |
5116 | |
5117 | |
5118 (defun ebnf-eop-vertical (height) | |
5119 (ps-output (ebnf-format-float (+ height ebnf-production-vertical-space)) | |
5120 " EOPV\n\n")) | |
5121 | |
5122 | |
5123 (defun ebnf-eop-horizontal (width) | |
5124 (ps-output (ebnf-format-float (+ width ebnf-production-horizontal-space)) | |
5125 " EOPH\n\n")) | |
5126 | |
5127 | |
5128 (defun ebnf-new-page () | |
5129 (when (< ps-height-remaining ps-print-height) | |
5130 (run-hooks 'ebnf-page-hook) | |
5131 (ps-next-page) | |
5132 (ps-output "\n"))) | |
5133 | |
5134 | |
5135 (defsubst ebnf-font-size (font) (nth 0 font)) | |
5136 (defsubst ebnf-font-name (font) (nth 1 font)) | |
5137 (defsubst ebnf-font-foreground (font) (nth 2 font)) | |
5138 (defsubst ebnf-font-background (font) (nth 3 font)) | |
5139 (defsubst ebnf-font-list (font) (nthcdr 4 font)) | |
5140 (defsubst ebnf-font-attributes (font) | |
5141 (lsh (ps-extension-bit (cdr font)) -2)) | |
5142 | |
5143 | |
5144 (defconst ebnf-font-name-select | |
5145 (vector 'normal 'bold 'italic 'bold-italic)) | |
5146 | |
5147 | |
5148 (defun ebnf-font-name-select (font) | |
5149 (let* ((font-list (ebnf-font-list font)) | |
5150 (font-index (+ (if (memq 'bold font-list) 1 0) | |
5151 (if (memq 'italic font-list) 2 0))) | |
5152 (name (ebnf-font-name font)) | |
5153 (database (cdr (assoc name ps-font-info-database))) | |
5154 (info-list (or (cdr (assoc 'fonts database)) | |
5155 (error "Invalid font: %s" name)))) | |
5156 (or (cdr (assoc (aref ebnf-font-name-select font-index) | |
5157 info-list)) | |
5158 (error "Invalid attributes for font %s" name)))) | |
5159 | |
5160 | |
5161 (defun ebnf-font-select (font select) | |
5162 (let* ((name (ebnf-font-name font)) | |
5163 (database (cdr (assoc name ps-font-info-database))) | |
5164 (size (cdr (assoc 'size database))) | |
5165 (base (cdr (assoc select database)))) | |
5166 (if (and size base) | |
5167 (/ (* (ebnf-font-size font) base) | |
5168 size) | |
5169 (error "Invalid font: %s" name)))) | |
5170 | |
5171 | |
5172 (defsubst ebnf-font-width (font) | |
5173 (ebnf-font-select font 'avg-char-width)) | |
5174 (defsubst ebnf-font-height (font) | |
5175 (ebnf-font-select font 'line-height)) | |
5176 | |
5177 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5178 (defconst ebnf-syntax-alist |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5179 ;; 0.syntax 1.parser 2.initializer |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5180 '((iso-ebnf ebnf-iso-parser ebnf-iso-initialize) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5181 (yacc ebnf-yac-parser ebnf-yac-initialize) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5182 (abnf ebnf-abn-parser ebnf-abn-initialize) |
54625 | 5183 (ebnf ebnf-bnf-parser ebnf-bnf-initialize) |
54714 | 5184 (ebnfx ebnf-ebx-parser ebnf-ebx-initialize) |
5185 (dtd ebnf-dtd-parser ebnf-dtd-initialize)) | |
75624 | 5186 "Alist associating EBNF syntax with a parser and an initializer.") |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5187 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5188 |
27451 | 5189 (defun ebnf-begin-job () |
52163
0306a6f7d0f4
ebnf-begin-job code fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49671
diff
changeset
|
5190 (ps-printing-region nil nil nil) |
27451 | 5191 (if ebnf-use-float-format |
5192 (setq ebnf-format-float "%1.3f" | |
5193 ebnf-message-float "%3.2f") | |
5194 (setq ebnf-format-float "%s" | |
5195 ebnf-message-float "%s")) | |
5196 (ebnf-otz-initialize) | |
5197 ;; to avoid compilation gripes when calling autoloaded functions | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5198 (let ((init (or (assoc ebnf-syntax ebnf-syntax-alist) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5199 (assoc 'ebnf ebnf-syntax-alist)))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5200 (setq ebnf-parser-func (nth 1 init)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5201 (funcall (nth 2 init))) |
27451 | 5202 (and ebnf-terminal-regexp ; ensures that it's a string or nil |
5203 (not (stringp ebnf-terminal-regexp)) | |
5204 (setq ebnf-terminal-regexp nil)) | |
5205 (or (and ebnf-eps-prefix ; ensures that it's a string | |
5206 (stringp ebnf-eps-prefix)) | |
5207 (setq ebnf-eps-prefix "ebnf--")) | |
5208 (setq ebnf-entry-percentage ; ensures value between 0.0 and 1.0 | |
5209 (min (max ebnf-entry-percentage 0.0) 1.0) | |
5210 ebnf-action-list (if ebnf-horizontal-orientation | |
5211 '(nil keep-line) | |
5212 '(keep-line)) | |
5213 ebnf-settings nil | |
5214 ebnf-fonts-required nil | |
5215 ebnf-action nil | |
5216 ebnf-default-p nil | |
5217 ebnf-eps-context nil | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5218 ebnf-eps-file-alist nil |
27451 | 5219 ebnf-eps-production-list nil |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5220 ebnf-eps-header-comment nil |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5221 ebnf-eps-footer-comment nil |
27451 | 5222 ebnf-eps-upper-x 0.0 |
5223 ebnf-eps-upper-y 0.0 | |
5224 ebnf-font-height-P (ebnf-font-height ebnf-production-font) | |
5225 ebnf-font-height-T (ebnf-font-height ebnf-terminal-font) | |
5226 ebnf-font-height-NT (ebnf-font-height ebnf-non-terminal-font) | |
5227 ebnf-font-height-S (ebnf-font-height ebnf-special-font) | |
5228 ebnf-font-height-E (ebnf-font-height ebnf-except-font) | |
5229 ebnf-font-height-R (ebnf-font-height ebnf-repeat-font) | |
5230 ebnf-font-width-P (ebnf-font-width ebnf-production-font) | |
5231 ebnf-font-width-T (ebnf-font-width ebnf-terminal-font) | |
5232 ebnf-font-width-NT (ebnf-font-width ebnf-non-terminal-font) | |
5233 ebnf-font-width-S (ebnf-font-width ebnf-special-font) | |
5234 ebnf-font-width-E (ebnf-font-width ebnf-except-font) | |
5235 ebnf-font-width-R (ebnf-font-width ebnf-repeat-font) | |
5236 ebnf-space-T (* ebnf-font-height-T 0.5) | |
5237 ebnf-space-NT (* ebnf-font-height-NT 0.5) | |
5238 ebnf-space-S (* ebnf-font-height-S 0.5) | |
5239 ebnf-space-E (* ebnf-font-height-E 0.5) | |
5240 ebnf-space-R (* ebnf-font-height-R 0.5)) | |
5241 (let ((basic (+ ebnf-font-height-T ebnf-font-height-NT))) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5242 (setq ebnf-basic-width (* basic 0.5) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5243 ebnf-horizontal-space (+ basic basic) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5244 ebnf-basic-empty-height (* ebnf-basic-width 0.5) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5245 ebnf-basic-height ebnf-basic-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5246 ebnf-vertical-space ebnf-basic-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5247 ebnf-basic-width-extra (- ebnf-basic-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5248 ebnf-arrow-extra-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5249 0.1)) ; error factor |
27451 | 5250 ;; ensures value is greater than zero |
5251 (or (and (numberp ebnf-production-horizontal-space) | |
5252 (> ebnf-production-horizontal-space 0.0)) | |
5253 (setq ebnf-production-horizontal-space basic)) | |
5254 ;; ensures value is greater than zero | |
5255 (or (and (numberp ebnf-production-vertical-space) | |
5256 (> ebnf-production-vertical-space 0.0)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5257 (setq ebnf-production-vertical-space basic))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5258 (ebnf-log "(ebnf-begin-job)") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5259 (ebnf-log " ebnf-arrow-extra-width ............ : %7.3f" ebnf-arrow-extra-width) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5260 (ebnf-log " ebnf-arrow-scale .................. : %7.3f" ebnf-arrow-scale) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5261 (ebnf-log " ebnf-basic-width-extra ............ : %7.3f" ebnf-basic-width-extra) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5262 (ebnf-log " ebnf-basic-width .................. : %7.3f (T)" ebnf-basic-width) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5263 (ebnf-log " ebnf-horizontal-space ............. : %7.3f (4T)" ebnf-horizontal-space) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5264 (ebnf-log " ebnf-basic-empty-height ........... : %7.3f (hT)" ebnf-basic-empty-height) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5265 (ebnf-log " ebnf-basic-height ................. : %7.3f (T)" ebnf-basic-height) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5266 (ebnf-log " ebnf-vertical-space ............... : %7.3f (T)" ebnf-vertical-space) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5267 (ebnf-log " ebnf-production-horizontal-space .. : %7.3f (2T)" ebnf-production-horizontal-space) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5268 (ebnf-log " ebnf-production-vertical-space .... : %7.3f (2T)" ebnf-production-vertical-space)) |
27451 | 5269 |
5270 | |
5271 (defsubst ebnf-shape-value (sym alist) | |
5272 (or (cdr (assq sym alist)) 0)) | |
5273 | |
5274 | |
5275 (defsubst ebnf-boolean (value) | |
5276 (if value "true" "false")) | |
5277 | |
5278 | |
5279 (defun ebnf-begin-file () | |
5280 (ps-flush-output) | |
5281 (save-excursion | |
5282 (set-buffer ps-spool-buffer) | |
5283 (goto-char (point-min)) | |
5284 (and (search-forward "%%Creator: " nil t) | |
5285 (not (search-forward "& ebnf2ps v" | |
5286 (save-excursion (end-of-line) (point)) | |
5287 t)) | |
5288 (progn | |
5289 ;; adjust creator comment | |
5290 (end-of-line) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5291 ;; (backward-char) |
27451 | 5292 (insert " & ebnf2ps v" ebnf-version) |
5293 ;; insert ebnf settings & engine | |
5294 (goto-char (point-max)) | |
39342
73061d0eb82e
Replace "Prologue" by "Prolog" in PostScript
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
5295 (search-backward "\n%%EndProlog\n") |
27451 | 5296 (ebnf-insert-ebnf-prologue) |
5297 (ps-output "\n"))))) | |
5298 | |
5299 | |
5300 (defun ebnf-eps-finish-and-write (buffer filename) | |
54659
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5301 (when (buffer-modified-p buffer) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5302 (save-excursion |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5303 (set-buffer buffer) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5304 (ebnf-eps-header-footer-set filename) |
54659
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5305 (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5306 ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5307 ebnf-eps-max-height |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5308 (+ ebnf-eps-upper-y |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5309 ebnf-production-vertical-space |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5310 ebnf-eps-max-height))) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5311 ;; prologue |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5312 (goto-char (point-min)) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5313 (insert |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5314 "%!PS-Adobe-3.0 EPSF-3.0" |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5315 "\n%%BoundingBox: 0 0 " |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5316 (format "%d %d" (1+ ebnf-eps-upper-x) (1+ ebnf-eps-upper-y)) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5317 "\n%%Title: " filename |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5318 "\n%%CreationDate: " (format-time-string "%T %b %d %Y") |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5319 "\n%%Creator: " (user-full-name) " (using ebnf2ps v" ebnf-version ")" |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5320 "\n%%DocumentNeededResources: font " |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5321 (or ebnf-fonts-required |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5322 (setq ebnf-fonts-required |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5323 (mapconcat 'identity |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5324 (ps-remove-duplicates |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5325 (mapcar 'ebnf-font-name-select |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5326 (list ebnf-production-font |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5327 ebnf-terminal-font |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5328 ebnf-non-terminal-font |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5329 ebnf-special-font |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5330 ebnf-except-font |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5331 ebnf-repeat-font |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5332 ebnf-eps-header-font |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5333 ebnf-eps-footer-font))) |
54659
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5334 "\n%%+ font "))) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5335 "\n%%Pages: 0\n%%EndComments\n\n%%BeginProlog\n" |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5336 ebnf-eps-prologue) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5337 (ebnf-insert-ebnf-prologue) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5338 (insert ebnf-eps-begin |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5339 "\n0 " (ebnf-format-float |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5340 (- ebnf-eps-upper-y (* ebnf-font-height-P 0.7))) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5341 " #ebnf2ps#begin\n") |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5342 ;; epilogue |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5343 (goto-char (point-max)) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5344 (insert ebnf-eps-end) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5345 ;; write file |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5346 (message "Saving...") |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5347 (setq filename (expand-file-name filename)) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5348 (let ((coding-system-for-write 'raw-text-unix)) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5349 (write-region (point-min) (point-max) filename)) |
31c6392d9307
Write a buffer if and only if the buffer was modified.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
54625
diff
changeset
|
5350 (message "Wrote %s" filename)))) |
27451 | 5351 |
5352 | |
5353 (defun ebnf-insert-ebnf-prologue () | |
5354 (insert | |
5355 (or ebnf-settings | |
5356 (setq ebnf-settings | |
5357 (concat | |
5358 "\n\n% === begin EBNF settings\n\n" | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5359 (format "/Header %s def\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5360 (or ebnf-eps-header-comment "()")) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5361 (format "/Footer %s def\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5362 (or ebnf-eps-footer-comment "()")) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5363 ;; header |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5364 (format "/ShowHeader %s def\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5365 (ebnf-boolean |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5366 (ebnf-eps-header-footer-p ebnf-eps-header))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5367 (format "/fH %s /%s DefFont\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5368 (ebnf-format-float |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5369 (ebnf-font-size ebnf-eps-header-font)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5370 (ebnf-font-name-select ebnf-eps-header-font)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5371 (ebnf-format-color "/ForegroundH %s def %% %s\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5372 (ebnf-font-foreground ebnf-eps-header-font) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5373 "Black") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5374 (ebnf-format-color "/BackgroundH %s def %% %s\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5375 (ebnf-font-background ebnf-eps-header-font) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5376 "White") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5377 (format "/EffectH %d def\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5378 (ebnf-font-attributes ebnf-eps-header-font)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5379 ;; footer |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5380 (format "/ShowFooter %s def\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5381 (ebnf-boolean |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5382 (ebnf-eps-header-footer-p ebnf-eps-footer))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5383 (format "/fF %s /%s DefFont\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5384 (ebnf-format-float |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5385 (ebnf-font-size ebnf-eps-footer-font)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5386 (ebnf-font-name-select ebnf-eps-footer-font)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5387 (ebnf-format-color "/ForegroundF %s def %% %s\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5388 (ebnf-font-foreground ebnf-eps-footer-font) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5389 "Black") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5390 (ebnf-format-color "/BackgroundF %s def %% %s\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5391 (ebnf-font-background ebnf-eps-footer-font) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5392 "White") |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5393 (format "/EffectF %d def\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5394 (ebnf-font-attributes ebnf-eps-footer-font)) |
27451 | 5395 ;; production |
5396 (format "/fP %s /%s DefFont\n" | |
5397 (ebnf-format-float (ebnf-font-size ebnf-production-font)) | |
5398 (ebnf-font-name-select ebnf-production-font)) | |
5399 (ebnf-format-color "/ForegroundP %s def %% %s\n" | |
5400 (ebnf-font-foreground ebnf-production-font) | |
5401 "Black") | |
5402 (ebnf-format-color "/BackgroundP %s def %% %s\n" | |
5403 (ebnf-font-background ebnf-production-font) | |
5404 "White") | |
5405 (format "/EffectP %d def\n" | |
5406 (ebnf-font-attributes ebnf-production-font)) | |
5407 ;; terminal | |
5408 (format "/fT %s /%s DefFont\n" | |
5409 (ebnf-format-float (ebnf-font-size ebnf-terminal-font)) | |
5410 (ebnf-font-name-select ebnf-terminal-font)) | |
5411 (ebnf-format-color "/ForegroundT %s def %% %s\n" | |
5412 (ebnf-font-foreground ebnf-terminal-font) | |
5413 "Black") | |
5414 (ebnf-format-color "/BackgroundT %s def %% %s\n" | |
5415 (ebnf-font-background ebnf-terminal-font) | |
5416 "White") | |
5417 (format "/EffectT %d def\n" | |
5418 (ebnf-font-attributes ebnf-terminal-font)) | |
5419 (format "/BorderWidthT %s def\n" | |
5420 (ebnf-format-float ebnf-terminal-border-width)) | |
5421 (ebnf-format-color "/BorderColorT %s def %% %s\n" | |
5422 ebnf-terminal-border-color | |
5423 "Black") | |
5424 (format "/ShapeT %d def\n" | |
5425 (ebnf-shape-value ebnf-terminal-shape | |
5426 ebnf-terminal-shape-alist)) | |
5427 (format "/ShadowT %s def\n" | |
5428 (ebnf-boolean ebnf-terminal-shadow)) | |
5429 ;; non-terminal | |
5430 (format "/fNT %s /%s DefFont\n" | |
5431 (ebnf-format-float | |
5432 (ebnf-font-size ebnf-non-terminal-font)) | |
5433 (ebnf-font-name-select ebnf-non-terminal-font)) | |
5434 (ebnf-format-color "/ForegroundNT %s def %% %s\n" | |
5435 (ebnf-font-foreground ebnf-non-terminal-font) | |
5436 "Black") | |
5437 (ebnf-format-color "/BackgroundNT %s def %% %s\n" | |
5438 (ebnf-font-background ebnf-non-terminal-font) | |
5439 "White") | |
5440 (format "/EffectNT %d def\n" | |
5441 (ebnf-font-attributes ebnf-non-terminal-font)) | |
5442 (format "/BorderWidthNT %s def\n" | |
5443 (ebnf-format-float ebnf-non-terminal-border-width)) | |
5444 (ebnf-format-color "/BorderColorNT %s def %% %s\n" | |
5445 ebnf-non-terminal-border-color | |
5446 "Black") | |
5447 (format "/ShapeNT %d def\n" | |
5448 (ebnf-shape-value ebnf-non-terminal-shape | |
5449 ebnf-terminal-shape-alist)) | |
5450 (format "/ShadowNT %s def\n" | |
5451 (ebnf-boolean ebnf-non-terminal-shadow)) | |
5452 ;; special | |
5453 (format "/fS %s /%s DefFont\n" | |
5454 (ebnf-format-float (ebnf-font-size ebnf-special-font)) | |
5455 (ebnf-font-name-select ebnf-special-font)) | |
5456 (ebnf-format-color "/ForegroundS %s def %% %s\n" | |
5457 (ebnf-font-foreground ebnf-special-font) | |
5458 "Black") | |
5459 (ebnf-format-color "/BackgroundS %s def %% %s\n" | |
5460 (ebnf-font-background ebnf-special-font) | |
5461 "Gray95") | |
5462 (format "/EffectS %d def\n" | |
5463 (ebnf-font-attributes ebnf-special-font)) | |
5464 (format "/BorderWidthS %s def\n" | |
5465 (ebnf-format-float ebnf-special-border-width)) | |
5466 (ebnf-format-color "/BorderColorS %s def %% %s\n" | |
5467 ebnf-special-border-color | |
5468 "Black") | |
5469 (format "/ShapeS %d def\n" | |
5470 (ebnf-shape-value ebnf-special-shape | |
5471 ebnf-terminal-shape-alist)) | |
5472 (format "/ShadowS %s def\n" | |
5473 (ebnf-boolean ebnf-special-shadow)) | |
5474 ;; except | |
5475 (format "/fE %s /%s DefFont\n" | |
5476 (ebnf-format-float (ebnf-font-size ebnf-except-font)) | |
5477 (ebnf-font-name-select ebnf-except-font)) | |
5478 (ebnf-format-color "/ForegroundE %s def %% %s\n" | |
5479 (ebnf-font-foreground ebnf-except-font) | |
5480 "Black") | |
5481 (ebnf-format-color "/BackgroundE %s def %% %s\n" | |
5482 (ebnf-font-background ebnf-except-font) | |
5483 "Gray90") | |
5484 (format "/EffectE %d def\n" | |
5485 (ebnf-font-attributes ebnf-except-font)) | |
5486 (format "/BorderWidthE %s def\n" | |
5487 (ebnf-format-float ebnf-except-border-width)) | |
5488 (ebnf-format-color "/BorderColorE %s def %% %s\n" | |
5489 ebnf-except-border-color | |
5490 "Black") | |
5491 (format "/ShapeE %d def\n" | |
5492 (ebnf-shape-value ebnf-except-shape | |
5493 ebnf-terminal-shape-alist)) | |
5494 (format "/ShadowE %s def\n" | |
5495 (ebnf-boolean ebnf-except-shadow)) | |
5496 ;; repeat | |
5497 (format "/fR %s /%s DefFont\n" | |
5498 (ebnf-format-float (ebnf-font-size ebnf-repeat-font)) | |
5499 (ebnf-font-name-select ebnf-repeat-font)) | |
5500 (ebnf-format-color "/ForegroundR %s def %% %s\n" | |
5501 (ebnf-font-foreground ebnf-repeat-font) | |
5502 "Black") | |
5503 (ebnf-format-color "/BackgroundR %s def %% %s\n" | |
5504 (ebnf-font-background ebnf-repeat-font) | |
5505 "Gray85") | |
5506 (format "/EffectR %d def\n" | |
5507 (ebnf-font-attributes ebnf-repeat-font)) | |
5508 (format "/BorderWidthR %s def\n" | |
5509 (ebnf-format-float ebnf-repeat-border-width)) | |
5510 (ebnf-format-color "/BorderColorR %s def %% %s\n" | |
5511 ebnf-repeat-border-color | |
5512 "Black") | |
5513 (format "/ShapeR %d def\n" | |
5514 (ebnf-shape-value ebnf-repeat-shape | |
5515 ebnf-terminal-shape-alist)) | |
5516 (format "/ShadowR %s def\n" | |
5517 (ebnf-boolean ebnf-repeat-shadow)) | |
5518 ;; miscellaneous | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
5519 (format "/ExtraWidth %s def\n" |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
5520 (ebnf-format-float ebnf-arrow-extra-width)) |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
5521 (format "/ArrowScale %s def\n" |
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
5522 (ebnf-format-float ebnf-arrow-scale)) |
27451 | 5523 (format "/DefaultWidth %s def\n" |
5524 (ebnf-format-float ebnf-default-width)) | |
5525 (format "/LineWidth %s def\n" | |
5526 (ebnf-format-float ebnf-line-width)) | |
5527 (ebnf-format-color "/LineColor %s def %% %s\n" | |
5528 ebnf-line-color | |
5529 "Black") | |
5530 (format "/ArrowShape %d def\n" | |
5531 (ebnf-shape-value ebnf-arrow-shape | |
5532 ebnf-arrow-shape-alist)) | |
5533 (format "/ChartShape %d def\n" | |
5534 (ebnf-shape-value ebnf-chart-shape | |
5535 ebnf-terminal-shape-alist)) | |
5536 (format "/UserArrow{%s}def\n" | |
31255 | 5537 (let ((arrow (eval ebnf-user-arrow))) |
5538 (if (stringp arrow) | |
5539 arrow | |
5540 ""))) | |
27451 | 5541 "\n% === end EBNF settings\n\n" |
5542 (and ebnf-debug-ps ebnf-debug)))) | |
5543 ebnf-prologue)) | |
5544 | |
5545 | |
5546 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
5547 ;; Adjusting dimensions | |
5548 | |
5549 | |
5550 (defun ebnf-dimensions (tree) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5551 (ebnf-log "(ebnf-dimensions tree)") |
27451 | 5552 (let ((ebnf-total (length tree)) |
5553 (ebnf-nprod 0)) | |
85221
dab83b846830
(ebnf-map-name, ebnf-dimensions): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
82143
diff
changeset
|
5554 (mapc 'ebnf-production-dimension tree)) |
27451 | 5555 tree) |
5556 | |
5557 | |
5558 ;; [empty width-fun dim-fun entry height width] | |
5559 ;;(defun ebnf-empty-dimension (empty) | |
5560 ;; ) | |
5561 | |
5562 | |
5563 ;; [production width-fun dim-fun entry height width name production action] | |
5564 (defun ebnf-production-dimension (production) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5565 (ebnf-log "(ebnf-production-dimension production)") |
27451 | 5566 (ebnf-message-info "Calculating dimensions") |
5567 (ebnf-node-dimension-func (ebnf-node-production production)) | |
5568 (let* ((prod (ebnf-node-production production)) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5569 (height (+ (if ebnf-production-name-p |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5570 ebnf-font-height-P |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5571 0.0) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5572 ebnf-line-width ebnf-line-width |
27451 | 5573 ebnf-basic-height |
5574 (ebnf-node-height prod)))) | |
5575 (ebnf-node-entry production height) | |
5576 (ebnf-node-height production height) | |
5577 (ebnf-node-width production (+ (ebnf-node-width prod) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5578 ebnf-line-width |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5579 ebnf-horizontal-space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5580 ebnf-basic-width-extra))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5581 (ebnf-log " production name : %S" (ebnf-node-name production)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5582 (ebnf-log " production entry : %7.3f" (ebnf-node-entry production)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5583 (ebnf-log " production height : %7.3f" (ebnf-node-height production)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5584 (ebnf-log " production width : %7.3f" (ebnf-node-width production))) |
27451 | 5585 |
5586 | |
5587 ;; [terminal width-fun dim-fun entry height width name] | |
5588 (defun ebnf-terminal-dimension (terminal) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5589 (ebnf-log "(ebnf-terminal-dimension terminal)") |
27451 | 5590 (ebnf-terminal-dimension1 terminal |
5591 ebnf-font-height-T | |
5592 ebnf-font-width-T | |
5593 ebnf-space-T)) | |
5594 | |
5595 | |
5596 ;; [non-terminal width-fun dim-fun entry height width name] | |
5597 (defun ebnf-non-terminal-dimension (non-terminal) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5598 (ebnf-log "(ebnf-non-terminal-dimension non-terminal)") |
27451 | 5599 (ebnf-terminal-dimension1 non-terminal |
5600 ebnf-font-height-NT | |
5601 ebnf-font-width-NT | |
5602 ebnf-space-NT)) | |
5603 | |
5604 | |
5605 ;; [special width-fun dim-fun entry height width name] | |
5606 (defun ebnf-special-dimension (special) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5607 (ebnf-log "(ebnf-special-dimension special)") |
27451 | 5608 (ebnf-terminal-dimension1 special |
5609 ebnf-font-height-S | |
5610 ebnf-font-width-S | |
5611 ebnf-space-S)) | |
5612 | |
5613 | |
5614 (defun ebnf-terminal-dimension1 (node font-height font-width space) | |
5615 (let ((height (+ space font-height space)) | |
5616 (len (length (ebnf-node-name node)))) | |
5617 (ebnf-node-entry node (* height 0.5)) | |
5618 (ebnf-node-height node height) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5619 (ebnf-node-width node (+ ebnf-basic-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5620 ebnf-arrow-extra-width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5621 space |
27451 | 5622 (* len font-width) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5623 space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5624 ebnf-basic-width))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5625 (ebnf-log " name : %S" (ebnf-node-name node)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5626 (ebnf-log " entry : %7.3f" (ebnf-node-entry node)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5627 (ebnf-log " height : %7.3f" (ebnf-node-height node)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5628 (ebnf-log " width : %7.3f" (ebnf-node-width node))) |
27451 | 5629 |
5630 | |
5631 (defconst ebnf-null-vector (vector t t t 0.0 0.0 0.0)) | |
5632 | |
5633 | |
5634 ;; [repeat width-fun dim-fun entry height width times element] | |
5635 (defun ebnf-repeat-dimension (repeat) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5636 (ebnf-log "(ebnf-repeat-dimension repeat)") |
27451 | 5637 (let ((times (ebnf-node-name repeat)) |
5638 (element (ebnf-node-separator repeat))) | |
5639 (if element | |
5640 (ebnf-node-dimension-func element) | |
5641 (setq element ebnf-null-vector)) | |
5642 (ebnf-node-entry repeat (+ (ebnf-node-entry element) | |
5643 ebnf-space-R)) | |
5644 (ebnf-node-height repeat (+ (max (ebnf-node-height element) | |
5645 ebnf-font-height-S) | |
5646 ebnf-space-R ebnf-space-R)) | |
5647 (ebnf-node-width repeat (+ (ebnf-node-width element) | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
5648 ebnf-arrow-extra-width |
27451 | 5649 ebnf-space-R ebnf-space-R ebnf-space-R |
5650 ebnf-horizontal-space | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5651 (* (length times) ebnf-font-width-R)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5652 (ebnf-log " repeat entry : %7.3f" (ebnf-node-entry repeat)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5653 (ebnf-log " repeat height : %7.3f" (ebnf-node-height repeat)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5654 (ebnf-log " repeat width : %7.3f" (ebnf-node-width repeat))) |
27451 | 5655 |
5656 | |
5657 ;; [except width-fun dim-fun entry height width element element] | |
5658 (defun ebnf-except-dimension (except) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5659 (ebnf-log "(ebnf-except-dimension except)") |
27451 | 5660 (let ((factor (ebnf-node-list except)) |
5661 (element (ebnf-node-separator except))) | |
5662 (ebnf-node-dimension-func factor) | |
5663 (if element | |
5664 (ebnf-node-dimension-func element) | |
5665 (setq element ebnf-null-vector)) | |
5666 (ebnf-node-entry except (+ (max (ebnf-node-entry factor) | |
5667 (ebnf-node-entry element)) | |
5668 ebnf-space-E)) | |
5669 (ebnf-node-height except (+ (max (ebnf-node-height factor) | |
5670 (ebnf-node-height element)) | |
5671 ebnf-space-E ebnf-space-E)) | |
5672 (ebnf-node-width except (+ (ebnf-node-width factor) | |
5673 (ebnf-node-width element) | |
73142
005027f474ac
Implement arrow spacing and scaling. (v4.3)
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
73027
diff
changeset
|
5674 ebnf-arrow-extra-width |
27451 | 5675 ebnf-space-E ebnf-space-E |
5676 ebnf-space-E ebnf-space-E | |
5677 ebnf-font-width-E | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5678 ebnf-horizontal-space))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5679 (ebnf-log " except entry : %7.3f" (ebnf-node-entry except)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5680 (ebnf-log " except height : %7.3f" (ebnf-node-height except)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5681 (ebnf-log " except width : %7.3f" (ebnf-node-width except))) |
27451 | 5682 |
5683 | |
5684 ;; [alternative width-fun dim-fun entry height width list] | |
5685 (defun ebnf-alternative-dimension (alternative) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5686 (ebnf-log "(ebnf-alternative-dimension alternative)") |
27451 | 5687 (let ((body (ebnf-node-list alternative)) |
5688 (lis (ebnf-node-list alternative))) | |
5689 (while lis | |
5690 (ebnf-node-dimension-func (car lis)) | |
5691 (setq lis (cdr lis))) | |
5692 (let ((height 0.0) | |
5693 (width 0.0) | |
5694 (alt body) | |
5695 (tail (car (last body))) | |
5696 (entry (ebnf-node-entry (car body))) | |
5697 node) | |
5698 (while alt | |
5699 (setq node (car alt) | |
5700 alt (cdr alt) | |
5701 height (+ (ebnf-node-height node) height) | |
5702 width (max (ebnf-node-width node) width))) | |
5703 (ebnf-adjust-width body width) | |
5704 (setq height (+ height (* (1- (length body)) ebnf-vertical-space))) | |
5705 (ebnf-node-entry alternative (+ entry | |
5706 (ebnf-entry | |
5707 (- height entry | |
5708 (- (ebnf-node-height tail) | |
5709 (ebnf-node-entry tail)))))) | |
5710 (ebnf-node-height alternative height) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5711 (ebnf-node-width alternative (+ width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5712 ebnf-horizontal-space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5713 ebnf-basic-width-extra)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5714 (ebnf-node-list alternative body))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5715 (ebnf-log " alternative entry : %7.3f" (ebnf-node-entry alternative)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5716 (ebnf-log " alternative height : %7.3f" (ebnf-node-height alternative)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5717 (ebnf-log " alternative width : %7.3f" (ebnf-node-width alternative))) |
27451 | 5718 |
5719 | |
5720 ;; [optional width-fun dim-fun entry height width element] | |
5721 (defun ebnf-optional-dimension (optional) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5722 (ebnf-log "(ebnf-optional-dimension optional)") |
27451 | 5723 (let ((body (ebnf-node-list optional))) |
5724 (ebnf-node-dimension-func body) | |
5725 (ebnf-node-entry optional (ebnf-node-entry body)) | |
5726 (ebnf-node-height optional (+ (ebnf-node-height body) | |
5727 ebnf-vertical-space)) | |
5728 (ebnf-node-width optional (+ (ebnf-node-width body) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5729 ebnf-horizontal-space))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5730 (ebnf-log " optional entry : %7.3f" (ebnf-node-entry optional)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5731 (ebnf-log " optional height : %7.3f" (ebnf-node-height optional)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5732 (ebnf-log " optional width : %7.3f" (ebnf-node-width optional))) |
27451 | 5733 |
5734 | |
5735 ;; [one-or-more width-fun dim-fun entry height width element separator] | |
5736 (defun ebnf-one-or-more-dimension (or-more) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5737 (ebnf-log "(ebnf-one-or-more-dimension or-more)") |
27451 | 5738 (let ((list-part (ebnf-node-list or-more)) |
5739 (sep-part (ebnf-node-separator or-more))) | |
5740 (ebnf-node-dimension-func list-part) | |
5741 (and sep-part | |
5742 (ebnf-node-dimension-func sep-part)) | |
5743 (let ((height (+ (if sep-part | |
5744 (ebnf-node-height sep-part) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5745 ebnf-basic-empty-height) |
27451 | 5746 ebnf-vertical-space |
5747 (ebnf-node-height list-part))) | |
5748 (width (max (if sep-part | |
5749 (ebnf-node-width sep-part) | |
5750 0.0) | |
5751 (ebnf-node-width list-part)))) | |
5752 (when sep-part | |
5753 (ebnf-adjust-width list-part width) | |
5754 (ebnf-adjust-width sep-part width)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5755 (ebnf-node-entry or-more (+ (- height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5756 (ebnf-node-height list-part)) |
27451 | 5757 (ebnf-node-entry list-part))) |
5758 (ebnf-node-height or-more height) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5759 (ebnf-node-width or-more (+ width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5760 ebnf-horizontal-space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5761 ebnf-basic-width-extra)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5762 (ebnf-log " one-or-more entry : %7.3f" (ebnf-node-entry or-more)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5763 (ebnf-log " one-or-more height : %7.3f" (ebnf-node-height or-more)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5764 (ebnf-log " one-or-more width : %7.3f" (ebnf-node-width or-more))) |
27451 | 5765 |
5766 | |
5767 ;; [zero-or-more width-fun dim-fun entry height width element separator] | |
5768 (defun ebnf-zero-or-more-dimension (or-more) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5769 (ebnf-log "(ebnf-zero-or-more-dimension or-more)") |
27451 | 5770 (let ((list-part (ebnf-node-list or-more)) |
5771 (sep-part (ebnf-node-separator or-more))) | |
5772 (ebnf-node-dimension-func list-part) | |
5773 (and sep-part | |
5774 (ebnf-node-dimension-func sep-part)) | |
5775 (let ((height (+ (if sep-part | |
5776 (ebnf-node-height sep-part) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5777 ebnf-basic-empty-height) |
27451 | 5778 ebnf-vertical-space |
5779 (ebnf-node-height list-part) | |
5780 ebnf-vertical-space)) | |
5781 (width (max (if sep-part | |
5782 (ebnf-node-width sep-part) | |
5783 0.0) | |
5784 (ebnf-node-width list-part)))) | |
5785 (when sep-part | |
5786 (ebnf-adjust-width list-part width) | |
5787 (ebnf-adjust-width sep-part width)) | |
5788 (ebnf-node-entry or-more height) | |
5789 (ebnf-node-height or-more height) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5790 (ebnf-node-width or-more (+ width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5791 ebnf-horizontal-space |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5792 ebnf-basic-width-extra)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5793 (ebnf-log " zero-or-more entry : %7.3f" (ebnf-node-entry or-more)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5794 (ebnf-log " zero-or-more height : %7.3f" (ebnf-node-height or-more)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5795 (ebnf-log " zero-or-more width : %7.3f" (ebnf-node-width or-more))) |
27451 | 5796 |
5797 | |
5798 ;; [sequence width-fun dim-fun entry height width list] | |
5799 (defun ebnf-sequence-dimension (sequence) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5800 (ebnf-log "(ebnf-sequence-dimension sequence)") |
27451 | 5801 (let ((above 0.0) |
5802 (below 0.0) | |
5803 (width 0.0) | |
5804 (lis (ebnf-node-list sequence)) | |
5805 entry node) | |
5806 (while lis | |
5807 (setq node (car lis) | |
5808 lis (cdr lis)) | |
5809 (ebnf-node-dimension-func node) | |
5810 (setq entry (ebnf-node-entry node) | |
5811 above (max above entry) | |
5812 below (max below (- (ebnf-node-height node) entry)) | |
5813 width (+ width (ebnf-node-width node)))) | |
5814 (ebnf-node-entry sequence above) | |
5815 (ebnf-node-height sequence (+ above below)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5816 (ebnf-node-width sequence width)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5817 (ebnf-log " sequence entry : %7.3f" (ebnf-node-entry sequence)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5818 (ebnf-log " sequence height : %7.3f" (ebnf-node-height sequence)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5819 (ebnf-log " sequence width : %7.3f" (ebnf-node-width sequence))) |
27451 | 5820 |
5821 | |
5822 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
5823 ;; Adjusting width | |
5824 | |
5825 | |
5826 (defun ebnf-adjust-width (node width) | |
5827 (cond | |
5828 ((listp node) | |
5829 (prog1 | |
5830 node | |
5831 (while node | |
5832 (setcar node (ebnf-adjust-width (car node) width)) | |
5833 (setq node (cdr node))))) | |
5834 ((vectorp node) | |
5835 (cond | |
5836 ;; nothing to be done | |
5837 ((= width (ebnf-node-width node)) | |
5838 node) | |
5839 ;; left justify term | |
5840 ((eq ebnf-justify-sequence 'left) | |
5841 (ebnf-adjust-empty node width nil)) | |
5842 ;; right justify terms | |
5843 ((eq ebnf-justify-sequence 'right) | |
5844 (ebnf-adjust-empty node width t)) | |
5845 ;; centralize terms | |
5846 (t | |
5847 (ebnf-node-width-func node width) | |
5848 (ebnf-node-width node width) | |
5849 node) | |
5850 )) | |
5851 (t | |
5852 node) | |
5853 )) | |
5854 | |
5855 | |
5856 (defun ebnf-adjust-empty (node width last-p) | |
5857 (if (eq (ebnf-node-kind node) 'ebnf-generate-empty) | |
5858 (progn | |
5859 (ebnf-node-width node width) | |
5860 node) | |
5861 (let ((empty (ebnf-make-empty (- width (ebnf-node-width node))))) | |
5862 (ebnf-make-dup-sequence node | |
5863 (if last-p | |
5864 (list empty node) | |
5865 (list node empty)))))) | |
5866 | |
5867 | |
5868 ;; [terminal width-fun dim-fun entry height width name] | |
5869 ;; [non-terminal width-fun dim-fun entry height width name] | |
5870 ;; [empty width-fun dim-fun entry height width] | |
5871 ;; [special width-fun dim-fun entry height width name] | |
5872 ;; [repeat width-fun dim-fun entry height width times element] | |
5873 ;; [except width-fun dim-fun entry height width element element] | |
5874 ;;(defun ebnf-terminal-width (terminal width) | |
5875 ;; ) | |
5876 | |
5877 | |
5878 ;; [alternative width-fun dim-fun entry height width list] | |
5879 ;; [optional width-fun dim-fun entry height width element] | |
5880 (defun ebnf-alternative-width (alternative width) | |
5881 (ebnf-adjust-width (ebnf-node-list alternative) | |
5882 (- width ebnf-horizontal-space))) | |
5883 | |
5884 | |
5885 ;; [one-or-more width-fun dim-fun entry height width element separator] | |
5886 ;; [zero-or-more width-fun dim-fun entry height width element separator] | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5887 (defun ebnf-element-width (or-more width) |
27451 | 5888 (setq width (- width ebnf-horizontal-space)) |
5889 (ebnf-node-list or-more | |
5890 (ebnf-justify-list or-more | |
5891 (ebnf-node-list or-more) | |
5892 width)) | |
5893 (ebnf-node-separator or-more | |
5894 (ebnf-justify-list or-more | |
5895 (ebnf-node-separator or-more) | |
5896 width))) | |
5897 | |
5898 | |
5899 ;; [sequence width-fun dim-fun entry height width list] | |
5900 (defun ebnf-sequence-width (sequence width) | |
5901 (ebnf-node-list sequence | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
5902 (ebnf-justify-list sequence |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
5903 (ebnf-node-list sequence) |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
5904 width))) |
27451 | 5905 |
5906 | |
5907 (defun ebnf-justify-list (node seq width) | |
5908 (let ((seq-width (ebnf-node-width node))) | |
5909 (if (= width seq-width) | |
5910 seq | |
5911 (cond | |
5912 ;; left justify terms | |
5913 ((eq ebnf-justify-sequence 'left) | |
5914 (ebnf-justify node seq seq-width width t)) | |
5915 ;; right justify terms | |
5916 ((eq ebnf-justify-sequence 'right) | |
5917 (ebnf-justify node seq seq-width width nil)) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5918 ;; centralize terms -- element |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5919 ((vectorp seq) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5920 (ebnf-adjust-width seq width)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
5921 ;; centralize terms -- list |
27451 | 5922 (t |
5923 (let ((the-width (/ (- width seq-width) (length seq))) | |
5924 (lis seq)) | |
5925 (while lis | |
5926 (ebnf-adjust-width (car lis) | |
5927 (+ (ebnf-node-width (car lis)) | |
5928 the-width)) | |
5929 (setq lis (cdr lis))) | |
5930 seq)) | |
5931 )))) | |
5932 | |
5933 | |
5934 (defun ebnf-justify (node seq seq-width width last-p) | |
5935 (let ((term (car (if last-p (last seq) seq)))) | |
5936 (cond | |
5937 ;; adjust empty term | |
5938 ((eq (ebnf-node-kind term) 'ebnf-generate-empty) | |
5939 (ebnf-node-width term (+ (- width seq-width) | |
5940 (ebnf-node-width term))) | |
5941 seq) | |
5942 ;; insert empty at end ==> left justify | |
5943 (last-p | |
5944 (nconc seq | |
5945 (list (ebnf-make-empty (- width seq-width))))) | |
5946 ;; insert empty at beginning ==> right justify | |
5947 (t | |
5948 (cons (ebnf-make-empty (- width seq-width)) | |
5949 seq)) | |
5950 ))) | |
5951 | |
5952 | |
5953 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
5954 ;; Functions used by parsers | |
5955 | |
5956 | |
5957 (defun ebnf-eps-add-context (name) | |
5958 (let ((filename (ebnf-eps-filename name))) | |
5959 (if (member filename ebnf-eps-context) | |
5960 (error "Try to open an already opened EPS file: %s" filename) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5961 (setq ebnf-eps-context (cons filename ebnf-eps-context))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5962 (ebnf-eps-header-footer-file filename))) |
27451 | 5963 |
5964 | |
5965 (defun ebnf-eps-remove-context (name) | |
5966 (let ((filename (ebnf-eps-filename name))) | |
5967 (if (member filename ebnf-eps-context) | |
5968 (setq ebnf-eps-context (delete filename ebnf-eps-context)) | |
5969 (error "Try to close a not opened EPS file: %s" filename)))) | |
5970 | |
5971 | |
5972 (defun ebnf-eps-add-production (header) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5973 (when ebnf-eps-executing |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5974 (if ebnf-eps-context |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5975 (let ((prod (assoc header ebnf-eps-production-list))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5976 (if prod |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5977 (setcdr prod (ebnf-dup-list |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5978 (append ebnf-eps-context (cdr prod)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5979 (setq ebnf-eps-production-list |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5980 (cons (cons header (ebnf-dup-list ebnf-eps-context)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5981 ebnf-eps-production-list)))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
5982 (ebnf-eps-header-footer-file (ebnf-eps-filename header))))) |
27451 | 5983 |
5984 | |
5985 (defun ebnf-dup-list (old) | |
5986 (let (new) | |
5987 (while old | |
5988 (setq new (cons (car old) new) | |
5989 old (cdr old))) | |
5990 (nreverse new))) | |
5991 | |
5992 | |
5993 (defun ebnf-buffer-substring (chars) | |
5994 (buffer-substring-no-properties | |
5995 (point) | |
5996 (progn | |
5997 (skip-chars-forward chars ebnf-limit) | |
5998 (point)))) | |
5999 | |
6000 | |
34803
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
6001 ;; replace the range "\240-\377" (see `ebnf-range-regexp'). |
de1f65fa5dcd
Fix a problem with skip-chars-forward: it doesn't accept
Gerd Moellmann <gerd@gnu.org>
parents:
31255
diff
changeset
|
6002 (defconst ebnf-8-bit-chars (ebnf-range-regexp "" ?\240 ?\377)) |
30572
f0463edb8518
Get around a bug on skip-chars-forward.
Gerd Moellmann <gerd@gnu.org>
parents:
30552
diff
changeset
|
6003 |
f0463edb8518
Get around a bug on skip-chars-forward.
Gerd Moellmann <gerd@gnu.org>
parents:
30552
diff
changeset
|
6004 |
27451 | 6005 (defun ebnf-string (chars eos-char kind) |
6006 (forward-char) | |
6007 (buffer-substring-no-properties | |
6008 (point) | |
6009 (progn | |
30572
f0463edb8518
Get around a bug on skip-chars-forward.
Gerd Moellmann <gerd@gnu.org>
parents:
30552
diff
changeset
|
6010 ;;(skip-chars-forward (concat chars "\240-\377") ebnf-limit) |
f0463edb8518
Get around a bug on skip-chars-forward.
Gerd Moellmann <gerd@gnu.org>
parents:
30552
diff
changeset
|
6011 (skip-chars-forward (concat chars ebnf-8-bit-chars) ebnf-limit) |
27451 | 6012 (if (or (eobp) (/= (following-char) eos-char)) |
60917
87f9bb9d3718
* progmodes/ebnf-abn.el, progmodes/ebnf-bnf.el,
Werner LEMBERG <wl@gnu.org>
parents:
58340
diff
changeset
|
6013 (error "Invalid %s: missing `%c'" kind eos-char) |
27451 | 6014 (forward-char) |
6015 (1- (point)))))) | |
6016 | |
6017 | |
6018 (defun ebnf-get-string () | |
6019 (forward-char) | |
6020 (buffer-substring-no-properties (point) (ebnf-end-of-string))) | |
6021 | |
6022 | |
6023 (defun ebnf-end-of-string () | |
6024 (let ((n 1)) | |
6025 (while (> (logand n 1) 0) | |
6026 (skip-chars-forward "^\"" ebnf-limit) | |
6027 (setq n (- (skip-chars-backward "\\\\"))) | |
6028 (goto-char (+ (point) n 1)))) | |
6029 (if (= (preceding-char) ?\") | |
6030 (1- (point)) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35888
diff
changeset
|
6031 (error "Missing `\"'"))) |
27451 | 6032 |
6033 | |
6034 (defun ebnf-trim-right (str) | |
6035 (let* ((len (1- (length str))) | |
6036 (index len)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6037 ;; to keep compatibility with Emacs 20 & 21: |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6038 ;; DO NOT REPLACE `?\ ' BY `?\s' |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6039 (while (and (> index 0) (= (aref str index) ?\ )) |
27451 | 6040 (setq index (1- index))) |
6041 (if (= index len) | |
6042 str | |
6043 (substring str 0 (1+ index))))) | |
6044 | |
6045 | |
6046 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
6047 ;; Vector creation | |
6048 | |
6049 | |
6050 (defun ebnf-make-empty (&optional width) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6051 (vector 'ebnf-generate-empty ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6052 'ignore ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6053 'ignore ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6054 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6055 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6056 (or width ebnf-horizontal-space))) ; 5 width |
27451 | 6057 |
6058 | |
6059 (defun ebnf-make-terminal (name) | |
6060 (ebnf-make-terminal1 name | |
6061 'ebnf-generate-terminal | |
6062 'ebnf-terminal-dimension)) | |
6063 | |
6064 | |
6065 (defun ebnf-make-non-terminal (name) | |
6066 (ebnf-make-terminal1 name | |
6067 'ebnf-generate-non-terminal | |
6068 'ebnf-non-terminal-dimension)) | |
6069 | |
6070 | |
6071 (defun ebnf-make-special (name) | |
6072 (ebnf-make-terminal1 name | |
6073 'ebnf-generate-special | |
6074 'ebnf-special-dimension)) | |
6075 | |
6076 | |
6077 (defun ebnf-make-terminal1 (name gen-func dim-func) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6078 (vector gen-func ; 0 generatore |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6079 'ignore ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6080 dim-func ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6081 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6082 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6083 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6084 (let ((len (length name))) ; 6 name |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6085 (cond ((> len 3) name) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6086 ((= len 3) (concat name " ")) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6087 ((= len 2) (concat " " name " ")) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6088 ((= len 1) (concat " " name " ")) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6089 (t " "))) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6090 ebnf-default-p)) ; 7 is default? |
27451 | 6091 |
6092 | |
6093 (defun ebnf-make-one-or-more (list-part &optional sep-part) | |
6094 (ebnf-make-or-more1 'ebnf-generate-one-or-more | |
6095 'ebnf-one-or-more-dimension | |
6096 list-part | |
6097 sep-part)) | |
6098 | |
6099 | |
6100 (defun ebnf-make-zero-or-more (list-part &optional sep-part) | |
6101 (ebnf-make-or-more1 'ebnf-generate-zero-or-more | |
6102 'ebnf-zero-or-more-dimension | |
6103 list-part | |
6104 sep-part)) | |
6105 | |
6106 | |
6107 (defun ebnf-make-or-more1 (gen-func dim-func list-part sep-part) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6108 (vector gen-func ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6109 'ebnf-element-width ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6110 dim-func ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6111 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6112 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6113 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6114 (if (listp list-part) ; 6 element |
27451 | 6115 (ebnf-make-sequence list-part) |
6116 list-part) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6117 (if (and sep-part (listp sep-part)) ; 7 separator |
27451 | 6118 (ebnf-make-sequence sep-part) |
6119 sep-part))) | |
6120 | |
6121 | |
6122 (defun ebnf-make-production (name prod action) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6123 (vector 'ebnf-generate-production ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6124 'ignore ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6125 'ebnf-production-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6126 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6127 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6128 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6129 name ; 6 production name |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6130 prod ; 7 production body |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6131 action)) ; 8 production action |
27451 | 6132 |
6133 | |
6134 (defun ebnf-make-alternative (body) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6135 (vector 'ebnf-generate-alternative ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6136 'ebnf-alternative-width ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6137 'ebnf-alternative-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6138 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6139 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6140 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6141 body)) ; 6 alternative list |
27451 | 6142 |
6143 | |
6144 (defun ebnf-make-optional (body) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6145 (vector 'ebnf-generate-optional ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6146 'ebnf-alternative-width ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6147 'ebnf-optional-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6148 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6149 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6150 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6151 body)) ; 6 optional element |
27451 | 6152 |
6153 | |
6154 (defun ebnf-make-except (factor exception) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6155 (vector 'ebnf-generate-except ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6156 'ignore ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6157 'ebnf-except-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6158 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6159 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6160 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6161 factor ; 6 base element |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6162 exception)) ; 7 exception element |
27451 | 6163 |
6164 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6165 (defun ebnf-make-repeat (times primary &optional upper) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6166 (vector 'ebnf-generate-repeat ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6167 'ignore ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6168 'ebnf-repeat-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6169 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6170 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6171 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6172 ; 6 times |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6173 (cond ((and times upper) ; L * U, L * L |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6174 (if (string= times upper) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6175 (if (string= times "") |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6176 " * " |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6177 times) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6178 (concat times " * " upper))) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6179 (times ; L * |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6180 (concat times " *")) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6181 (upper ; * U |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6182 (concat "* " upper)) |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6183 (t ; * |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6184 " * ")) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6185 primary)) ; 7 element |
27451 | 6186 |
6187 | |
6188 (defun ebnf-make-sequence (seq) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6189 (vector 'ebnf-generate-sequence ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6190 'ebnf-sequence-width ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6191 'ebnf-sequence-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6192 0.0 ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6193 0.0 ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6194 0.0 ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6195 seq)) ; 6 sequence |
27451 | 6196 |
6197 | |
6198 (defun ebnf-make-dup-sequence (node seq) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6199 (vector 'ebnf-generate-sequence ; 0 generator |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6200 'ebnf-sequence-width ; 1 width fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6201 'ebnf-sequence-dimension ; 2 dimension fun |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6202 (ebnf-node-entry node) ; 3 entry |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6203 (ebnf-node-height node) ; 4 height |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6204 (ebnf-node-width node) ; 5 width |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6205 seq)) ; 6 sequence |
27451 | 6206 |
6207 | |
6208 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
6209 ;; Optimizers used by parsers | |
6210 | |
6211 | |
6212 (defun ebnf-token-except (element exception) | |
6213 (cons (prog1 | |
6214 (car exception) | |
6215 (setq exception (cdr exception))) | |
6216 (and element ; EMPTY - A ==> EMPTY | |
6217 (let ((kind (ebnf-node-kind element))) | |
6218 (cond | |
6219 ;; [ A ]- ==> A | |
6220 ((and (null exception) | |
6221 (eq kind 'ebnf-generate-optional)) | |
6222 (ebnf-node-list element)) | |
6223 ;; { A }- ==> { A }+ | |
6224 ((and (null exception) | |
6225 (eq kind 'ebnf-generate-zero-or-more)) | |
6226 (ebnf-node-kind element 'ebnf-generate-one-or-more) | |
6227 (ebnf-node-dimension-func element 'ebnf-one-or-more-dimension) | |
6228 element) | |
6229 ;; ( A | EMPTY )- ==> A | |
6230 ;; ( A | B | EMPTY )- ==> A | B | |
6231 ((and (null exception) | |
6232 (eq kind 'ebnf-generate-alternative) | |
30552
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
6233 (eq (ebnf-node-kind |
a7498193b035
Update ps-print functions call. Indentation fix. Doc
Gerd Moellmann <gerd@gnu.org>
parents:
27539
diff
changeset
|
6234 (car (last (ebnf-node-list element)))) |
27451 | 6235 'ebnf-generate-empty)) |
6236 (let ((elt (ebnf-node-list element)) | |
6237 bef) | |
6238 (while (cdr elt) | |
6239 (setq bef elt | |
6240 elt (cdr elt))) | |
6241 (if (null bef) | |
6242 ;; this should not happen!!?! | |
6243 (setq element (ebnf-make-empty | |
6244 (ebnf-node-width element))) | |
6245 (setcdr bef nil) | |
6246 (setq elt (ebnf-node-list element)) | |
6247 (and (= (length elt) 1) | |
6248 (setq element (car elt)))) | |
6249 element)) | |
6250 ;; A - B | |
6251 (t | |
6252 (ebnf-make-except element exception)) | |
6253 ))))) | |
6254 | |
6255 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6256 (defun ebnf-token-repeat (times repeat &optional upper) |
27451 | 6257 (if (null (cdr repeat)) |
6258 ;; n * EMPTY ==> EMPTY | |
6259 repeat | |
6260 ;; n * term | |
6261 (cons (car repeat) | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6262 (ebnf-make-repeat times (cdr repeat) upper)))) |
27451 | 6263 |
6264 | |
6265 (defun ebnf-token-optional (body) | |
6266 (let ((kind (ebnf-node-kind body))) | |
6267 (cond | |
6268 ;; [ EMPTY ] ==> EMPTY | |
6269 ((eq kind 'ebnf-generate-empty) | |
6270 nil) | |
6271 ;; [ { A }* ] ==> { A }* | |
6272 ((eq kind 'ebnf-generate-zero-or-more) | |
6273 body) | |
6274 ;; [ { A }+ ] ==> { A }* | |
6275 ((eq kind 'ebnf-generate-one-or-more) | |
6276 (ebnf-node-kind body 'ebnf-generate-zero-or-more) | |
6277 body) | |
6278 ;; [ A | B ] ==> A | B | EMPTY | |
6279 ((eq kind 'ebnf-generate-alternative) | |
6280 (ebnf-node-list body (nconc (ebnf-node-list body) | |
6281 (list (ebnf-make-empty)))) | |
6282 body) | |
6283 ;; [ A ] | |
6284 (t | |
6285 (ebnf-make-optional body)) | |
6286 ))) | |
6287 | |
6288 | |
6289 (defun ebnf-token-alternative (body sequence) | |
6290 (if (null body) | |
6291 (if (cdr sequence) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6292 ;; no alternative |
27451 | 6293 sequence |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6294 ;; empty element |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6295 (cons (car sequence) ; token |
27451 | 6296 (ebnf-make-empty))) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6297 (cons (car sequence) ; token |
27451 | 6298 (let ((seq (cdr sequence))) |
6299 (if (and (= (length body) 1) (null seq)) | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6300 ;; alternative with one element |
27451 | 6301 (car body) |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6302 ;; a real alternative |
27451 | 6303 (ebnf-make-alternative (nreverse (if seq |
6304 (cons seq body) | |
6305 body)))))))) | |
6306 | |
54714 | 6307 |
6308 (defun ebnf-token-sequence (sequence) | |
6309 (cond | |
6310 ;; null sequence | |
6311 ((null sequence) | |
6312 (ebnf-make-empty)) | |
6313 ;; sequence with only one element | |
6314 ((= (length sequence) 1) | |
6315 (car sequence)) | |
6316 ;; a real sequence | |
6317 (t | |
6318 (ebnf-make-sequence (nreverse sequence))) | |
6319 )) | |
6320 | |
27451 | 6321 |
6322 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
6323 ;; Variables used by parsers | |
6324 | |
6325 | |
6326 (defconst ebnf-comment-table | |
6327 (let ((table (make-vector 256 nil))) | |
6328 ;; Override special comment character: | |
6329 (aset table ?< 'newline) | |
6330 (aset table ?> 'keep-line) | |
54714 | 6331 (aset table ?^ 'form-feed) |
27451 | 6332 table) |
6333 "Vector used to map characters to a special comment token.") | |
6334 | |
6335 | |
6336 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
82143
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6337 ;; Log message |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6338 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6339 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6340 (defun ebnf-log-header (format-str &rest args) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6341 (when ebnf-log |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6342 (apply |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6343 'ebnf-log |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6344 (concat |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6345 "\n\n===============================================================\n\n" |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6346 format-str) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6347 args))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6348 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6349 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6350 (defun ebnf-log (format-str &rest args) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6351 (when ebnf-log |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6352 (save-excursion |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6353 (set-buffer (get-buffer-create "*Ebnf2ps Log*")) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6354 (goto-char (point-max)) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6355 (insert (apply 'format format-str args) "\n")))) |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6356 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6357 |
81c81019e0c6
New: Header/Footer comment & Log messages
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
78234
diff
changeset
|
6358 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
27451 | 6359 ;; To make this file smaller, some commands go in a separate file. |
6360 ;; But autoload them here to make the separation invisible. | |
6361 | |
54140
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6362 (autoload 'ebnf-abn-parser "ebnf-abn" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6363 "ABNF parser.") |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6364 |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6365 (autoload 'ebnf-abn-initialize "ebnf-abn" |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6366 "Initialize ABNF token table.") |
766aaa5bded5
ABNF parser. Fix bug on productions like test = {"test"}* | ("tt" ["test"]). Reported by Markus Dreyer.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
52401
diff
changeset
|
6367 |
27451 | 6368 (autoload 'ebnf-bnf-parser "ebnf-bnf" |
6369 "EBNF parser.") | |
6370 | |
6371 (autoload 'ebnf-bnf-initialize "ebnf-bnf" | |
6372 "Initialize EBNF token table.") | |
6373 | |
6374 (autoload 'ebnf-iso-parser "ebnf-iso" | |
6375 "ISO EBNF parser.") | |
6376 | |
6377 (autoload 'ebnf-iso-initialize "ebnf-iso" | |
6378 "Initialize ISO EBNF token table.") | |
6379 | |
6380 (autoload 'ebnf-yac-parser "ebnf-yac" | |
6381 "Yacc/Bison parser.") | |
6382 | |
6383 (autoload 'ebnf-yac-initialize "ebnf-yac" | |
6384 "Initializations for Yacc/Bison parser.") | |
6385 | |
54625 | 6386 (autoload 'ebnf-ebx-parser "ebnf-ebx" |
6387 "EBNFX parser.") | |
6388 | |
6389 (autoload 'ebnf-ebx-initialize "ebnf-ebx" | |
6390 "Initializations for EBNFX parser.") | |
6391 | |
54714 | 6392 (autoload 'ebnf-dtd-parser "ebnf-dtd" |
6393 "DTD parser.") | |
6394 | |
6395 (autoload 'ebnf-dtd-initialize "ebnf-dtd" | |
6396 "Initializations for DTD parser.") | |
27451 | 6397 |
6398 | |
6399 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
6400 | |
6401 | |
6402 (provide 'ebnf2ps) | |
6403 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
6404 ;; arch-tag: 148bc8af-5398-468b-b922-eeb7afef3e4f |
27451 | 6405 ;;; ebnf2ps.el ends here |