annotate lib-src/make-msgfile.lex @ 5707:5fd1b9a95531

Improve description of `mark-defun'.
author Stephen J. Turnbull <stephen@xemacs.org>
date Fri, 28 Dec 2012 23:11:32 +0900
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 %{
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 /* This is a Lex file. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 /* Localizable-message snarfing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 Copyright (C) 1994, 1995 Amdahl Corporation.
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
7 Copyright (C) 2010 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
11 XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
12 under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
13 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
14 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
16 XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
19 for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4950
diff changeset
22 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Written by Ben Wing, November 1994. Some code based on earlier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 make-msgfile.c. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
27 /* #### A comment:
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
28
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
29 Directly writing a lex file isn't right. We want to be able to specify
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
30 functions to snarf in simpler ways, e.g.
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
31
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
32 BEGIN_C_FUNCS
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
33
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
34 weird_doc (arg, snarf, snarf, arg);
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
35 signal_error (arg, snarf, arg);
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
36 etc.
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
37
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
38 END_C_FUNCS
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
39
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
40 In this case, `arg' indicates an arbitrary argument and `snarf' indicates
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
41 that when a quoted string is seen, it should be snarfed.
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
42
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
43 Then either we write a program to read this script and directly snarf
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
44 messages, or we write a program to convert the script into lex.
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
45
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
46 --ben, 1/26/10 */
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
47
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 440
diff changeset
48 /* See text.c for a proposal about how this whole system should work. */
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 440
diff changeset
49
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 /* Note: there is still much work to be done on this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 1) Definition of Arg below won't handle a generalized argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 as might appear in a function call. This is fine for DEFUN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 and friends, because only simple arguments appear there; but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 it might run into problems if Arg is used for other sorts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 of functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 2) snarf() should be modified so that it doesn't output null
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 strings and non-textual strings (see the comment at the top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 of make-msgfile.c).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 3) parsing of (insert) should snarf all of the arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 4) need to add set-keymap-prompt and deal with gettext of that.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 5) parsing of arguments should snarf all strings anywhere within
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 the arguments, rather than just looking for a string as the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 argument. This allows if statements as arguments to get parsed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 6) begin_paren_counting() et al. should handle recursive entry.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 7) handle set-window-buffer and other such functions that take
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 a buffer as the other-than-first argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 8) there is a fair amount of work to be done on the C code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Look through the code for #### comments associated with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 '#ifdef I18N3' or with an I18N3 nearby.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 9) Deal with `get-buffer-process' et al.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 10) Many of the changes in the Lisp code marked
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 'rewritten for I18N3 snarfing' should be undone once (5) is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 implemented.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 11) Go through the Lisp code in prim and make sure that all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 strings are gettexted as necessary. This may reveal more
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 things to implement.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 12) Do the equivalent of (8) for the Lisp code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 13) Deal with parsing of menu specifications.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 --ben
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 /* Some notes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 -- {Arg} below could get confused by commas inside of quotes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 -- {LispToken} below can match some things that are not tokens (e.g.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 numbers) but for all practical purposes it should be fine.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 int snarf_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 %}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 %p 6000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 %e 2000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 %n 1000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 %a 4000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 %s C_QUOTE C_COMMENT LQUO LCOM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 %s CSNARF LSNARF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 %s DO_C DO_LISP DEFUN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 %s DEFUN2 DEFUN3 LDEF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
107 W [ \t\n]
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
108 Any .|\n
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
109 Q \"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
110 Cm ,
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
111 NQ [^\"]
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
112 NT [^A-Za-z_0-9]
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
113 LP "("
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
114 RP ")"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
115 NQP [^\"()]
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
116 NQPCm [^,\"()]
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
117 BS "\\"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
118 Esc ({BS}{Any})
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
119 Wh ({W}*)
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
120 LCom (;({Esc}|.)*)
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
121 LWh ({W}|{LCom})*
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
122 Open {Wh}{LP}
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
123 OpWQ {Open}{Wh}{Q}
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
124 String {Q}({Esc}|{NQ})*{Q}
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
125 ParenExpr5 "("({String}|{NQP})*")"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
126 ParenExpr4 "("({String}|{NQP}|{ParenExpr5})*")"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
127 ParenExpr3 "("({String}|{NQP}|{ParenExpr4})*")"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
128 ParenExpr2 "("({String}|{NQP}|{ParenExpr3})*")"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
129 ParenExpr "("({String}|{NQP}|{ParenExpr5})*")"
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
130 Arg ({NQPCm}|{String}|{ParenExpr})*
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
131 ArgCm {Arg}{Cm}
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
132 StringArg {Wh}{String}{Wh}","
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
133 OpenString {Open}{StringArg}
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
134 LispToken ({Esc}|[-A-Za-z0-9!@$%^&*_=+|{}`~,<.>/?])+
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 %%
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 <DO_C>{NT}"GETTEXT"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 <DO_C>{NT}"DEFER_GETTEXT"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 <DO_C>{NT}"build_translated_string"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 <DO_C>{NT}"insert_string"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 <DO_C>{NT}"message"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 <DO_C>{NT}"warn_when_safe"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 <DO_C>{NT}"error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 <DO_C>{NT}"continuable_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 <DO_C>{NT}"signal_simple_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 <DO_C>{NT}"signal_simple_error_2"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 <DO_C>{NT}"signal_simple_continuable_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 <DO_C>{NT}"signal_simple_continuable_error_2"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 <DO_C>{NT}"report_file_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 <DO_C>{NT}"signal_file_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 <DO_C>{NT}"signal_double_file_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 <DO_C>{NT}"signal_double_file_error_2"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 <DO_C>{NT}"syntax_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 <DO_C>{NT}"continuable_syntax_error"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 <DO_C>{NT}"CTB_ERROR"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 <DO_C>{NT}"fatal"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 <DO_C>{NT}"stdout_out"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 <DO_C>{NT}"stderr_out"{OpWQ} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 <DO_C>{NT}"with_output_to_temp_buffer"{OpWQ} { snarf (); }
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
160 <DO_C>{NT}"weird_doc"{Open}{ArgCm}{Wh}{Q} { snarf (); /* #### FIXME snarf next arg() */}
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
162 <DO_C>{NT}"DEFVAR_BOOL"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
163 <DO_C>{NT}"DEFVAR_LISP"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
164 <DO_C>{NT}"DEFVAR_SPECIFIER"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
165 <DO_C>{NT}"DEFVAR_INT"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
166 <DO_C>{NT}"DEFVAR_BUFFER_LOCAL"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
167 <DO_C>{NT}"DEFVAR_BUFFER_DEFAULTS"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
168 <DO_C>{NT}"deferror"{Open}{ArgCm}{StringArg}{Wh}{Q} { snarf (); }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
170 <DO_C>{NT}"barf_or_query_if_file_exists"{Open}{ArgCm}{Wh}{Q} {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 /* #### see comment above about use of Arg */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 snarf ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 <DO_C>{NT}"DEFUN"{Open} { BEGIN DEFUN; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 <DO_C>"/*" {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 /* This is hateful, but doc strings are sometimes put inside of comments
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 (to get around limits in cpp), so we can't ignore stuff inside of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 comments. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 /* BEGIN C_COMMENT; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 <DO_C>{Q} { BEGIN C_QUOTE; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 <DO_C>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
186 <DEFUN>{StringArg}{ArgCm}{ArgCm}{ArgCm}{ArgCm}{Wh} { BEGIN DEFUN2; }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 <DEFUN>{Any} { bad_c_defun (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 <DEFUN2>{Q} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 /* We found an interactive specification. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 snarf_return_state = DEFUN3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 snarf ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 <DEFUN2>[^,]* {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 /* This function doesn't have an interactive specification.
4950
c50b0b3c7b8d Random changes to make-msgfile.lex
Ben Wing <ben@xemacs.org>
parents: 2367
diff changeset
196 Don't use {ArgCm} in the specification because DEFUN3 looks
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 for the comma. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 BEGIN DEFUN3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 <DEFUN3>{Wh}","{Wh}{Q} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 snarf_return_state = DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 snarf ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 <DEFUN3>{Any} { bad_c_defun (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 <C_QUOTE>{Esc} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 <C_QUOTE>{Q} { BEGIN DO_C; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 <C_QUOTE>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 <C_COMMENT>"*/" { BEGIN DO_C; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 <C_COMMENT>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 <DO_LISP>{LP}{LWh}"gettext"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 <DO_LISP>{LP}{LWh}"purecopy"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 <DO_LISP>{LP}{LWh}"interactive"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 <DO_LISP>{LP}{LWh}"message"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 <DO_LISP>{LP}{LWh}"error"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 <DO_LISP>{LP}{LWh}"warn"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 <DO_LISP>{LP}{LWh}"format"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 <DO_LISP>{LP}{LWh}"substitute-command-keys"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 <DO_LISP>{LP}{LWh}"temp-minibuffer-message"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 <DO_LISP>{LP}{LWh}"momentary-string-display"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 <DO_LISP>{LP}{LWh}"princ"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 <DO_LISP>{LP}{LWh}"prin1"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 <DO_LISP>{LP}{LWh}"prin1-to-string"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 <DO_LISP>{LP}{LWh}"print"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 <DO_LISP>{LP}{LWh}"insert"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 <DO_LISP>{LP}{LWh}"insert-before-markers"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 <DO_LISP>{LP}{LWh}"get-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 <DO_LISP>{LP}{LWh}"get-buffer-create"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 <DO_LISP>{LP}{LWh}"generate-new-buffer-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 <DO_LISP>{LP}{LWh}"rename-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 <DO_LISP>{LP}{LWh}"set-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 <DO_LISP>{LP}{LWh}"switch-to-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 <DO_LISP>{LP}{LWh}"pop-to-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 <DO_LISP>{LP}{LWh}"with-output-to-temp-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 <DO_LISP>{LP}{LWh}"buffer-enable-undo"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 <DO_LISP>{LP}{LWh}"buffer-disable-undo"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 <DO_LISP>{LP}{LWh}"get-buffer-window"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 <DO_LISP>{LP}{LWh}"delete-windows-on"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 <DO_LISP>{LP}{LWh}"replace-buffer-in-windows"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 <DO_LISP>{LP}{LWh}"display-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 <DO_LISP>{LP}{LWh}"other-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 <DO_LISP>{LP}{LWh}"read-from-minibuffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 <DO_LISP>{LP}{LWh}"read-shell-command"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 <DO_LISP>{LP}{LWh}"read-file-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 <DO_LISP>{LP}{LWh}"read-buffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 <DO_LISP>{LP}{LWh}"read-variable"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 <DO_LISP>{LP}{LWh}"read-command"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 <DO_LISP>{LP}{LWh}"read-function"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 <DO_LISP>{LP}{LWh}"read-directory-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 <DO_LISP>{LP}{LWh}"read-string"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 <DO_LISP>{LP}{LWh}"read-number"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 <DO_LISP>{LP}{LWh}"read-minibuffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 <DO_LISP>{LP}{LWh}"read-quoted-char"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 <DO_LISP>{LP}{LWh}"read-face-name"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 <DO_LISP>{LP}{LWh}"read-itimer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 <DO_LISP>{LP}{LWh}"completing-read"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 <DO_LISP>{LP}{LWh}"y-or-n-p"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 <DO_LISP>{LP}{LWh}"yes-or-no-p"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 <DO_LISP>{LP}{LWh}"query-replace-read-args"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 <DO_LISP>{LP}{LWh}"eval-minibuffer"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 <DO_LISP>{LP}{LWh}"edit-and-eval-command"{LWh}{Q} { inc_paren (); snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 <DO_LISP>{LP}{LWh}"defvar"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 <DO_LISP>{LP}{LWh}"defconst"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 <DO_LISP>{LP}{LWh}"defun"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 <DO_LISP>{LP}{LWh}"defmacro"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 <DO_LISP>{LP}{LWh}"defsubst"{LWh}{LispToken}{LWh} {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 inc_paren (); begin_paren_counting (LDEF);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 <DO_LISP>{Q} { BEGIN LQUO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 <DO_LISP>";" { BEGIN LCOM; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 <DO_LISP>{LP} { inc_paren (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 <DO_LISP>{RP} { dec_paren (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 <DO_LISP>{Esc} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 <DO_LISP>{W} { lisp_whitespace (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 <DO_LISP>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 <LQUO>{Esc} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 <LQUO>{Q} { BEGIN DO_LISP; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 <LQUO>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 <LCOM>"\n" { BEGIN DO_LISP; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 <LCOM>{Any} { }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 <LDEF>{LWh}{Q} { snarf (); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 <LDEF>{Any} { BEGIN DO_LISP; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 <CSNARF>{Esc} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 <CSNARF>{Q} { ECHO; fprintf (yyout, ")\n"); BEGIN snarf_return_state; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 <CSNARF>{Any} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 <LSNARF>{Esc} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 <LSNARF>"\n" { fprintf (yyout, "\\n\\\n"); }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 <LSNARF>{Q} { ECHO; fprintf (yyout, ")\n"); BEGIN snarf_return_state; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 <LSNARF>{Any} { ECHO; }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 %%
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 enum filetype { C_FILE, LISP_FILE, INVALID_FILE };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 /* some brain-dead headers define this ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 #undef FALSE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 #undef TRUE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 enum boolean { FALSE, TRUE };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 void scan_file (char *filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 void process_C_file (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 void process_Lisp_file (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 int in_c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 int in_paren_counting, paren_count;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 int paren_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 snarf ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 fprintf (yyout, "gettext(\"");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 if (in_c)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 BEGIN CSNARF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 BEGIN LSNARF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 bad_c_defun ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 fprintf (stderr, "Warning: Invalid DEFUN encountered in C, line %d.\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 yylineno);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 snarf_return_state = DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 BEGIN DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 /* REJECT; Sun's lex is broken! Use Flex! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 bad_lisp_def ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 fprintf (stderr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 "Warning: Invalid defmumble encountered in Lisp, line %d.\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 yylineno);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 snarf_return_state = DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 BEGIN DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 /* REJECT; Sun's lex is broken! Use Flex! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 inc_paren ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 if (in_paren_counting)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 paren_count++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 dec_paren ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 if (in_paren_counting)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 /* If we find a right paren without a matching left paren, it usually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 just indicates a statement like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 (defvar foo-mumble nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 where 'nil' is the sexp we are skipping over, and there's no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 doc string. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 if (paren_count > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 paren_count--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 unput (')');
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 if (paren_count == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 in_paren_counting = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 BEGIN paren_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 /* #### begin_paren_counting () does not handle recursive entries */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 begin_paren_counting (int return_state)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 in_paren_counting = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 paren_count = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 paren_return_state = return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 lisp_whitespace ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 if (in_paren_counting && !paren_count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 /* We got to the end of a token and we're not in a parenthesized
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 expression, so we're at the end of an sexp. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 in_paren_counting = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 BEGIN paren_return_state;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 yywrap ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 main (int argc, char *argv[])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 register int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 yyout = stdout;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 /* If first two args are -o FILE, output to FILE. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 i = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 if (argc > i + 1 && strcmp (argv[i], "-o") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 yyout = fopen (argv[++i], "w");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 ++i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 /* ...Or if args are -a FILE, append to FILE. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 if (argc > i + 1 && strcmp (argv[i], "-a") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 yyout = fopen (argv[++i], "a");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 ++i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 if (!yyout) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 fprintf (stderr, "Unable to open output file %s\n", argv[--i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 for (; i < argc; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 scan_file (argv[i]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 void scan_file (char *filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 enum filetype type = INVALID_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 register char *p = filename + strlen (filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 if (strcmp (p - 4, ".elc") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 *--p = '\0'; /* Use .el file instead */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 type = LISP_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 } else if (strcmp (p - 3, ".el") == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 type = LISP_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 else if (strcmp (p - 2, ".o") == 0) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 *--p = 'c'; /* Use .c file instead */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 type = C_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 } else if (strcmp (p - 2, ".c") == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 type = C_FILE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 if (type == INVALID_FILE) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 fprintf (stderr, "File %s being ignored\n", filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 yyin = fopen (filename, "r");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 if (!yyin) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 fprintf (stderr, "Unable to open input file %s\n", filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 fprintf (yyout, "/* %s */\n", filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 if (type == C_FILE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 process_C_file ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 process_Lisp_file ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 fputc ('\n', yyout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 fclose (yyin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 void process_C_file ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 snarf_return_state = DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 in_c = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 BEGIN DO_C;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 yylex ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 void process_Lisp_file ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 snarf_return_state = DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 in_c = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 BEGIN DO_LISP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 yylex ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489