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