1 #define yy_create_buffer pdcg__create_buffer
2 #define yy_delete_buffer pdcg__delete_buffer
3 #define yy_scan_buffer pdcg__scan_buffer
4 #define yy_scan_string pdcg__scan_string
5 #define yy_scan_bytes pdcg__scan_bytes
6 #define yy_flex_debug pdcg__flex_debug
7 #define yy_init_buffer pdcg__init_buffer
8 #define yy_flush_buffer pdcg__flush_buffer
9 #define yy_load_buffer_state pdcg__load_buffer_state
10 #define yy_switch_to_buffer pdcg__switch_to_buffer
11 #define yyin pdcg_in
12 #define yyleng pdcg_leng
13 #define yylex pdcg_lex
14 #define yyout pdcg_out
15 #define yyrestart pdcg_restart
16 #define yytext pdcg_text
17
18 /* A lexical scanner generated by flex */
19
20 /* Scanner skeleton version:
21 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
22 * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.8 2004/01/06 19:03:44 nectar Exp $
23 */
24
25 #if defined(__FreeBSD__)
26 #include <sys/cdefs.h>
27 #else
28 #define __unused
29 #endif
30
31 #define FLEX_SCANNER
32 #define YY_FLEX_MAJOR_VERSION 2
33 #define YY_FLEX_MINOR_VERSION 5
34
35 #include <stdio.h>
36
37
38 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
39 #ifdef c_plusplus
40 #ifndef __cplusplus
41 #define __cplusplus
42 #endif
43 #endif
44
45
46 #ifdef __cplusplus
47
48 #include <stdlib.h>
49 #include <unistd.h>
50
51 /* Use prototypes in function declarations. */
52 #define YY_USE_PROTOS
53
54 /* The "const" storage-class-modifier is valid. */
55 #define YY_USE_CONST
56
57 #else /* ! __cplusplus */
58
59 #if __STDC__
60
61 #define YY_USE_PROTOS
62 #define YY_USE_CONST
63
64 #endif /* __STDC__ */
65 #endif /* ! __cplusplus */
66
67 #ifdef __TURBOC__
68 #pragma warn -rch
69 #pragma warn -use
70 #include <io.h>
71 #include <stdlib.h>
72 #define YY_USE_CONST
73 #define YY_USE_PROTOS
74 #endif
75
76 #ifdef YY_USE_CONST
77 #define yyconst const
78 #else
79 #define yyconst
80 #endif
81
82
83 #ifdef YY_USE_PROTOS
84 #define YY_PROTO(proto) proto
85 #else
86 #define YY_PROTO(proto) ()
87 #endif
88
89 /* Returned upon end-of-file. */
90 #define YY_NULL 0
91
92 /* Promotes a possibly negative, possibly signed char to an unsigned
93 * integer for use as an array index. If the signed char is negative,
94 * we want to instead treat it as an 8-bit unsigned char, hence the
95 * double cast.
96 */
97 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
98
99 /* Enter a start condition. This macro really ought to take a parameter,
100 * but we do it the disgusting crufty way forced on us by the ()-less
101 * definition of BEGIN.
102 */
103 #define BEGIN yy_start = 1 + 2 *
104
105 /* Translate the current start state into a value that can be later handed
106 * to BEGIN to return to the state. The YYSTATE alias is for lex
107 * compatibility.
108 */
109 #define YY_START ((yy_start - 1) / 2)
110 #define YYSTATE YY_START
111
112 /* Action number for EOF rule of a given start state. */
113 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
114
115 /* Special action meaning "start processing a new file". */
116 #define YY_NEW_FILE yyrestart( yyin )
117
118 #define YY_END_OF_BUFFER_CHAR 0
119
120 /* Size of default input buffer. */
121 #define YY_BUF_SIZE 16384
122
123 typedef struct yy_buffer_state *YY_BUFFER_STATE;
124
125 extern int yyleng;
126 extern FILE *yyin, *yyout;
127
128 #define EOB_ACT_CONTINUE_SCAN 0
129 #define EOB_ACT_END_OF_FILE 1
130 #define EOB_ACT_LAST_MATCH 2
131
132 /* The funky do-while in the following #define is used to turn the definition
133 * int a single C statement (which needs a semi-colon terminator). This
134 * avoids problems with code like:
135 *
136 * if ( condition_holds )
137 * yyless( 5 );
138 * else
139 * do_something_else();
140 *
141 * Prior to using the do-while the compiler would get upset at the
142 * "else" because it interpreted the "if" statement as being all
143 * done when it reached the ';' after the yyless() call.
144 */
145
146 /* Return all but the first 'n' matched characters back to the input stream. */
147
148 #define yyless(n) \
149 do \
150 { \
151 /* Undo effects of setting up yytext. */ \
152 *yy_cp = yy_hold_char; \
153 YY_RESTORE_YY_MORE_OFFSET \
154 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
155 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
156 } \
157 while ( 0 )
158
159 #define unput(c) yyunput( c, yytext_ptr )
160
161 /* The following is because we cannot portably get our hands on size_t
162 * (without autoconf's help, which isn't available because we want
163 * flex-generated scanners to compile on their own).
164 */
165 typedef unsigned int yy_size_t;
166
167
168 struct yy_buffer_state
169 {
170 FILE *yy_input_file;
171
172 char *yy_ch_buf; /* input buffer */
173 char *yy_buf_pos; /* current position in input buffer */
174
175 /* Size of input buffer in bytes, not including room for EOB
176 * characters.
177 */
178 yy_size_t yy_buf_size;
179
180 /* Number of characters read into yy_ch_buf, not including EOB
181 * characters.
182 */
183 int yy_n_chars;
184
185 /* Whether we "own" the buffer - i.e., we know we created it,
186 * and can realloc() it to grow it, and should free() it to
187 * delete it.
188 */
189 int yy_is_our_buffer;
190
191 /* Whether this is an "interactive" input source; if so, and
192 * if we're using stdio for input, then we want to use getc()
193 * instead of fread(), to make sure we stop fetching input after
194 * each newline.
195 */
196 int yy_is_interactive;
197
198 /* Whether we're considered to be at the beginning of a line.
199 * If so, '^' rules will be active on the next match, otherwise
200 * not.
201 */
202 int yy_at_bol;
203
204 /* Whether to try to fill the input buffer when we reach the
205 * end of it.
206 */
207 int yy_fill_buffer;
208
209 int yy_buffer_status;
210 #define YY_BUFFER_NEW 0
211 #define YY_BUFFER_NORMAL 1
212 /* When an EOF's been seen but there's still some text to process
213 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
214 * shouldn't try reading from the input source any more. We might
215 * still have a bunch of tokens to match, though, because of
216 * possible backing-up.
217 *
218 * When we actually see the EOF, we change the status to "new"
219 * (via yyrestart()), so that the user can continue scanning by
220 * just pointing yyin at a new input file.
221 */
222 #define YY_BUFFER_EOF_PENDING 2
223 };
224
225 static YY_BUFFER_STATE yy_current_buffer = 0;
226
227 /* We provide macros for accessing buffer states in case in the
228 * future we want to put the buffer states in a more general
229 * "scanner state".
230 */
231 #define YY_CURRENT_BUFFER yy_current_buffer
232
233
234 /* yy_hold_char holds the character lost when yytext is formed. */
235 static char yy_hold_char;
236
237 static int yy_n_chars; /* number of characters read into yy_ch_buf */
238
239
240 int yyleng;
241
242 /* Points to current character in buffer. */
243 static char *yy_c_buf_p = (char *) 0;
244 static int yy_init = 1; /* whether we need to initialize */
245 static int yy_start = 0; /* start state number */
246
247 /* Flag which is used to allow yywrap()'s to do buffer switches
248 * instead of setting up a fresh yyin. A bit of a hack ...
249 */
250 static int yy_did_buffer_switch_on_eof;
251
252 void yyrestart YY_PROTO(( FILE *input_file ));
253
254 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
255 void yy_load_buffer_state YY_PROTO(( void ));
256 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
257 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
258 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
259 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
260 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
261
262 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
263 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
264 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
265
266 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
267 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) __unused;
268 static void yy_flex_free YY_PROTO(( void * ));
269
270 #define yy_new_buffer yy_create_buffer
271
272 #define yy_set_interactive(is_interactive) \
273 { \
274 if ( ! yy_current_buffer ) \
275 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
276 yy_current_buffer->yy_is_interactive = is_interactive; \
277 }
278
279 #define yy_set_bol(at_bol) \
280 { \
281 if ( ! yy_current_buffer ) \
282 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
283 yy_current_buffer->yy_at_bol = at_bol; \
284 }
285
286 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
287
288
289 #define yywrap() 1
290 #define YY_SKIP_YYWRAP
291 typedef unsigned char YY_CHAR;
292 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
293 typedef int yy_state_type;
294 extern char *yytext;
295 #define yytext_ptr yytext
296
297 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
298 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
299 static int yy_get_next_buffer YY_PROTO(( void ));
300 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
301
302 /* Done after the current pattern has been matched and before the
303 * corresponding action - sets up yytext.
304 */
305 #define YY_DO_BEFORE_ACTION \
306 yytext_ptr = yy_bp; \
307 yyleng = (int) (yy_cp - yy_bp); \
308 yy_hold_char = *yy_cp; \
309 *yy_cp = '\0'; \
310 yy_c_buf_p = yy_cp;
311
312 #define YY_NUM_RULES 24
313 #define YY_END_OF_BUFFER 25
314 static yyconst short int yy_accept[36] =
315 { 0,
316 0, 0, 25, 23, 20, 22, 23, 23, 5, 6,
317 16, 10, 17, 9, 11, 12, 13, 14, 2, 7,
318 8, 1, 3, 15, 4, 0, 18, 19, 21, 2,
319 1, 0, 19, 0, 0
320 } ;
321
322 static yyconst int yy_ec[256] =
323 { 0,
324 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
325 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 2, 4, 5, 6, 1, 1, 1, 1, 7,
328 8, 1, 9, 10, 11, 1, 1, 12, 12, 12,
329 12, 12, 12, 12, 12, 12, 12, 13, 14, 1,
330 15, 16, 17, 1, 18, 18, 18, 18, 18, 18,
331 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
332 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
333 19, 1, 20, 1, 21, 1, 22, 22, 22, 22,
334
335 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
336 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
337 22, 22, 23, 24, 25, 1, 1, 1, 1, 1,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1
352 } ;
353
354 static yyconst int yy_meta[26] =
355 { 0,
356 1, 1, 2, 3, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
358 1, 1, 1, 1, 1
359 } ;
360
361 static yyconst short int yy_base[40] =
362 { 0,
363 0, 0, 49, 54, 54, 54, 39, 31, 54, 54,
364 54, 54, 54, 54, 54, 54, 54, 54, 14, 54,
365 54, 16, 54, 54, 54, 28, 26, 0, 54, 18,
366 20, 24, 0, 22, 54, 42, 45, 47, 50
367 } ;
368
369 static yyconst short int yy_def[40] =
370 { 0,
371 35, 1, 35, 35, 35, 35, 36, 37, 35, 35,
372 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
373 35, 35, 35, 35, 35, 36, 35, 38, 35, 35,
374 35, 39, 38, 39, 0, 35, 35, 35, 35
375 } ;
376
377 static yyconst short int yy_nxt[80] =
378 { 0,
379 4, 5, 6, 4, 7, 8, 9, 10, 11, 12,
380 13, 4, 14, 15, 16, 17, 18, 19, 20, 21,
381 4, 22, 23, 24, 25, 30, 27, 31, 27, 30,
382 32, 31, 27, 29, 30, 30, 31, 31, 30, 30,
383 31, 31, 26, 27, 26, 28, 28, 33, 35, 33,
384 34, 35, 34, 3, 35, 35, 35, 35, 35, 35,
385 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
386 35, 35, 35, 35, 35, 35, 35, 35, 35
387 } ;
388
389 static yyconst short int yy_chk[80] =
390 { 0,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 19, 34, 22, 32, 30,
394 27, 31, 26, 8, 19, 19, 22, 22, 30, 30,
395 31, 31, 36, 7, 36, 37, 37, 38, 3, 38,
396 39, 0, 39, 35, 35, 35, 35, 35, 35, 35,
397 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
398 35, 35, 35, 35, 35, 35, 35, 35, 35
399 } ;
400
401 static yy_state_type yy_last_accepting_state;
402 static char *yy_last_accepting_cpos;
403
404 /* The intent behind this definition is that it'll catch
405 * any uses of REJECT which flex missed.
406 */
407 #define REJECT reject_used_but_not_detected
408 #define yymore() yymore_used_but_not_detected
409 #define YY_MORE_ADJ 0
410 #define YY_RESTORE_YY_MORE_OFFSET
411 char *yytext;
412 #line 1 "dcg_lex.l"
413 #define INITIAL 0
414 /*
415 File: dcg_lex.l
416 Defines a lexical analyzer for the datastructure definition files
417
418 Copyright (C) 2008 Marc Seutter
419
420 This program is free software: you can redistribute it and/or modify
421 it under the terms of the GNU General Public License as published by
422 the Free Software Foundation, either version 3 of the License, or
423 (at your option) any later version.
424
425 This program is distributed in the hope that it will be useful,
426 but WITHOUT ANY WARRANTY; without even the implied warranty of
427 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
428 GNU General Public License for more details.
429
430 You should have received a copy of the GNU General Public License
431 along with this program. If not, see <http://www.gnu.org/licenses/>.
432
433 CVS ID: "$Id: dcg_lex.l,v 1.10 2008/06/28 13:03:45 marcs Exp $"
434 */
435 #line 24 "dcg_lex.l"
436 /* Standard includes */
437 #include <stdio.h>
438 #include <stdlib.h>
439
440 /* libdcg includes */
441 #include <dcg.h>
442 #include <dcg_error.h>
443 #include <dcg_string.h>
444 #include <dcg_lexutil.h>
445
446 /* local includes */
447 #include "dcg_code.h"
448 #include "dcg_parser.h" /* y.tab.h */
449 #include "dcg_lex.h"
450
451 /* Keep gcc -Wall happy */
452 extern int isatty (int desc);
453 static void increment_line_number ();
454
455 /* We do not use UNPUT */
456 #define YY_NO_UNPUT
457
458 /* Macros after this point can all be overridden by user definitions in
459 * section 1.
460 */
461
462 #ifndef YY_SKIP_YYWRAP
463 #ifdef __cplusplus
464 extern "C" int yywrap YY_PROTO(( void ));
465 #else
466 extern int yywrap YY_PROTO(( void ));
467 #endif
468 #endif
469
470 #ifndef YY_NO_UNPUT
471 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
472 #endif
473
474 #ifndef yytext_ptr
475 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
476 #endif
477
478 #ifdef YY_NEED_STRLEN
479 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
480 #endif
481
482 #ifndef YY_NO_INPUT
483 #ifdef __cplusplus
484 static int yyinput YY_PROTO(( void ));
485 #else
486 static int input YY_PROTO(( void ));
487 #endif
488 #endif
489
490 #if YY_STACK_USED
491 static int yy_start_stack_ptr = 0;
492 static int yy_start_stack_depth = 0;
493 static int *yy_start_stack = 0;
494 #ifndef YY_NO_PUSH_STATE
495 static void yy_push_state YY_PROTO(( int new_state ));
496 #endif
497 #ifndef YY_NO_POP_STATE
498 static void yy_pop_state YY_PROTO(( void ));
499 #endif
500 #ifndef YY_NO_TOP_STATE
501 static int yy_top_state YY_PROTO(( void ));
502 #endif
503
504 #else
505 #define YY_NO_PUSH_STATE 1
506 #define YY_NO_POP_STATE 1
507 #define YY_NO_TOP_STATE 1
508 #endif
509
510 #ifdef YY_MALLOC_DECL
511 YY_MALLOC_DECL
512 #else
513 #if __STDC__
514 #ifndef __cplusplus
515 #include <stdlib.h>
516 #endif
517 #else
518 /* Just try to get by without declaring the routines. This will fail
519 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
520 * or sizeof(void*) != sizeof(int).
521 */
522 #endif
523 #endif
524
525 /* Amount of stuff to slurp up with each read. */
526 #ifndef YY_READ_BUF_SIZE
527 #define YY_READ_BUF_SIZE 8192
528 #endif
529
530 /* Copy whatever the last rule matched to the standard output. */
531
532 #ifndef ECHO
533 /* This used to be an fputs(), but since the string might contain NUL's,
534 * we now use fwrite().
535 */
536 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
537 #endif
538
539 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
540 * is returned in "result".
541 */
542 #ifndef YY_INPUT
543 #define YY_INPUT(buf,result,max_size) \
544 if ( yy_current_buffer->yy_is_interactive ) \
545 { \
546 int c = '*', n; \
547 for ( n = 0; n < max_size && \
548 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
549 buf[n] = (char) c; \
550 if ( c == '\n' ) \
551 buf[n++] = (char) c; \
552 if ( c == EOF && ferror( yyin ) ) \
553 YY_FATAL_ERROR( "input in flex scanner failed" ); \
554 result = n; \
555 } \
556 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
557 && ferror( yyin ) ) \
558 YY_FATAL_ERROR( "input in flex scanner failed" );
559 #endif
560
561 /* No semi-colon after return; correct usage is to write "yyterminate();" -
562 * we don't want an extra ';' after the "return" because that will cause
563 * some compilers to complain about unreachable statements.
564 */
565 #ifndef yyterminate
566 #define yyterminate() return YY_NULL
567 #endif
568
569 /* Number of entries by which start-condition stack grows. */
570 #ifndef YY_START_STACK_INCR
571 #define YY_START_STACK_INCR 25
572 #endif
573
574 /* Report a fatal error. */
575 #ifndef YY_FATAL_ERROR
576 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
577 #endif
578
579 /* Default declaration of generated scanner - a define so the user can
580 * easily add parameters.
581 */
582 #ifndef YY_DECL
583 #define YY_DECL int yylex YY_PROTO(( void ))
584 #endif
585
586 /* Code executed at the beginning of each rule, after yytext and yyleng
587 * have been set up.
588 */
589 #ifndef YY_USER_ACTION
590 #define YY_USER_ACTION
591 #endif
592
593 /* Code executed at the end of each rule. */
594 #ifndef YY_BREAK
595 #define YY_BREAK break;
596 #endif
597
598 #define YY_RULE_SETUP \
599 YY_USER_ACTION
600
601 YY_DECL
602 {
603 register yy_state_type yy_current_state;
604 register char *yy_cp, *yy_bp;
605 register int yy_act;
606
607 #line 54 "dcg_lex.l"
608
609
610
611 if ( yy_init )
612 {
613 yy_init = 0;
614
615 #ifdef YY_USER_INIT
616 YY_USER_INIT;
617 #endif
618
619 if ( ! yy_start )
620 yy_start = 1; /* first start state */
621
622 if ( ! yyin )
623 yyin = stdin;
624
625 if ( ! yyout )
626 yyout = stdout;
627
628 if ( ! yy_current_buffer )
629 yy_current_buffer =
630 yy_create_buffer( yyin, YY_BUF_SIZE );
631
632 yy_load_buffer_state();
633 }
634
635 while ( 1 ) /* loops until end-of-file is reached */
636 {
637 yy_cp = yy_c_buf_p;
638
639 /* Support of yytext. */
640 *yy_cp = yy_hold_char;
641
642 /* yy_bp points to the position in yy_ch_buf of the start of
643 * the current run.
644 */
645 yy_bp = yy_cp;
646
647 yy_current_state = yy_start;
648 yy_match:
649 do
650 {
651 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
652 if ( yy_accept[yy_current_state] )
653 {
654 yy_last_accepting_state = yy_current_state;
655 yy_last_accepting_cpos = yy_cp;
656 }
657 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
658 {
659 yy_current_state = (int) yy_def[yy_current_state];
660 if ( yy_current_state >= 36 )
661 yy_c = yy_meta[(unsigned int) yy_c];
662 }
663 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
664 ++yy_cp;
665 }
666 while ( yy_base[yy_current_state] != 54 );
667
668 yy_find_action:
669 yy_act = yy_accept[yy_current_state];
670 if ( yy_act == 0 )
671 { /* have to back up */
672 yy_cp = yy_last_accepting_cpos;
673 yy_current_state = yy_last_accepting_state;
674 yy_act = yy_accept[yy_current_state];
675 }
676
677 YY_DO_BEFORE_ACTION;
678
679
680 do_action: /* This label is used only to access EOF actions. */
681
682
683 switch ( yy_act )
684 { /* beginning of action switch */
685 case 0: /* must back up */
686 /* undo the effects of YY_DO_BEFORE_ACTION */
687 *yy_cp = yy_hold_char;
688 yy_cp = yy_last_accepting_cpos;
689 yy_current_state = yy_last_accepting_state;
690 goto yy_find_action;
691
692 case 1:
693 YY_RULE_SETUP
694 #line 56 "dcg_lex.l"
695 { pdcg_lval.string = new_string (yytext);
696 return (identifier);
697 }
698 YY_BREAK
699 case 2:
700 YY_RULE_SETUP
701 #line 59 "dcg_lex.l"
702 { pdcg_lval.string = new_string (yytext);
703 return (constructor);
704 }
705 YY_BREAK
706 case 3:
707 YY_RULE_SETUP
708 #line 62 "dcg_lex.l"
709 return left_brace;
710 YY_BREAK
711 case 4:
712 YY_RULE_SETUP
713 #line 63 "dcg_lex.l"
714 return right_brace;
715 YY_BREAK
716 case 5:
717 YY_RULE_SETUP
718 #line 64 "dcg_lex.l"
719 return left_parenthesis;
720 YY_BREAK
721 case 6:
722 YY_RULE_SETUP
723 #line 65 "dcg_lex.l"
724 return right_parenthesis;
725 YY_BREAK
726 case 7:
727 YY_RULE_SETUP
728 #line 66 "dcg_lex.l"
729 return left_square;
730 YY_BREAK
731 case 8:
732 YY_RULE_SETUP
733 #line 67 "dcg_lex.l"
734 return right_square;
735 YY_BREAK
736 case 9:
737 YY_RULE_SETUP
738 #line 68 "dcg_lex.l"
739 return colon;
740 YY_BREAK
741 case 10:
742 YY_RULE_SETUP
743 #line 69 "dcg_lex.l"
744 return comma;
745 YY_BREAK
746 case 11:
747 YY_RULE_SETUP
748 #line 70 "dcg_lex.l"
749 return semicolon;
750 YY_BREAK
751 case 12:
752 YY_RULE_SETUP
753 #line 71 "dcg_lex.l"
754 return equals;
755 YY_BREAK
756 case 13:
757 YY_RULE_SETUP
758 #line 72 "dcg_lex.l"
759 return grtr;
760 YY_BREAK
761 case 14:
762 YY_RULE_SETUP
763 #line 73 "dcg_lex.l"
764 return question_mark;
765 YY_BREAK
766 case 15:
767 YY_RULE_SETUP
768 #line 74 "dcg_lex.l"
769 return choice;
770 YY_BREAK
771 case 16:
772 YY_RULE_SETUP
773 #line 75 "dcg_lex.l"
774 return plus;
775 YY_BREAK
776 case 17:
777 YY_RULE_SETUP
778 #line 76 "dcg_lex.l"
779 return minus;
780 YY_BREAK
781 case 18:
782 YY_RULE_SETUP
783 #line 77 "dcg_lex.l"
784 { pdcg_lval.string = dcg_convert_string (yytext, 1);
785 return (string_literal);
786 }
787 YY_BREAK
788 case 19:
789 YY_RULE_SETUP
790 #line 80 "dcg_lex.l"
791 ;
792 YY_BREAK
793 case 20:
794 YY_RULE_SETUP
795 #line 81 "dcg_lex.l"
796 ;
797 YY_BREAK
798 case 21:
799 YY_RULE_SETUP
800 #line 82 "dcg_lex.l"
801 { increment_line_number (); }
802 YY_BREAK
803 case 22:
804 YY_RULE_SETUP
805 #line 83 "dcg_lex.l"
806 { increment_line_number (); }
807 YY_BREAK
808 case 23:
809 YY_RULE_SETUP
810 #line 84 "dcg_lex.l"
811 return lex_error_token;
812 YY_BREAK
813 case 24:
814 YY_RULE_SETUP
815 #line 85 "dcg_lex.l"
816 ECHO;
817 YY_BREAK
818 case YY_STATE_EOF(INITIAL):
819 yyterminate();
820
821 case YY_END_OF_BUFFER:
822 {
823 /* Amount of text matched not including the EOB char. */
824 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
825
826 /* Undo the effects of YY_DO_BEFORE_ACTION. */
827 *yy_cp = yy_hold_char;
828 YY_RESTORE_YY_MORE_OFFSET
829
830 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
831 {
832 /* We're scanning a new file or input source. It's
833 * possible that this happened because the user
834 * just pointed yyin at a new source and called
835 * yylex(). If so, then we have to assure
836 * consistency between yy_current_buffer and our
837 * globals. Here is the right place to do so, because
838 * this is the first action (other than possibly a
839 * back-up) that will match for the new input source.
840 */
841 yy_n_chars = yy_current_buffer->yy_n_chars;
842 yy_current_buffer->yy_input_file = yyin;
843 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
844 }
845
846 /* Note that here we test for yy_c_buf_p "<=" to the position
847 * of the first EOB in the buffer, since yy_c_buf_p will
848 * already have been incremented past the NUL character
849 * (since all states make transitions on EOB to the
850 * end-of-buffer state). Contrast this with the test
851 * in input().
852 */
853 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
854 { /* This was really a NUL. */
855 yy_state_type yy_next_state;
856
857 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
858
859 yy_current_state = yy_get_previous_state();
860
861 /* Okay, we're now positioned to make the NUL
862 * transition. We couldn't have
863 * yy_get_previous_state() go ahead and do it
864 * for us because it doesn't know how to deal
865 * with the possibility of jamming (and we don't
866 * want to build jamming into it because then it
867 * will run more slowly).
868 */
869
870 yy_next_state = yy_try_NUL_trans( yy_current_state );
871
872 yy_bp = yytext_ptr + YY_MORE_ADJ;
873
874 if ( yy_next_state )
875 {
876 /* Consume the NUL. */
877 yy_cp = ++yy_c_buf_p;
878 yy_current_state = yy_next_state;
879 goto yy_match;
880 }
881
882 else
883 {
884 yy_cp = yy_c_buf_p;
885 goto yy_find_action;
886 }
887 }
888
889 else switch ( yy_get_next_buffer() )
890 {
891 case EOB_ACT_END_OF_FILE:
892 {
893 yy_did_buffer_switch_on_eof = 0;
894
895 if ( yywrap() )
896 {
897 /* Note: because we've taken care in
898 * yy_get_next_buffer() to have set up
899 * yytext, we can now set up
900 * yy_c_buf_p so that if some total
901 * hoser (like flex itself) wants to
902 * call the scanner after we return the
903 * YY_NULL, it'll still work - another
904 * YY_NULL will get returned.
905 */
906 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
907
908 yy_act = YY_STATE_EOF(YY_START);
909 goto do_action;
910 }
911
912 else
913 {
914 if ( ! yy_did_buffer_switch_on_eof )
915 YY_NEW_FILE;
916 }
917 break;
918 }
919
920 case EOB_ACT_CONTINUE_SCAN:
921 yy_c_buf_p =
922 yytext_ptr + yy_amount_of_matched_text;
923
924 yy_current_state = yy_get_previous_state();
925
926 yy_cp = yy_c_buf_p;
927 yy_bp = yytext_ptr + YY_MORE_ADJ;
928 goto yy_match;
929
930 case EOB_ACT_LAST_MATCH:
931 yy_c_buf_p =
932 &yy_current_buffer->yy_ch_buf[yy_n_chars];
933
934 yy_current_state = yy_get_previous_state();
935
936 yy_cp = yy_c_buf_p;
937 yy_bp = yytext_ptr + YY_MORE_ADJ;
938 goto yy_find_action;
939 }
940 break;
941 }
942
943 default:
944 YY_FATAL_ERROR(
945 "fatal flex scanner internal error--no action found" );
946 } /* end of action switch */
947 } /* end of scanning one token */
948 } /* end of yylex */
949
950
951 /* yy_get_next_buffer - try to read in a new buffer
952 *
953 * Returns a code representing an action:
954 * EOB_ACT_LAST_MATCH -
955 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
956 * EOB_ACT_END_OF_FILE - end of file
957 */
958
yy_get_next_buffer()959 static int yy_get_next_buffer()
960 {
961 register char *dest = yy_current_buffer->yy_ch_buf;
962 register char *source = yytext_ptr;
963 register int number_to_move, i;
964 int ret_val;
965
966 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
967 YY_FATAL_ERROR(
968 "fatal flex scanner internal error--end of buffer missed" );
969
970 if ( yy_current_buffer->yy_fill_buffer == 0 )
971 { /* Don't try to fill the buffer, so this is an EOF. */
972 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
973 {
974 /* We matched a single character, the EOB, so
975 * treat this as a final EOF.
976 */
977 return EOB_ACT_END_OF_FILE;
978 }
979
980 else
981 {
982 /* We matched some text prior to the EOB, first
983 * process it.
984 */
985 return EOB_ACT_LAST_MATCH;
986 }
987 }
988
989 /* Try to read more data. */
990
991 /* First move last chars to start of buffer. */
992 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
993
994 for ( i = 0; i < number_to_move; ++i )
995 *(dest++) = *(source++);
996
997 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
998 /* don't do the read, it's not guaranteed to return an EOF,
999 * just force an EOF
1000 */
1001 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1002
1003 else
1004 {
1005 int num_to_read =
1006 yy_current_buffer->yy_buf_size - number_to_move - 1;
1007
1008 while ( num_to_read <= 0 )
1009 { /* Not enough room in the buffer - grow it. */
1010 #ifdef YY_USES_REJECT
1011 YY_FATAL_ERROR(
1012 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1013 #else
1014
1015 /* just a shorter name for the current buffer */
1016 YY_BUFFER_STATE b = yy_current_buffer;
1017
1018 int yy_c_buf_p_offset =
1019 (int) (yy_c_buf_p - b->yy_ch_buf);
1020
1021 if ( b->yy_is_our_buffer )
1022 {
1023 int new_size = b->yy_buf_size * 2;
1024
1025 if ( new_size <= 0 )
1026 b->yy_buf_size += b->yy_buf_size / 8;
1027 else
1028 b->yy_buf_size *= 2;
1029
1030 b->yy_ch_buf = (char *)
1031 /* Include room in for 2 EOB chars. */
1032 yy_flex_realloc( (void *) b->yy_ch_buf,
1033 b->yy_buf_size + 2 );
1034 }
1035 else
1036 /* Can't grow it, we don't own it. */
1037 b->yy_ch_buf = 0;
1038
1039 if ( ! b->yy_ch_buf )
1040 YY_FATAL_ERROR(
1041 "fatal error - scanner input buffer overflow" );
1042
1043 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1044
1045 num_to_read = yy_current_buffer->yy_buf_size -
1046 number_to_move - 1;
1047 #endif
1048 }
1049
1050 if ( num_to_read > YY_READ_BUF_SIZE )
1051 num_to_read = YY_READ_BUF_SIZE;
1052
1053 /* Read in more data. */
1054 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1055 yy_n_chars, num_to_read );
1056
1057 yy_current_buffer->yy_n_chars = yy_n_chars;
1058 }
1059
1060 if ( yy_n_chars == 0 )
1061 {
1062 if ( number_to_move == YY_MORE_ADJ )
1063 {
1064 ret_val = EOB_ACT_END_OF_FILE;
1065 yyrestart( yyin );
1066 }
1067
1068 else
1069 {
1070 ret_val = EOB_ACT_LAST_MATCH;
1071 yy_current_buffer->yy_buffer_status =
1072 YY_BUFFER_EOF_PENDING;
1073 }
1074 }
1075
1076 else
1077 ret_val = EOB_ACT_CONTINUE_SCAN;
1078
1079 yy_n_chars += number_to_move;
1080 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1081 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1082
1083 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1084
1085 return ret_val;
1086 }
1087
1088
1089 /* yy_get_previous_state - get the state just before the EOB char was reached */
1090
yy_get_previous_state()1091 static yy_state_type yy_get_previous_state()
1092 {
1093 register yy_state_type yy_current_state;
1094 register char *yy_cp;
1095
1096 yy_current_state = yy_start;
1097
1098 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1099 {
1100 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1101 if ( yy_accept[yy_current_state] )
1102 {
1103 yy_last_accepting_state = yy_current_state;
1104 yy_last_accepting_cpos = yy_cp;
1105 }
1106 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1107 {
1108 yy_current_state = (int) yy_def[yy_current_state];
1109 if ( yy_current_state >= 36 )
1110 yy_c = yy_meta[(unsigned int) yy_c];
1111 }
1112 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1113 }
1114
1115 return yy_current_state;
1116 }
1117
1118
1119 /* yy_try_NUL_trans - try to make a transition on the NUL character
1120 *
1121 * synopsis
1122 * next_state = yy_try_NUL_trans( current_state );
1123 */
1124
1125 #ifdef YY_USE_PROTOS
yy_try_NUL_trans(yy_state_type yy_current_state)1126 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1127 #else
1128 static yy_state_type yy_try_NUL_trans( yy_current_state )
1129 yy_state_type yy_current_state;
1130 #endif
1131 {
1132 register int yy_is_jam;
1133 register char *yy_cp = yy_c_buf_p;
1134
1135 register YY_CHAR yy_c = 1;
1136 if ( yy_accept[yy_current_state] )
1137 {
1138 yy_last_accepting_state = yy_current_state;
1139 yy_last_accepting_cpos = yy_cp;
1140 }
1141 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1142 {
1143 yy_current_state = (int) yy_def[yy_current_state];
1144 if ( yy_current_state >= 36 )
1145 yy_c = yy_meta[(unsigned int) yy_c];
1146 }
1147 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1148 yy_is_jam = (yy_current_state == 35);
1149
1150 return yy_is_jam ? 0 : yy_current_state;
1151 }
1152
1153
1154 #ifndef YY_NO_UNPUT
1155 #ifdef YY_USE_PROTOS
yyunput(int c,register char * yy_bp)1156 static void yyunput( int c, register char *yy_bp )
1157 #else
1158 static void yyunput( c, yy_bp )
1159 int c;
1160 register char *yy_bp;
1161 #endif
1162 {
1163 register char *yy_cp = yy_c_buf_p;
1164
1165 /* undo effects of setting up yytext */
1166 *yy_cp = yy_hold_char;
1167
1168 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1169 { /* need to shift things up to make room */
1170 /* +2 for EOB chars. */
1171 register int number_to_move = yy_n_chars + 2;
1172 register char *dest = &yy_current_buffer->yy_ch_buf[
1173 yy_current_buffer->yy_buf_size + 2];
1174 register char *source =
1175 &yy_current_buffer->yy_ch_buf[number_to_move];
1176
1177 while ( source > yy_current_buffer->yy_ch_buf )
1178 *--dest = *--source;
1179
1180 yy_cp += (int) (dest - source);
1181 yy_bp += (int) (dest - source);
1182 yy_current_buffer->yy_n_chars =
1183 yy_n_chars = yy_current_buffer->yy_buf_size;
1184
1185 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1186 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1187 }
1188
1189 *--yy_cp = (char) c;
1190
1191
1192 yytext_ptr = yy_bp;
1193 yy_hold_char = *yy_cp;
1194 yy_c_buf_p = yy_cp;
1195 }
1196 #endif /* ifndef YY_NO_UNPUT */
1197
1198
1199 #ifdef __cplusplus
yyinput()1200 static int yyinput()
1201 #else
1202 static int input()
1203 #endif
1204 {
1205 int c;
1206
1207 *yy_c_buf_p = yy_hold_char;
1208
1209 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1210 {
1211 /* yy_c_buf_p now points to the character we want to return.
1212 * If this occurs *before* the EOB characters, then it's a
1213 * valid NUL; if not, then we've hit the end of the buffer.
1214 */
1215 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1216 /* This was really a NUL. */
1217 *yy_c_buf_p = '\0';
1218
1219 else
1220 { /* need more input */
1221 int offset = yy_c_buf_p - yytext_ptr;
1222 ++yy_c_buf_p;
1223
1224 switch ( yy_get_next_buffer() )
1225 {
1226 case EOB_ACT_LAST_MATCH:
1227 /* This happens because yy_g_n_b()
1228 * sees that we've accumulated a
1229 * token and flags that we need to
1230 * try matching the token before
1231 * proceeding. But for input(),
1232 * there's no matching to consider.
1233 * So convert the EOB_ACT_LAST_MATCH
1234 * to EOB_ACT_END_OF_FILE.
1235 */
1236
1237 /* Reset buffer status. */
1238 yyrestart( yyin );
1239
1240 /* fall through */
1241
1242 case EOB_ACT_END_OF_FILE:
1243 {
1244 if ( yywrap() )
1245 return EOF;
1246
1247 if ( ! yy_did_buffer_switch_on_eof )
1248 YY_NEW_FILE;
1249 #ifdef __cplusplus
1250 return yyinput();
1251 #else
1252 return input();
1253 #endif
1254 }
1255
1256 case EOB_ACT_CONTINUE_SCAN:
1257 yy_c_buf_p = yytext_ptr + offset;
1258 break;
1259 }
1260 }
1261 }
1262
1263 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1264 *yy_c_buf_p = '\0'; /* preserve yytext */
1265 yy_hold_char = *++yy_c_buf_p;
1266
1267
1268 return c;
1269 }
1270
1271
1272 #ifdef YY_USE_PROTOS
yyrestart(FILE * input_file)1273 void yyrestart( FILE *input_file )
1274 #else
1275 void yyrestart( input_file )
1276 FILE *input_file;
1277 #endif
1278 {
1279 if ( ! yy_current_buffer )
1280 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1281
1282 yy_init_buffer( yy_current_buffer, input_file );
1283 yy_load_buffer_state();
1284 }
1285
1286
1287 #ifdef YY_USE_PROTOS
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1288 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1289 #else
1290 void yy_switch_to_buffer( new_buffer )
1291 YY_BUFFER_STATE new_buffer;
1292 #endif
1293 {
1294 if ( yy_current_buffer == new_buffer )
1295 return;
1296
1297 if ( yy_current_buffer )
1298 {
1299 /* Flush out information for old buffer. */
1300 *yy_c_buf_p = yy_hold_char;
1301 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1302 yy_current_buffer->yy_n_chars = yy_n_chars;
1303 }
1304
1305 yy_current_buffer = new_buffer;
1306 yy_load_buffer_state();
1307
1308 /* We don't actually know whether we did this switch during
1309 * EOF (yywrap()) processing, but the only time this flag
1310 * is looked at is after yywrap() is called, so it's safe
1311 * to go ahead and always set it.
1312 */
1313 yy_did_buffer_switch_on_eof = 1;
1314 }
1315
1316
1317 #ifdef YY_USE_PROTOS
yy_load_buffer_state(void)1318 void yy_load_buffer_state( void )
1319 #else
1320 void yy_load_buffer_state()
1321 #endif
1322 {
1323 yy_n_chars = yy_current_buffer->yy_n_chars;
1324 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1325 yyin = yy_current_buffer->yy_input_file;
1326 yy_hold_char = *yy_c_buf_p;
1327 }
1328
1329
1330 #ifdef YY_USE_PROTOS
yy_create_buffer(FILE * file,int size)1331 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1332 #else
1333 YY_BUFFER_STATE yy_create_buffer( file, size )
1334 FILE *file;
1335 int size;
1336 #endif
1337 {
1338 YY_BUFFER_STATE b;
1339
1340 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1341 if ( ! b )
1342 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1343
1344 b->yy_buf_size = size;
1345
1346 /* yy_ch_buf has to be 2 characters longer than the size given because
1347 * we need to put in 2 end-of-buffer characters.
1348 */
1349 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1350 if ( ! b->yy_ch_buf )
1351 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1352
1353 b->yy_is_our_buffer = 1;
1354
1355 yy_init_buffer( b, file );
1356
1357 return b;
1358 }
1359
1360
1361 #ifdef YY_USE_PROTOS
yy_delete_buffer(YY_BUFFER_STATE b)1362 void yy_delete_buffer( YY_BUFFER_STATE b )
1363 #else
1364 void yy_delete_buffer( b )
1365 YY_BUFFER_STATE b;
1366 #endif
1367 {
1368 if ( ! b )
1369 return;
1370
1371 if ( b == yy_current_buffer )
1372 yy_current_buffer = (YY_BUFFER_STATE) 0;
1373
1374 if ( b->yy_is_our_buffer )
1375 yy_flex_free( (void *) b->yy_ch_buf );
1376
1377 yy_flex_free( (void *) b );
1378 }
1379
1380
1381 #ifndef YY_ALWAYS_INTERACTIVE
1382 #ifndef YY_NEVER_INTERACTIVE
1383 extern int isatty YY_PROTO(( int ));
1384 #endif
1385 #endif
1386
1387 #ifdef YY_USE_PROTOS
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1388 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1389 #else
1390 void yy_init_buffer( b, file )
1391 YY_BUFFER_STATE b;
1392 FILE *file;
1393 #endif
1394
1395
1396 {
1397 yy_flush_buffer( b );
1398
1399 b->yy_input_file = file;
1400 b->yy_fill_buffer = 1;
1401
1402 #if YY_ALWAYS_INTERACTIVE
1403 b->yy_is_interactive = 1;
1404 #else
1405 #if YY_NEVER_INTERACTIVE
1406 b->yy_is_interactive = 0;
1407 #else
1408 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1409 #endif
1410 #endif
1411 }
1412
1413
1414 #ifdef YY_USE_PROTOS
yy_flush_buffer(YY_BUFFER_STATE b)1415 void yy_flush_buffer( YY_BUFFER_STATE b )
1416 #else
1417 void yy_flush_buffer( b )
1418 YY_BUFFER_STATE b;
1419 #endif
1420
1421 {
1422 if ( ! b )
1423 return;
1424
1425 b->yy_n_chars = 0;
1426
1427 /* We always need two end-of-buffer characters. The first causes
1428 * a transition to the end-of-buffer state. The second causes
1429 * a jam in that state.
1430 */
1431 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1432 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1433
1434 b->yy_buf_pos = &b->yy_ch_buf[0];
1435
1436 b->yy_at_bol = 1;
1437 b->yy_buffer_status = YY_BUFFER_NEW;
1438
1439 if ( b == yy_current_buffer )
1440 yy_load_buffer_state();
1441 }
1442
1443
1444 #ifndef YY_NO_SCAN_BUFFER
1445 #ifdef YY_USE_PROTOS
yy_scan_buffer(char * base,yy_size_t size)1446 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1447 #else
1448 YY_BUFFER_STATE yy_scan_buffer( base, size )
1449 char *base;
1450 yy_size_t size;
1451 #endif
1452 {
1453 YY_BUFFER_STATE b;
1454
1455 if ( size < 2 ||
1456 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1457 base[size-1] != YY_END_OF_BUFFER_CHAR )
1458 /* They forgot to leave room for the EOB's. */
1459 return 0;
1460
1461 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1462 if ( ! b )
1463 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1464
1465 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1466 b->yy_buf_pos = b->yy_ch_buf = base;
1467 b->yy_is_our_buffer = 0;
1468 b->yy_input_file = 0;
1469 b->yy_n_chars = b->yy_buf_size;
1470 b->yy_is_interactive = 0;
1471 b->yy_at_bol = 1;
1472 b->yy_fill_buffer = 0;
1473 b->yy_buffer_status = YY_BUFFER_NEW;
1474
1475 yy_switch_to_buffer( b );
1476
1477 return b;
1478 }
1479 #endif
1480
1481
1482 #ifndef YY_NO_SCAN_STRING
1483 #ifdef YY_USE_PROTOS
yy_scan_string(yyconst char * yy_str)1484 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1485 #else
1486 YY_BUFFER_STATE yy_scan_string( yy_str )
1487 yyconst char *yy_str;
1488 #endif
1489 {
1490 int len;
1491 for ( len = 0; yy_str[len]; ++len )
1492 ;
1493
1494 return yy_scan_bytes( yy_str, len );
1495 }
1496 #endif
1497
1498
1499 #ifndef YY_NO_SCAN_BYTES
1500 #ifdef YY_USE_PROTOS
yy_scan_bytes(yyconst char * bytes,int len)1501 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1502 #else
1503 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1504 yyconst char *bytes;
1505 int len;
1506 #endif
1507 {
1508 YY_BUFFER_STATE b;
1509 char *buf;
1510 yy_size_t n;
1511 int i;
1512
1513 /* Get memory for full buffer, including space for trailing EOB's. */
1514 n = len + 2;
1515 buf = (char *) yy_flex_alloc( n );
1516 if ( ! buf )
1517 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1518
1519 for ( i = 0; i < len; ++i )
1520 buf[i] = bytes[i];
1521
1522 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1523
1524 b = yy_scan_buffer( buf, n );
1525 if ( ! b )
1526 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1527
1528 /* It's okay to grow etc. this buffer, and we should throw it
1529 * away when we're done.
1530 */
1531 b->yy_is_our_buffer = 1;
1532
1533 return b;
1534 }
1535 #endif
1536
1537
1538 #ifndef YY_NO_PUSH_STATE
1539 #ifdef YY_USE_PROTOS
yy_push_state(int new_state)1540 static void yy_push_state( int new_state )
1541 #else
1542 static void yy_push_state( new_state )
1543 int new_state;
1544 #endif
1545 {
1546 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1547 {
1548 yy_size_t new_size;
1549
1550 yy_start_stack_depth += YY_START_STACK_INCR;
1551 new_size = yy_start_stack_depth * sizeof( int );
1552
1553 if ( ! yy_start_stack )
1554 yy_start_stack = (int *) yy_flex_alloc( new_size );
1555
1556 else
1557 yy_start_stack = (int *) yy_flex_realloc(
1558 (void *) yy_start_stack, new_size );
1559
1560 if ( ! yy_start_stack )
1561 YY_FATAL_ERROR(
1562 "out of memory expanding start-condition stack" );
1563 }
1564
1565 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1566
1567 BEGIN(new_state);
1568 }
1569 #endif
1570
1571
1572 #ifndef YY_NO_POP_STATE
yy_pop_state()1573 static void yy_pop_state()
1574 {
1575 if ( --yy_start_stack_ptr < 0 )
1576 YY_FATAL_ERROR( "start-condition stack underflow" );
1577
1578 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1579 }
1580 #endif
1581
1582
1583 #ifndef YY_NO_TOP_STATE
yy_top_state()1584 static int yy_top_state()
1585 {
1586 return yy_start_stack[yy_start_stack_ptr - 1];
1587 }
1588 #endif
1589
1590 #ifndef YY_EXIT_FAILURE
1591 #define YY_EXIT_FAILURE 2
1592 #endif
1593
1594 #ifdef YY_USE_PROTOS
yy_fatal_error(yyconst char msg[])1595 static void yy_fatal_error( yyconst char msg[] )
1596 #else
1597 static void yy_fatal_error( msg )
1598 char msg[];
1599 #endif
1600 {
1601 (void) fprintf( stderr, "%s\n", msg );
1602 exit( YY_EXIT_FAILURE );
1603 }
1604
1605
1606
1607 /* Redefine yyless() so it works in section 3 code. */
1608
1609 #undef yyless
1610 #define yyless(n) \
1611 do \
1612 { \
1613 /* Undo effects of setting up yytext. */ \
1614 yytext[yyleng] = yy_hold_char; \
1615 yy_c_buf_p = yytext + n; \
1616 yy_hold_char = *yy_c_buf_p; \
1617 *yy_c_buf_p = '\0'; \
1618 yyleng = n; \
1619 } \
1620 while ( 0 )
1621
1622
1623 /* Internal utility routines. */
1624
1625 #ifndef yytext_ptr
1626 #ifdef YY_USE_PROTOS
yy_flex_strncpy(char * s1,yyconst char * s2,int n)1627 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1628 #else
1629 static void yy_flex_strncpy( s1, s2, n )
1630 char *s1;
1631 yyconst char *s2;
1632 int n;
1633 #endif
1634 {
1635 register int i;
1636 for ( i = 0; i < n; ++i )
1637 s1[i] = s2[i];
1638 }
1639 #endif
1640
1641 #ifdef YY_NEED_STRLEN
1642 #ifdef YY_USE_PROTOS
yy_flex_strlen(yyconst char * s)1643 static int yy_flex_strlen( yyconst char *s )
1644 #else
1645 static int yy_flex_strlen( s )
1646 yyconst char *s;
1647 #endif
1648 {
1649 register int n;
1650 for ( n = 0; s[n]; ++n )
1651 ;
1652
1653 return n;
1654 }
1655 #endif
1656
1657
1658 #ifdef YY_USE_PROTOS
yy_flex_alloc(yy_size_t size)1659 static void *yy_flex_alloc( yy_size_t size )
1660 #else
1661 static void *yy_flex_alloc( size )
1662 yy_size_t size;
1663 #endif
1664 {
1665 return (void *) malloc( size );
1666 }
1667
1668 #ifdef YY_USE_PROTOS
yy_flex_realloc(void * ptr,yy_size_t size)1669 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1670 #else
1671 static void *yy_flex_realloc( ptr, size )
1672 void *ptr;
1673 yy_size_t size;
1674 #endif
1675 {
1676 /* The cast to (char *) in the following accommodates both
1677 * implementations that use char* generic pointers, and those
1678 * that use void* generic pointers. It works with the latter
1679 * because both ANSI C and C++ allow castless assignment from
1680 * any pointer type to void*, and deal with argument conversions
1681 * as though doing an assignment.
1682 */
1683 return (void *) realloc( (char *) ptr, size );
1684 }
1685
1686 #ifdef YY_USE_PROTOS
yy_flex_free(void * ptr)1687 static void yy_flex_free( void *ptr )
1688 #else
1689 static void yy_flex_free( ptr )
1690 void *ptr;
1691 #endif
1692 {
1693 free( ptr );
1694 }
1695
1696 #if YY_MAIN
main()1697 int main()
1698 {
1699 yylex();
1700 return 0;
1701 }
1702 #endif
1703 #line 85 "dcg_lex.l"
1704
1705 /*
1706 Initialization
1707 */
1708 static int line_number;
init_lex(FILE * in)1709 void init_lex (FILE *in)
1710 { pdcg_restart (in);
1711 line_number = 1;
1712 };
1713
1714 /*
1715 Error recovery (of some kind)
1716 */
increment_line_number()1717 static void increment_line_number ()
1718 { line_number++;
1719 };
1720
pdcg_error(char * msg)1721 void pdcg_error (char *msg)
1722 { panic ("line %d: %s", line_number, msg);
1723 };
1724