1 |
dpavlin |
5 |
/* flexdef - definitions file for flex */ |
2 |
|
|
|
3 |
|
|
/*- |
4 |
|
|
* Copyright (c) 1990 The Regents of the University of California. |
5 |
|
|
* All rights reserved. |
6 |
|
|
* |
7 |
|
|
* This code is derived from software contributed to Berkeley by |
8 |
|
|
* Vern Paxson. |
9 |
|
|
* |
10 |
|
|
* The United States Government has rights in this work pursuant |
11 |
|
|
* to contract no. DE-AC03-76SF00098 between the United States |
12 |
|
|
* Department of Energy and the University of California. |
13 |
|
|
* |
14 |
|
|
* Redistribution and use in source and binary forms are permitted provided |
15 |
|
|
* that: (1) source distributions retain this entire copyright notice and |
16 |
|
|
* comment, and (2) distributions including binaries display the following |
17 |
|
|
* acknowledgement: ``This product includes software developed by the |
18 |
|
|
* University of California, Berkeley and its contributors'' in the |
19 |
|
|
* documentation or other materials provided with the distribution and in |
20 |
|
|
* all advertising materials mentioning features or use of this software. |
21 |
|
|
* Neither the name of the University nor the names of its contributors may |
22 |
|
|
* be used to endorse or promote products derived from this software without |
23 |
|
|
* specific prior written permission. |
24 |
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED |
25 |
|
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
26 |
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 |
|
|
*/ |
28 |
|
|
|
29 |
|
|
/* @(#) $Header: flexdef.h,v 1.2 94/01/04 14:33:14 vern Exp $ (LBL) */ |
30 |
|
|
|
31 |
|
|
#include <stdio.h> |
32 |
|
|
#include <ctype.h> |
33 |
|
|
|
34 |
|
|
/* jhjh */ |
35 |
|
|
#define SQL_SIZE 3000 |
36 |
|
|
|
37 |
|
|
#if HAVE_STRING_H |
38 |
|
|
#include <string.h> |
39 |
|
|
#else |
40 |
|
|
#include <strings.h> |
41 |
|
|
#endif |
42 |
|
|
|
43 |
|
|
#if __STDC__ |
44 |
|
|
#include <stdlib.h> |
45 |
|
|
#endif |
46 |
|
|
|
47 |
|
|
/* Always be prepared to generate an 8-bit scanner. */ |
48 |
|
|
#define CSIZE 256 |
49 |
|
|
#define Char unsigned char |
50 |
|
|
|
51 |
|
|
/* Size of input alphabet - should be size of ASCII set. */ |
52 |
|
|
#ifndef DEFAULT_CSIZE |
53 |
|
|
#define DEFAULT_CSIZE 128 |
54 |
|
|
#endif |
55 |
|
|
|
56 |
|
|
#ifndef PROTO |
57 |
|
|
#ifdef __STDC__ |
58 |
|
|
#define PROTO(proto) proto |
59 |
|
|
#else |
60 |
|
|
#define PROTO(proto) () |
61 |
|
|
#endif |
62 |
|
|
#endif |
63 |
|
|
|
64 |
|
|
#ifdef VMS |
65 |
|
|
#define unlink delete |
66 |
|
|
#define SHORT_FILE_NAMES |
67 |
|
|
#endif |
68 |
|
|
|
69 |
|
|
#ifdef MS_DOS |
70 |
|
|
#define SHORT_FILE_NAMES |
71 |
|
|
#endif |
72 |
|
|
|
73 |
|
|
|
74 |
|
|
/* Maximum line length we'll have to deal with. */ |
75 |
|
|
#define MAXLINE 2048 |
76 |
|
|
|
77 |
|
|
#ifndef MIN |
78 |
|
|
#define MIN(x,y) ((x) < (y) ? (x) : (y)) |
79 |
|
|
#endif |
80 |
|
|
#ifndef MAX |
81 |
|
|
#define MAX(x,y) ((x) > (y) ? (x) : (y)) |
82 |
|
|
#endif |
83 |
|
|
#ifndef ABS |
84 |
|
|
#define ABS(x) ((x) < 0 ? -(x) : (x)) |
85 |
|
|
#endif |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
/* ANSI C does not guarantee that isascii() is defined */ |
89 |
|
|
#ifndef isascii |
90 |
|
|
#define isascii(c) ((c) <= 0177) |
91 |
|
|
#endif |
92 |
|
|
|
93 |
|
|
|
94 |
|
|
#define true 1 |
95 |
|
|
#define false 0 |
96 |
|
|
|
97 |
|
|
|
98 |
|
|
/* Special chk[] values marking the slots taking by end-of-buffer and action |
99 |
|
|
* numbers. |
100 |
|
|
*/ |
101 |
|
|
#define EOB_POSITION -1 |
102 |
|
|
#define ACTION_POSITION -2 |
103 |
|
|
|
104 |
|
|
/* Number of data items per line for -f output. */ |
105 |
|
|
#define NUMDATAITEMS 10 |
106 |
|
|
|
107 |
|
|
/* Number of lines of data in -f output before inserting a blank line for |
108 |
|
|
* readability. |
109 |
|
|
*/ |
110 |
|
|
#define NUMDATALINES 10 |
111 |
|
|
|
112 |
|
|
/* Transition_struct_out() definitions. */ |
113 |
|
|
#define TRANS_STRUCT_PRINT_LENGTH 15 |
114 |
|
|
|
115 |
|
|
/* Returns true if an nfa state has an epsilon out-transition slot |
116 |
|
|
* that can be used. This definition is currently not used. |
117 |
|
|
*/ |
118 |
|
|
#define FREE_EPSILON(state) \ |
119 |
|
|
(transchar[state] == SYM_EPSILON && \ |
120 |
|
|
trans2[state] == NO_TRANSITION && \ |
121 |
|
|
finalst[state] != state) |
122 |
|
|
|
123 |
|
|
/* Returns true if an nfa state has an epsilon out-transition character |
124 |
|
|
* and both slots are free |
125 |
|
|
*/ |
126 |
|
|
#define SUPER_FREE_EPSILON(state) \ |
127 |
|
|
(transchar[state] == SYM_EPSILON && \ |
128 |
|
|
trans1[state] == NO_TRANSITION) \ |
129 |
|
|
|
130 |
|
|
/* Maximum number of NFA states that can comprise a DFA state. It's real |
131 |
|
|
* big because if there's a lot of rules, the initial state will have a |
132 |
|
|
* huge epsilon closure. |
133 |
|
|
*/ |
134 |
|
|
#define INITIAL_MAX_DFA_SIZE 750 |
135 |
|
|
#define MAX_DFA_SIZE_INCREMENT 750 |
136 |
|
|
|
137 |
|
|
|
138 |
|
|
/* A note on the following masks. They are used to mark accepting numbers |
139 |
|
|
* as being special. As such, they implicitly limit the number of accepting |
140 |
|
|
* numbers (i.e., rules) because if there are too many rules the rule numbers |
141 |
|
|
* will overload the mask bits. Fortunately, this limit is \large/ (0x2000 == |
142 |
|
|
* 8192) so unlikely to actually cause any problems. A check is made in |
143 |
|
|
* new_rule() to ensure that this limit is not reached. |
144 |
|
|
*/ |
145 |
|
|
|
146 |
|
|
/* Mask to mark a trailing context accepting number. */ |
147 |
|
|
#define YY_TRAILING_MASK 0x2000 |
148 |
|
|
|
149 |
|
|
/* Mask to mark the accepting number of the "head" of a trailing context |
150 |
|
|
* rule. |
151 |
|
|
*/ |
152 |
|
|
#define YY_TRAILING_HEAD_MASK 0x4000 |
153 |
|
|
|
154 |
|
|
/* Maximum number of rules, as outlined in the above note. */ |
155 |
|
|
#define MAX_RULE (YY_TRAILING_MASK - 1) |
156 |
|
|
|
157 |
|
|
|
158 |
|
|
/* NIL must be 0. If not, its special meaning when making equivalence classes |
159 |
|
|
* (it marks the representative of a given e.c.) will be unidentifiable. |
160 |
|
|
*/ |
161 |
|
|
#define NIL 0 |
162 |
|
|
|
163 |
|
|
#define JAM -1 /* to mark a missing DFA transition */ |
164 |
|
|
#define NO_TRANSITION NIL |
165 |
|
|
#ifdef VMS |
166 |
|
|
#define UNIQUE -1 /* marks a symbol as an e.c. representative */ |
167 |
|
|
#define INFINITY -1 /* for x{5,} constructions */ |
168 |
|
|
#endif |
169 |
|
|
|
170 |
|
|
#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */ |
171 |
|
|
#define MAX_CCLS_INCREMENT 100 |
172 |
|
|
|
173 |
|
|
/* Size of table holding members of character classes. */ |
174 |
|
|
#define INITIAL_MAX_CCL_TBL_SIZE 500 |
175 |
|
|
#define MAX_CCL_TBL_SIZE_INCREMENT 250 |
176 |
|
|
|
177 |
|
|
#define INITIAL_MAX_RULES 100 /* default maximum number of rules */ |
178 |
|
|
#define MAX_RULES_INCREMENT 100 |
179 |
|
|
|
180 |
|
|
#define INITIAL_MNS 2000 /* default maximum number of nfa states */ |
181 |
|
|
#define MNS_INCREMENT 1000 /* amount to bump above by if it's not enough */ |
182 |
|
|
|
183 |
|
|
#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */ |
184 |
|
|
#define MAX_DFAS_INCREMENT 1000 |
185 |
|
|
|
186 |
|
|
#define JAMSTATE -32766 /* marks a reference to the state that always jams */ |
187 |
|
|
|
188 |
|
|
/* Enough so that if it's subtracted from an NFA state number, the result |
189 |
|
|
* is guaranteed to be negative. |
190 |
|
|
*/ |
191 |
|
|
#define MARKER_DIFFERENCE 32000 |
192 |
|
|
#define MAXIMUM_MNS 31999 |
193 |
|
|
|
194 |
|
|
/* Maximum number of nxt/chk pairs for non-templates. */ |
195 |
|
|
#define INITIAL_MAX_XPAIRS 2000 |
196 |
|
|
#define MAX_XPAIRS_INCREMENT 2000 |
197 |
|
|
|
198 |
|
|
/* Maximum number of nxt/chk pairs needed for templates. */ |
199 |
|
|
#define INITIAL_MAX_TEMPLATE_XPAIRS 2500 |
200 |
|
|
#define MAX_TEMPLATE_XPAIRS_INCREMENT 2500 |
201 |
|
|
|
202 |
|
|
#define SYM_EPSILON (CSIZE + 1) /* to mark transitions on the symbol epsilon */ |
203 |
|
|
|
204 |
|
|
#define INITIAL_MAX_SCS 40 /* maximum number of start conditions */ |
205 |
|
|
#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */ |
206 |
|
|
|
207 |
|
|
#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */ |
208 |
|
|
#define SAME_TRANS -1 /* transition is the same as "default" entry for state */ |
209 |
|
|
|
210 |
|
|
/* The following percentages are used to tune table compression: |
211 |
|
|
|
212 |
|
|
* The percentage the number of out-transitions a state must be of the |
213 |
|
|
* number of equivalence classes in order to be considered for table |
214 |
|
|
* compaction by using protos. |
215 |
|
|
*/ |
216 |
|
|
#define PROTO_SIZE_PERCENTAGE 15 |
217 |
|
|
|
218 |
|
|
/* The percentage the number of homogeneous out-transitions of a state |
219 |
|
|
* must be of the number of total out-transitions of the state in order |
220 |
|
|
* that the state's transition table is first compared with a potential |
221 |
|
|
* template of the most common out-transition instead of with the first |
222 |
|
|
* proto in the proto queue. |
223 |
|
|
*/ |
224 |
|
|
#define CHECK_COM_PERCENTAGE 50 |
225 |
|
|
|
226 |
|
|
/* The percentage the number of differences between a state's transition |
227 |
|
|
* table and the proto it was first compared with must be of the total |
228 |
|
|
* number of out-transitions of the state in order to keep the first |
229 |
|
|
* proto as a good match and not search any further. |
230 |
|
|
*/ |
231 |
|
|
#define FIRST_MATCH_DIFF_PERCENTAGE 10 |
232 |
|
|
|
233 |
|
|
/* The percentage the number of differences between a state's transition |
234 |
|
|
* table and the most similar proto must be of the state's total number |
235 |
|
|
* of out-transitions to use the proto as an acceptable close match. |
236 |
|
|
*/ |
237 |
|
|
#define ACCEPTABLE_DIFF_PERCENTAGE 50 |
238 |
|
|
|
239 |
|
|
/* The percentage the number of homogeneous out-transitions of a state |
240 |
|
|
* must be of the number of total out-transitions of the state in order |
241 |
|
|
* to consider making a template from the state. |
242 |
|
|
*/ |
243 |
|
|
#define TEMPLATE_SAME_PERCENTAGE 60 |
244 |
|
|
|
245 |
|
|
/* The percentage the number of differences between a state's transition |
246 |
|
|
* table and the most similar proto must be of the state's total number |
247 |
|
|
* of out-transitions to create a new proto from the state. |
248 |
|
|
*/ |
249 |
|
|
#define NEW_PROTO_DIFF_PERCENTAGE 20 |
250 |
|
|
|
251 |
|
|
/* The percentage the total number of out-transitions of a state must be |
252 |
|
|
* of the number of equivalence classes in order to consider trying to |
253 |
|
|
* fit the transition table into "holes" inside the nxt/chk table. |
254 |
|
|
*/ |
255 |
|
|
#define INTERIOR_FIT_PERCENTAGE 15 |
256 |
|
|
|
257 |
|
|
/* Size of region set aside to cache the complete transition table of |
258 |
|
|
* protos on the proto queue to enable quick comparisons. |
259 |
|
|
*/ |
260 |
|
|
#define PROT_SAVE_SIZE 2000 |
261 |
|
|
|
262 |
|
|
#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */ |
263 |
|
|
|
264 |
|
|
/* Maximum number of out-transitions a state can have that we'll rummage |
265 |
|
|
* around through the interior of the internal fast table looking for a |
266 |
|
|
* spot for it. |
267 |
|
|
*/ |
268 |
|
|
#define MAX_XTIONS_FULL_INTERIOR_FIT 4 |
269 |
|
|
|
270 |
|
|
/* Maximum number of rules which will be reported as being associated |
271 |
|
|
* with a DFA state. |
272 |
|
|
*/ |
273 |
|
|
#define MAX_ASSOC_RULES 100 |
274 |
|
|
|
275 |
|
|
/* Number that, if used to subscript an array, has a good chance of producing |
276 |
|
|
* an error; should be small enough to fit into a short. |
277 |
|
|
*/ |
278 |
|
|
#define BAD_SUBSCRIPT -32767 |
279 |
|
|
|
280 |
|
|
/* Absolute value of largest number that can be stored in a short, with a |
281 |
|
|
* bit of slop thrown in for general paranoia. |
282 |
|
|
*/ |
283 |
|
|
#define MAX_SHORT 32700 |
284 |
|
|
|
285 |
|
|
|
286 |
|
|
/* Declarations for global variables. */ |
287 |
|
|
|
288 |
|
|
/* Variables for symbol tables: |
289 |
|
|
* sctbl - start-condition symbol table |
290 |
|
|
* ndtbl - name-definition symbol table |
291 |
|
|
* ccltab - character class text symbol table |
292 |
|
|
*/ |
293 |
|
|
|
294 |
|
|
struct hash_entry |
295 |
|
|
{ |
296 |
|
|
struct hash_entry *prev, *next; |
297 |
|
|
char *name; |
298 |
|
|
char *str_val; |
299 |
|
|
int int_val; |
300 |
|
|
} ; |
301 |
|
|
|
302 |
|
|
typedef struct hash_entry **hash_table; |
303 |
|
|
|
304 |
|
|
#define NAME_TABLE_HASH_SIZE 101 |
305 |
|
|
#define START_COND_HASH_SIZE 101 |
306 |
|
|
#define CCL_HASH_SIZE 101 |
307 |
|
|
|
308 |
|
|
extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; |
309 |
|
|
extern struct hash_entry *sctbl[START_COND_HASH_SIZE]; |
310 |
|
|
extern struct hash_entry *ccltab[CCL_HASH_SIZE]; |
311 |
|
|
|
312 |
|
|
|
313 |
|
|
/* Variables for flags: |
314 |
|
|
* printstats - if true (-v), dump statistics |
315 |
|
|
* syntaxerror - true if a syntax error has been found |
316 |
|
|
* eofseen - true if we've seen an eof in the input file |
317 |
|
|
* ddebug - if true (-d), make a "debug" scanner |
318 |
|
|
* trace - if true (-T), trace processing |
319 |
|
|
* nowarn - if true (-w), do not generate warnings |
320 |
|
|
* spprdflt - if true (-s), suppress the default rule |
321 |
|
|
* interactive - if true (-I), generate an interactive scanner |
322 |
|
|
* caseins - if true (-i), generate a case-insensitive scanner |
323 |
|
|
* lex_compat - if true (-l), maximize compatibility with AT&T lex |
324 |
|
|
* useecs - if true (-Ce flag), use equivalence classes |
325 |
|
|
* fulltbl - if true (-Cf flag), don't compress the DFA state table |
326 |
|
|
* usemecs - if true (-Cm flag), use meta-equivalence classes |
327 |
|
|
* fullspd - if true (-F flag), use Jacobson method of table representation |
328 |
|
|
* gen_line_dirs - if true (i.e., no -L flag), generate #line directives |
329 |
|
|
* performance_report - if > 0 (i.e., -p flag), generate a report relating |
330 |
|
|
* to scanner performance; if > 1 (-p -p), report on minor performance |
331 |
|
|
* problems, too |
332 |
|
|
* backing_up_report - if true (i.e., -b flag), generate "lex.backup" file |
333 |
|
|
* listing backing-up states |
334 |
|
|
* C_plus_plus - if true (i.e., -+ flag), generate a C++ scanner class; |
335 |
|
|
* otherwise, a standard C scanner |
336 |
|
|
* long_align - if true (-Ca flag), favor long-word alignment. |
337 |
|
|
* use_read - if true (-f, -F, or -Cr) then use read() for scanner input; |
338 |
|
|
* otherwise, use fread(). |
339 |
|
|
* yytext_is_array - if true (i.e., %array directive), then declare |
340 |
|
|
* yytext as a array instead of a character pointer. Nice and inefficient. |
341 |
|
|
* csize - size of character set for the scanner we're generating; |
342 |
|
|
* 128 for 7-bit chars and 256 for 8-bit |
343 |
|
|
* yymore_used - if true, yymore() is used in input rules |
344 |
|
|
* reject - if true, generate back-up tables for REJECT macro |
345 |
|
|
* real_reject - if true, scanner really uses REJECT (as opposed to just |
346 |
|
|
* having "reject" set for variable trailing context) |
347 |
|
|
* continued_action - true if this rule's action is to "fall through" to |
348 |
|
|
* the next rule's action (i.e., the '|' action) |
349 |
|
|
* yymore_really_used - has a REALLY_xxx value indicating whether a |
350 |
|
|
* %used or %notused was used with yymore() |
351 |
|
|
* reject_really_used - same for REJECT |
352 |
|
|
*/ |
353 |
|
|
|
354 |
|
|
extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, spprdflt; |
355 |
|
|
extern int interactive, caseins, lex_compat, useecs, fulltbl, usemecs; |
356 |
|
|
extern int fullspd, gen_line_dirs, performance_report, backing_up_report; |
357 |
|
|
extern int C_plus_plus, long_align, use_read, yytext_is_array, csize; |
358 |
|
|
extern int yymore_used, reject, real_reject, continued_action; |
359 |
|
|
|
360 |
|
|
#define REALLY_NOT_DETERMINED 0 |
361 |
|
|
#define REALLY_USED 1 |
362 |
|
|
#define REALLY_NOT_USED 2 |
363 |
|
|
extern int yymore_really_used, reject_really_used; |
364 |
|
|
|
365 |
|
|
|
366 |
|
|
/* Variables used in the flex input routines: |
367 |
|
|
* datapos - characters on current output line |
368 |
|
|
* dataline - number of contiguous lines of data in current data |
369 |
|
|
* statement. Used to generate readable -f output |
370 |
|
|
* linenum - current input line number |
371 |
|
|
* skelfile - the skeleton file |
372 |
|
|
* skel - compiled-in skeleton array |
373 |
|
|
* skel_ind - index into "skel" array, if skelfile is nil |
374 |
|
|
* yyin - input file |
375 |
|
|
* backing_up_file - file to summarize backing-up states to |
376 |
|
|
* infilename - name of input file |
377 |
|
|
* input_files - array holding names of input files |
378 |
|
|
* num_input_files - size of input_files array |
379 |
|
|
* program_name - name with which program was invoked |
380 |
|
|
* |
381 |
|
|
* action_array - array to hold the rule actions |
382 |
|
|
* action_size - size of action_array |
383 |
|
|
* defs1_offset - index where the user's section 1 definitions start |
384 |
|
|
* in action_array |
385 |
|
|
* prolog_offset - index where the prolog starts in action_array |
386 |
|
|
* action_offset - index where the non-prolog starts in action_array |
387 |
|
|
* action_index - index where the next action should go, with respect |
388 |
|
|
* to "action_array" |
389 |
|
|
*/ |
390 |
|
|
|
391 |
|
|
extern int datapos, dataline, linenum; |
392 |
|
|
extern FILE *skelfile, *yyin, *backing_up_file; |
393 |
|
|
extern char *skel[]; |
394 |
|
|
extern int skel_ind; |
395 |
|
|
extern char *infilename; |
396 |
|
|
extern char **input_files; |
397 |
|
|
extern int num_input_files; |
398 |
|
|
extern char *program_name; |
399 |
|
|
|
400 |
|
|
extern char *action_array; |
401 |
|
|
extern int action_size; |
402 |
|
|
extern int defs1_offset, prolog_offset, action_offset, action_index; |
403 |
|
|
|
404 |
|
|
|
405 |
|
|
/* Variables for stack of states having only one out-transition: |
406 |
|
|
* onestate - state number |
407 |
|
|
* onesym - transition symbol |
408 |
|
|
* onenext - target state |
409 |
|
|
* onedef - default base entry |
410 |
|
|
* onesp - stack pointer |
411 |
|
|
*/ |
412 |
|
|
|
413 |
|
|
extern int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE]; |
414 |
|
|
extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp; |
415 |
|
|
|
416 |
|
|
|
417 |
|
|
/* Variables for nfa machine data: |
418 |
|
|
* current_mns - current maximum on number of NFA states |
419 |
|
|
* num_rules - number of the last accepting state; also is number of |
420 |
|
|
* rules created so far |
421 |
|
|
* num_eof_rules - number of <<EOF>> rules |
422 |
|
|
* default_rule - number of the default rule |
423 |
|
|
* current_max_rules - current maximum number of rules |
424 |
|
|
* lastnfa - last nfa state number created |
425 |
|
|
* firstst - physically the first state of a fragment |
426 |
|
|
* lastst - last physical state of fragment |
427 |
|
|
* finalst - last logical state of fragment |
428 |
|
|
* transchar - transition character |
429 |
|
|
* trans1 - transition state |
430 |
|
|
* trans2 - 2nd transition state for epsilons |
431 |
|
|
* accptnum - accepting number |
432 |
|
|
* assoc_rule - rule associated with this NFA state (or 0 if none) |
433 |
|
|
* state_type - a STATE_xxx type identifying whether the state is part |
434 |
|
|
* of a normal rule, the leading state in a trailing context |
435 |
|
|
* rule (i.e., the state which marks the transition from |
436 |
|
|
* recognizing the text-to-be-matched to the beginning of |
437 |
|
|
* the trailing context), or a subsequent state in a trailing |
438 |
|
|
* context rule |
439 |
|
|
* rule_type - a RULE_xxx type identifying whether this a ho-hum |
440 |
|
|
* normal rule or one which has variable head & trailing |
441 |
|
|
* context |
442 |
|
|
* rule_linenum - line number associated with rule |
443 |
|
|
* rule_useful - true if we've determined that the rule can be matched |
444 |
|
|
*/ |
445 |
|
|
|
446 |
|
|
extern int current_mns, num_rules, num_eof_rules, default_rule; |
447 |
|
|
extern int current_max_rules, lastnfa; |
448 |
|
|
extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2; |
449 |
|
|
extern int *accptnum, *assoc_rule, *state_type; |
450 |
|
|
extern int *rule_type, *rule_linenum, *rule_useful; |
451 |
|
|
|
452 |
|
|
/* Different types of states; values are useful as masks, as well, for |
453 |
|
|
* routines like check_trailing_context(). |
454 |
|
|
*/ |
455 |
|
|
#define STATE_NORMAL 0x1 |
456 |
|
|
#define STATE_TRAILING_CONTEXT 0x2 |
457 |
|
|
|
458 |
|
|
/* Global holding current type of state we're making. */ |
459 |
|
|
|
460 |
|
|
extern int current_state_type; |
461 |
|
|
|
462 |
|
|
/* Different types of rules. */ |
463 |
|
|
#define RULE_NORMAL 0 |
464 |
|
|
#define RULE_VARIABLE 1 |
465 |
|
|
|
466 |
|
|
/* True if the input rules include a rule with both variable-length head |
467 |
|
|
* and trailing context, false otherwise. |
468 |
|
|
*/ |
469 |
|
|
extern int variable_trailing_context_rules; |
470 |
|
|
|
471 |
|
|
|
472 |
|
|
/* Variables for protos: |
473 |
|
|
* numtemps - number of templates created |
474 |
|
|
* numprots - number of protos created |
475 |
|
|
* protprev - backlink to a more-recently used proto |
476 |
|
|
* protnext - forward link to a less-recently used proto |
477 |
|
|
* prottbl - base/def table entry for proto |
478 |
|
|
* protcomst - common state of proto |
479 |
|
|
* firstprot - number of the most recently used proto |
480 |
|
|
* lastprot - number of the least recently used proto |
481 |
|
|
* protsave contains the entire state array for protos |
482 |
|
|
*/ |
483 |
|
|
|
484 |
|
|
extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP]; |
485 |
|
|
extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE]; |
486 |
|
|
|
487 |
|
|
|
488 |
|
|
/* Variables for managing equivalence classes: |
489 |
|
|
* numecs - number of equivalence classes |
490 |
|
|
* nextecm - forward link of Equivalence Class members |
491 |
|
|
* ecgroup - class number or backward link of EC members |
492 |
|
|
* nummecs - number of meta-equivalence classes (used to compress |
493 |
|
|
* templates) |
494 |
|
|
* tecfwd - forward link of meta-equivalence classes members |
495 |
|
|
* tecbck - backward link of MEC's |
496 |
|
|
*/ |
497 |
|
|
|
498 |
|
|
/* Reserve enough room in the equivalence class arrays so that we |
499 |
|
|
* can use the CSIZE'th element to hold equivalence class information |
500 |
|
|
* for the NUL character. Later we'll move this information into |
501 |
|
|
* the 0th element. |
502 |
|
|
*/ |
503 |
|
|
extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs; |
504 |
|
|
|
505 |
|
|
/* Meta-equivalence classes are indexed starting at 1, so it's possible |
506 |
|
|
* that they will require positions from 1 .. CSIZE, i.e., CSIZE + 1 |
507 |
|
|
* slots total (since the arrays are 0-based). nextecm[] and ecgroup[] |
508 |
|
|
* don't require the extra position since they're indexed from 1 .. CSIZE - 1. |
509 |
|
|
*/ |
510 |
|
|
extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1]; |
511 |
|
|
|
512 |
|
|
|
513 |
|
|
/* Variables for start conditions: |
514 |
|
|
* lastsc - last start condition created |
515 |
|
|
* current_max_scs - current limit on number of start conditions |
516 |
|
|
* scset - set of rules active in start condition |
517 |
|
|
* scbol - set of rules active only at the beginning of line in a s.c. |
518 |
|
|
* scxclu - true if start condition is exclusive |
519 |
|
|
* sceof - true if start condition has EOF rule |
520 |
|
|
* scname - start condition name |
521 |
|
|
* actvsc - stack of active start conditions for the current rule; |
522 |
|
|
* a negative entry means that the start condition is *not* |
523 |
|
|
* active for the current rule. Start conditions may appear |
524 |
|
|
* multiple times on the stack; the entry for it closest |
525 |
|
|
* to the top of the stack (i.e., actvsc[actvp]) is the |
526 |
|
|
* one to use. Others are present from "<sc>{" scoping |
527 |
|
|
* constructs. |
528 |
|
|
*/ |
529 |
|
|
|
530 |
|
|
extern int lastsc, current_max_scs, *scset, *scbol, *scxclu, *sceof, *actvsc; |
531 |
|
|
extern char **scname; |
532 |
|
|
|
533 |
|
|
|
534 |
|
|
/* Variables for dfa machine data: |
535 |
|
|
* current_max_dfa_size - current maximum number of NFA states in DFA |
536 |
|
|
* current_max_xpairs - current maximum number of non-template xtion pairs |
537 |
|
|
* current_max_template_xpairs - current maximum number of template pairs |
538 |
|
|
* current_max_dfas - current maximum number DFA states |
539 |
|
|
* lastdfa - last dfa state number created |
540 |
|
|
* nxt - state to enter upon reading character |
541 |
|
|
* chk - check value to see if "nxt" applies |
542 |
|
|
* tnxt - internal nxt table for templates |
543 |
|
|
* base - offset into "nxt" for given state |
544 |
|
|
* def - where to go if "chk" disallows "nxt" entry |
545 |
|
|
* nultrans - NUL transition for each state |
546 |
|
|
* NUL_ec - equivalence class of the NUL character |
547 |
|
|
* tblend - last "nxt/chk" table entry being used |
548 |
|
|
* firstfree - first empty entry in "nxt/chk" table |
549 |
|
|
* dss - nfa state set for each dfa |
550 |
|
|
* dfasiz - size of nfa state set for each dfa |
551 |
|
|
* dfaacc - accepting set for each dfa state (if using REJECT), or accepting |
552 |
|
|
* number, if not |
553 |
|
|
* accsiz - size of accepting set for each dfa state |
554 |
|
|
* dhash - dfa state hash value |
555 |
|
|
* numas - number of DFA accepting states created; note that this |
556 |
|
|
* is not necessarily the same value as num_rules, which is the analogous |
557 |
|
|
* value for the NFA |
558 |
|
|
* numsnpairs - number of state/nextstate transition pairs |
559 |
|
|
* jambase - position in base/def where the default jam table starts |
560 |
|
|
* jamstate - state number corresponding to "jam" state |
561 |
|
|
* end_of_buffer_state - end-of-buffer dfa state number |
562 |
|
|
*/ |
563 |
|
|
|
564 |
|
|
extern int current_max_dfa_size, current_max_xpairs; |
565 |
|
|
extern int current_max_template_xpairs, current_max_dfas; |
566 |
|
|
extern int lastdfa, *nxt, *chk, *tnxt; |
567 |
|
|
extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz; |
568 |
|
|
extern union dfaacc_union |
569 |
|
|
{ |
570 |
|
|
int *dfaacc_set; |
571 |
|
|
int dfaacc_state; |
572 |
|
|
} *dfaacc; |
573 |
|
|
extern int *accsiz, *dhash, numas; |
574 |
|
|
extern int numsnpairs, jambase, jamstate; |
575 |
|
|
extern int end_of_buffer_state; |
576 |
|
|
|
577 |
|
|
/* Variables for ccl information: |
578 |
|
|
* lastccl - ccl index of the last created ccl |
579 |
|
|
* current_maxccls - current limit on the maximum number of unique ccl's |
580 |
|
|
* cclmap - maps a ccl index to its set pointer |
581 |
|
|
* ccllen - gives the length of a ccl |
582 |
|
|
* cclng - true for a given ccl if the ccl is negated |
583 |
|
|
* cclreuse - counts how many times a ccl is re-used |
584 |
|
|
* current_max_ccl_tbl_size - current limit on number of characters needed |
585 |
|
|
* to represent the unique ccl's |
586 |
|
|
* ccltbl - holds the characters in each ccl - indexed by cclmap |
587 |
|
|
*/ |
588 |
|
|
|
589 |
|
|
extern int lastccl, current_maxccls, *cclmap, *ccllen, *cclng, cclreuse; |
590 |
|
|
extern int current_max_ccl_tbl_size; |
591 |
|
|
extern Char *ccltbl; |
592 |
|
|
|
593 |
|
|
|
594 |
|
|
/* Variables for miscellaneous information: |
595 |
|
|
* nmstr - last NAME scanned by the scanner |
596 |
|
|
* sectnum - section number currently being parsed |
597 |
|
|
* nummt - number of empty nxt/chk table entries |
598 |
|
|
* hshcol - number of hash collisions detected by snstods |
599 |
|
|
* dfaeql - number of times a newly created dfa was equal to an old one |
600 |
|
|
* numeps - number of epsilon NFA states created |
601 |
|
|
* eps2 - number of epsilon states which have 2 out-transitions |
602 |
|
|
* num_reallocs - number of times it was necessary to realloc() a group |
603 |
|
|
* of arrays |
604 |
|
|
* tmpuses - number of DFA states that chain to templates |
605 |
|
|
* totnst - total number of NFA states used to make DFA states |
606 |
|
|
* peakpairs - peak number of transition pairs we had to store internally |
607 |
|
|
* numuniq - number of unique transitions |
608 |
|
|
* numdup - number of duplicate transitions |
609 |
|
|
* hshsave - number of hash collisions saved by checking number of states |
610 |
|
|
* num_backing_up - number of DFA states requiring backing up |
611 |
|
|
* bol_needed - whether scanner needs beginning-of-line recognition |
612 |
|
|
*/ |
613 |
|
|
|
614 |
|
|
extern char nmstr[MAXLINE]; |
615 |
|
|
extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs; |
616 |
|
|
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave; |
617 |
|
|
extern int num_backing_up, bol_needed; |
618 |
|
|
|
619 |
|
|
void *allocate_array PROTO((int, int)); |
620 |
|
|
void *reallocate_array PROTO((void*, int, int)); |
621 |
|
|
|
622 |
|
|
void *flex_alloc PROTO((unsigned int)); |
623 |
|
|
void *flex_realloc PROTO((void*, unsigned int)); |
624 |
|
|
void flex_free PROTO((void*)); |
625 |
|
|
|
626 |
|
|
#define allocate_integer_array(size) \ |
627 |
|
|
(int *) allocate_array( size, sizeof( int ) ) |
628 |
|
|
|
629 |
|
|
#define reallocate_integer_array(array,size) \ |
630 |
|
|
(int *) reallocate_array( (void *) array, size, sizeof( int ) ) |
631 |
|
|
|
632 |
|
|
#define allocate_int_ptr_array(size) \ |
633 |
|
|
(int **) allocate_array( size, sizeof( int * ) ) |
634 |
|
|
|
635 |
|
|
#define allocate_char_ptr_array(size) \ |
636 |
|
|
(char **) allocate_array( size, sizeof( char * ) ) |
637 |
|
|
|
638 |
|
|
#define allocate_dfaacc_union(size) \ |
639 |
|
|
(union dfaacc_union *) \ |
640 |
|
|
allocate_array( size, sizeof( union dfaacc_union ) ) |
641 |
|
|
|
642 |
|
|
#define reallocate_int_ptr_array(array,size) \ |
643 |
|
|
(int **) reallocate_array( (void *) array, size, sizeof( int * ) ) |
644 |
|
|
|
645 |
|
|
#define reallocate_char_ptr_array(array,size) \ |
646 |
|
|
(char **) reallocate_array( (void *) array, size, sizeof( char * ) ) |
647 |
|
|
|
648 |
|
|
#define reallocate_dfaacc_union(array, size) \ |
649 |
|
|
(union dfaacc_union *) \ |
650 |
|
|
reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) ) |
651 |
|
|
|
652 |
|
|
#define allocate_character_array(size) \ |
653 |
|
|
(char *) allocate_array( size, sizeof( char ) ) |
654 |
|
|
|
655 |
|
|
#define reallocate_character_array(array,size) \ |
656 |
|
|
(char *) reallocate_array( (void *) array, size, sizeof( char ) ) |
657 |
|
|
|
658 |
|
|
#define allocate_Character_array(size) \ |
659 |
|
|
(Char *) allocate_array( size, sizeof( Char ) ) |
660 |
|
|
|
661 |
|
|
#define reallocate_Character_array(array,size) \ |
662 |
|
|
(Char *) reallocate_array( (void *) array, size, sizeof( Char ) ) |
663 |
|
|
|
664 |
|
|
|
665 |
|
|
/* Used to communicate between scanner and parser. The type should really |
666 |
|
|
* be YYSTYPE, but we can't easily get our hands on it. |
667 |
|
|
*/ |
668 |
|
|
/* extern int yylval; jhjh */ |
669 |
|
|
|
670 |
|
|
typedef union { |
671 |
|
|
int intval; |
672 |
|
|
double floatval; |
673 |
|
|
char strval[SQL_SIZE]; |
674 |
|
|
int subtok; } YYSTYPE_jh; /* jhjh - perly.h defines a different |
675 |
|
|
YYSTYPE */ |
676 |
|
|
|
677 |
|
|
extern YYSTYPE_jh yylval_jh; /* jhjh - likewise */ |
678 |
|
|
|
679 |
|
|
/* jhjh - try below */ |
680 |
|
|
#define YYSTYPE YYSTYPE_jh |
681 |
|
|
#define yylval yylval_jh |
682 |
|
|
|
683 |
|
|
/* External functions that are cross-referenced among the flex source files. */ |
684 |
|
|
|
685 |
|
|
|
686 |
|
|
/* from file ccl.c */ |
687 |
|
|
|
688 |
|
|
extern void ccladd PROTO((int, int)); /* add a single character to a ccl */ |
689 |
|
|
extern int cclinit PROTO((void)); /* make an empty ccl */ |
690 |
|
|
extern void cclnegate PROTO((int)); /* negate a ccl */ |
691 |
|
|
|
692 |
|
|
/* List the members of a set of characters in CCL form. */ |
693 |
|
|
extern void list_character_set PROTO((FILE*, int[])); |
694 |
|
|
|
695 |
|
|
|
696 |
|
|
/* from file dfa.c */ |
697 |
|
|
|
698 |
|
|
/* Increase the maximum number of dfas. */ |
699 |
|
|
extern void increase_max_dfas PROTO((void)); |
700 |
|
|
|
701 |
|
|
extern void ntod PROTO((void)); /* convert a ndfa to a dfa */ |
702 |
|
|
|
703 |
|
|
|
704 |
|
|
/* from file ecs.c */ |
705 |
|
|
|
706 |
|
|
/* Convert character classes to set of equivalence classes. */ |
707 |
|
|
extern void ccl2ecl PROTO((void)); |
708 |
|
|
|
709 |
|
|
/* Associate equivalence class numbers with class members. */ |
710 |
|
|
extern int cre8ecs PROTO((int[], int[], int)); |
711 |
|
|
|
712 |
|
|
/* Update equivalence classes based on character class transitions. */ |
713 |
|
|
extern void mkeccl PROTO((Char[], int, int[], int[], int, int)); |
714 |
|
|
|
715 |
|
|
/* Create equivalence class for single character. */ |
716 |
|
|
extern void mkechar PROTO((int, int[], int[])); |
717 |
|
|
|
718 |
|
|
|
719 |
|
|
/* from file gen.c */ |
720 |
|
|
|
721 |
|
|
extern void make_tables PROTO((void)); /* generate transition tables */ |
722 |
|
|
|
723 |
|
|
|
724 |
|
|
/* from file main.c */ |
725 |
|
|
|
726 |
|
|
extern void flexend PROTO((int)); |
727 |
|
|
extern void usage PROTO((void)); |
728 |
|
|
|
729 |
|
|
|
730 |
|
|
/* from file misc.c */ |
731 |
|
|
|
732 |
|
|
/* Add the given text to the stored actions. */ |
733 |
|
|
extern void add_action PROTO(( char *new_text )); |
734 |
|
|
|
735 |
|
|
/* True if a string is all lower case. */ |
736 |
|
|
extern int all_lower PROTO((register char *)); |
737 |
|
|
|
738 |
|
|
/* True if a string is all upper case. */ |
739 |
|
|
extern int all_upper PROTO((register char *)); |
740 |
|
|
|
741 |
|
|
/* Bubble sort an integer array. */ |
742 |
|
|
extern void bubble PROTO((int [], int)); |
743 |
|
|
|
744 |
|
|
/* Check a character to make sure it's in the expected range. */ |
745 |
|
|
extern void check_char PROTO((int c)); |
746 |
|
|
|
747 |
|
|
/* Shell sort a character array. */ |
748 |
|
|
extern void cshell PROTO((Char [], int, int)); |
749 |
|
|
|
750 |
|
|
/* Finish up a block of data declarations. */ |
751 |
|
|
extern void dataend PROTO((void)); |
752 |
|
|
|
753 |
|
|
/* Report an error message and terminate. */ |
754 |
|
|
extern void flexerror PROTO((char[])); |
755 |
|
|
|
756 |
|
|
/* Report a fatal error message and terminate. */ |
757 |
|
|
extern void flexfatal PROTO((char[])); |
758 |
|
|
|
759 |
|
|
/* Report an error message formatted with one integer argument. */ |
760 |
|
|
extern void lerrif PROTO((char[], int)); |
761 |
|
|
|
762 |
|
|
/* Report an error message formatted with one string argument. */ |
763 |
|
|
extern void lerrsf PROTO((char[], char[])); |
764 |
|
|
|
765 |
|
|
/* Spit out a "# line" statement. */ |
766 |
|
|
extern void line_directive_out PROTO((FILE*)); |
767 |
|
|
|
768 |
|
|
/* Mark the current position in the action array as the end of the section 1 |
769 |
|
|
* user defs. |
770 |
|
|
*/ |
771 |
|
|
extern void mark_defs1 PROTO((void)); |
772 |
|
|
|
773 |
|
|
/* Mark the current position in the action array as the end of the prolog. */ |
774 |
|
|
extern void mark_prolog PROTO((void)); |
775 |
|
|
|
776 |
|
|
/* Generate a data statment for a two-dimensional array. */ |
777 |
|
|
extern void mk2data PROTO((int)); |
778 |
|
|
|
779 |
|
|
extern void mkdata PROTO((int)); /* generate a data statement */ |
780 |
|
|
|
781 |
|
|
/* Return the integer represented by a string of digits. */ |
782 |
|
|
extern int myctoi PROTO((char [])); |
783 |
|
|
|
784 |
|
|
/* Return a printable version of the given character, which might be |
785 |
|
|
* 8-bit. |
786 |
|
|
*/ |
787 |
|
|
extern char *readable_form PROTO((int)); |
788 |
|
|
|
789 |
|
|
/* Write out one section of the skeleton file. */ |
790 |
|
|
extern void skelout PROTO((void)); |
791 |
|
|
|
792 |
|
|
/* Output a yy_trans_info structure. */ |
793 |
|
|
extern void transition_struct_out PROTO((int, int)); |
794 |
|
|
|
795 |
|
|
/* Only needed when using certain broken versions of bison to build parse.c. */ |
796 |
|
|
extern void *yy_flex_xmalloc PROTO(( int )); |
797 |
|
|
|
798 |
|
|
/* Set a region of memory to 0. */ |
799 |
|
|
extern void zero_out PROTO((char *, int)); |
800 |
|
|
|
801 |
|
|
|
802 |
|
|
/* from file nfa.c */ |
803 |
|
|
|
804 |
|
|
/* Add an accepting state to a machine. */ |
805 |
|
|
extern void add_accept PROTO((int, int)); |
806 |
|
|
|
807 |
|
|
/* Make a given number of copies of a singleton machine. */ |
808 |
|
|
extern int copysingl PROTO((int, int)); |
809 |
|
|
|
810 |
|
|
/* Debugging routine to write out an nfa. */ |
811 |
|
|
extern void dumpnfa PROTO((int)); |
812 |
|
|
|
813 |
|
|
/* Finish up the processing for a rule. */ |
814 |
|
|
extern void finish_rule PROTO((int, int, int, int)); |
815 |
|
|
|
816 |
|
|
/* Connect two machines together. */ |
817 |
|
|
extern int link_machines PROTO((int, int)); |
818 |
|
|
|
819 |
|
|
/* Mark each "beginning" state in a machine as being a "normal" (i.e., |
820 |
|
|
* not trailing context associated) state. |
821 |
|
|
*/ |
822 |
|
|
extern void mark_beginning_as_normal PROTO((register int)); |
823 |
|
|
|
824 |
|
|
/* Make a machine that branches to two machines. */ |
825 |
|
|
extern int mkbranch PROTO((int, int)); |
826 |
|
|
|
827 |
|
|
extern int mkclos PROTO((int)); /* convert a machine into a closure */ |
828 |
|
|
extern int mkopt PROTO((int)); /* make a machine optional */ |
829 |
|
|
|
830 |
|
|
/* Make a machine that matches either one of two machines. */ |
831 |
|
|
extern int mkor PROTO((int, int)); |
832 |
|
|
|
833 |
|
|
/* Convert a machine into a positive closure. */ |
834 |
|
|
extern int mkposcl PROTO((int)); |
835 |
|
|
|
836 |
|
|
extern int mkrep PROTO((int, int, int)); /* make a replicated machine */ |
837 |
|
|
|
838 |
|
|
/* Create a state with a transition on a given symbol. */ |
839 |
|
|
extern int mkstate PROTO((int)); |
840 |
|
|
|
841 |
|
|
extern void new_rule PROTO((void)); /* initialize for a new rule */ |
842 |
|
|
|
843 |
|
|
|
844 |
|
|
/* from file parse.y */ |
845 |
|
|
|
846 |
|
|
/* Write out a message formatted with one string, pinpointing its location. */ |
847 |
|
|
extern void format_pinpoint_message PROTO((char[], char[])); |
848 |
|
|
|
849 |
|
|
/* Write out a message, pinpointing its location. */ |
850 |
|
|
extern void pinpoint_message PROTO((char[])); |
851 |
|
|
|
852 |
|
|
/* Write out a warning, pinpointing it at the given line. */ |
853 |
|
|
void line_warning PROTO(( char[], int )); |
854 |
|
|
|
855 |
|
|
/* Write out a message, pinpointing it at the given line. */ |
856 |
|
|
void line_pinpoint PROTO(( char[], int )); |
857 |
|
|
|
858 |
|
|
/* Report a formatted syntax error. */ |
859 |
|
|
extern void format_synerr PROTO((char [], char[])); |
860 |
|
|
extern void synerr PROTO((char [])); /* report a syntax error */ |
861 |
|
|
|
862 |
|
|
/* jhjh - conflicts w/ perl's warn, but should be functionally the same for |
863 |
|
|
our purposes, so using perl prototype: |
864 |
|
|
Perl_warn(pTHX_ const char* pat, ...) */ |
865 |
|
|
/* extern void warn PROTO((char [])); */ /* report a warning */ |
866 |
|
|
|
867 |
|
|
extern int yyparse PROTO((void)); /* the YACC parser */ |
868 |
|
|
|
869 |
|
|
|
870 |
|
|
/* from file scan.l */ |
871 |
|
|
|
872 |
|
|
/* The Flex-generated scanner for flex. */ |
873 |
|
|
extern int flexscan PROTO((void)); |
874 |
|
|
|
875 |
|
|
/* Open the given file (if NULL, stdin) for scanning. */ |
876 |
|
|
extern void set_input_file PROTO((char*)); |
877 |
|
|
|
878 |
|
|
/* Wrapup a file in the lexical analyzer. */ |
879 |
|
|
extern int yywrap PROTO((void)); |
880 |
|
|
|
881 |
|
|
|
882 |
|
|
/* from file sym.c */ |
883 |
|
|
|
884 |
|
|
/* Save the text of a character class. */ |
885 |
|
|
extern void cclinstal PROTO ((Char [], int)); |
886 |
|
|
|
887 |
|
|
/* Lookup the number associated with character class. */ |
888 |
|
|
extern int ccllookup PROTO((Char [])); |
889 |
|
|
|
890 |
|
|
extern void ndinstal PROTO((char[], Char[])); /* install a name definition */ |
891 |
|
|
/* Increase maximum number of SC's. */ |
892 |
|
|
extern void scextend PROTO((void)); |
893 |
|
|
extern void scinstal PROTO((char[], int)); /* make a start condition */ |
894 |
|
|
|
895 |
|
|
/* Lookup the number associated with a start condition. */ |
896 |
|
|
extern int sclookup PROTO((char[])); |
897 |
|
|
|
898 |
|
|
|
899 |
|
|
/* from file tblcmp.c */ |
900 |
|
|
|
901 |
|
|
/* Build table entries for dfa state. */ |
902 |
|
|
extern void bldtbl PROTO((int[], int, int, int, int)); |
903 |
|
|
|
904 |
|
|
extern void cmptmps PROTO((void)); /* compress template table entries */ |
905 |
|
|
extern void expand_nxt_chk PROTO((void)); /* increase nxt/chk arrays */ |
906 |
|
|
extern void inittbl PROTO((void)); /* initialize transition tables */ |
907 |
|
|
/* Make the default, "jam" table entries. */ |
908 |
|
|
extern void mkdeftbl PROTO((void)); |
909 |
|
|
|
910 |
|
|
/* Create table entries for a state (or state fragment) which has |
911 |
|
|
* only one out-transition. |
912 |
|
|
*/ |
913 |
|
|
extern void mk1tbl PROTO((int, int, int, int)); |
914 |
|
|
|
915 |
|
|
/* Place a state into full speed transition table. */ |
916 |
|
|
extern void place_state PROTO((int*, int, int)); |
917 |
|
|
|
918 |
|
|
/* Save states with only one out-transition to be processed later. */ |
919 |
|
|
extern void stack1 PROTO((int, int, int, int)); |
920 |
|
|
|
921 |
|
|
|
922 |
|
|
/* from file yylex.c */ |
923 |
|
|
|
924 |
|
|
extern int yylex PROTO((void)); |