My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scan_netlist.cpp
Go to the documentation of this file.
1 #line 2 "scan_netlist.cpp"
2 
3 #line 4 "scan_netlist.cpp"
4 
5 #define YY_INT_ALIGNED short int
6 
7 /* A lexical scanner generated by flex */
8 
9 #define yy_create_buffer netlist__create_buffer
10 #define yy_delete_buffer netlist__delete_buffer
11 #define yy_flex_debug netlist__flex_debug
12 #define yy_init_buffer netlist__init_buffer
13 #define yy_flush_buffer netlist__flush_buffer
14 #define yy_load_buffer_state netlist__load_buffer_state
15 #define yy_switch_to_buffer netlist__switch_to_buffer
16 #define yyin netlist_in
17 #define yyleng netlist_leng
18 #define yylex netlist_lex
19 #define yylineno netlist_lineno
20 #define yyout netlist_out
21 #define yyrestart netlist_restart
22 #define yytext netlist_text
23 #define yywrap netlist_wrap
24 #define yyalloc netlist_alloc
25 #define yyrealloc netlist_realloc
26 #define yyfree netlist_free
27 
28 #define FLEX_SCANNER
29 #define YY_FLEX_MAJOR_VERSION 2
30 #define YY_FLEX_MINOR_VERSION 5
31 #define YY_FLEX_SUBMINOR_VERSION 35
32 #if YY_FLEX_SUBMINOR_VERSION > 0
33 #define FLEX_BETA
34 #endif
35 
36 /* First, we deal with platform-specific or compiler-specific issues. */
37 
38 /* begin standard C headers. */
39 #include <stdio.h>
40 #include <string.h>
41 #include <errno.h>
42 #include <stdlib.h>
43 
44 /* end standard C headers. */
45 
46 /* flex integer type definitions */
47 
48 #ifndef FLEXINT_H
49 #define FLEXINT_H
50 
51 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52 
53 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54 
55 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56  * if you want the limit (max/min) macros for int types.
57  */
58 #ifndef __STDC_LIMIT_MACROS
59 #define __STDC_LIMIT_MACROS 1
60 #endif
61 
62 #include <inttypes.h>
63 typedef int8_t flex_int8_t;
64 typedef uint8_t flex_uint8_t;
65 typedef int16_t flex_int16_t;
66 typedef uint16_t flex_uint16_t;
67 typedef int32_t flex_int32_t;
68 typedef uint32_t flex_uint32_t;
69 #else
70 typedef signed char flex_int8_t;
71 typedef short int flex_int16_t;
72 typedef int flex_int32_t;
73 typedef unsigned char flex_uint8_t;
74 typedef unsigned short int flex_uint16_t;
75 typedef unsigned int flex_uint32_t;
76 
77 /* Limits of integral types. */
78 #ifndef INT8_MIN
79 #define INT8_MIN (-128)
80 #endif
81 #ifndef INT16_MIN
82 #define INT16_MIN (-32767-1)
83 #endif
84 #ifndef INT32_MIN
85 #define INT32_MIN (-2147483647-1)
86 #endif
87 #ifndef INT8_MAX
88 #define INT8_MAX (127)
89 #endif
90 #ifndef INT16_MAX
91 #define INT16_MAX (32767)
92 #endif
93 #ifndef INT32_MAX
94 #define INT32_MAX (2147483647)
95 #endif
96 #ifndef UINT8_MAX
97 #define UINT8_MAX (255U)
98 #endif
99 #ifndef UINT16_MAX
100 #define UINT16_MAX (65535U)
101 #endif
102 #ifndef UINT32_MAX
103 #define UINT32_MAX (4294967295U)
104 #endif
105 
106 #endif /* ! C99 */
107 
108 #endif /* ! FLEXINT_H */
109 
110 #ifdef __cplusplus
111 
112 /* The "const" storage-class-modifier is valid. */
113 #define YY_USE_CONST
114 
115 #else /* ! __cplusplus */
116 
117 /* C99 requires __STDC__ to be defined as 1. */
118 #if defined (__STDC__)
119 
120 #define YY_USE_CONST
121 
122 #endif /* defined (__STDC__) */
123 #endif /* ! __cplusplus */
124 
125 #ifdef YY_USE_CONST
126 #define yyconst const
127 #else
128 #define yyconst
129 #endif
130 
131 /* Returned upon end-of-file. */
132 #define YY_NULL 0
133 
134 /* Promotes a possibly negative, possibly signed char to an unsigned
135  * integer for use as an array index. If the signed char is negative,
136  * we want to instead treat it as an 8-bit unsigned char, hence the
137  * double cast.
138  */
139 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
140 
141 /* Enter a start condition. This macro really ought to take a parameter,
142  * but we do it the disgusting crufty way forced on us by the ()-less
143  * definition of BEGIN.
144  */
145 #define BEGIN (yy_start) = 1 + 2 *
146 
147 /* Translate the current start state into a value that can be later handed
148  * to BEGIN to return to the state. The YYSTATE alias is for lex
149  * compatibility.
150  */
151 #define YY_START (((yy_start) - 1) / 2)
152 #define YYSTATE YY_START
153 
154 /* Action number for EOF rule of a given start state. */
155 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156 
157 /* Special action meaning "start processing a new file". */
158 #define YY_NEW_FILE netlist_restart(netlist_in )
159 
160 #define YY_END_OF_BUFFER_CHAR 0
161 
162 /* Size of default input buffer. */
163 #ifndef YY_BUF_SIZE
164 #ifdef __ia64__
165 /* On IA-64, the buffer size is 16k, not 8k.
166  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167  * Ditto for the __ia64__ case accordingly.
168  */
169 #define YY_BUF_SIZE 32768
170 #else
171 #define YY_BUF_SIZE 16384
172 #endif /* __ia64__ */
173 #endif
174 
175 /* The state buf must be large enough to hold one state per character in the main buffer.
176  */
177 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
178 
179 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
180 #define YY_TYPEDEF_YY_BUFFER_STATE
182 #endif
183 
184 extern int netlist_leng;
185 
186 extern FILE *netlist_in, *netlist_out;
187 
188 #define EOB_ACT_CONTINUE_SCAN 0
189 #define EOB_ACT_END_OF_FILE 1
190 #define EOB_ACT_LAST_MATCH 2
191 
192  /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
193  * access to the local variable yy_act. Since yyless() is a macro, it would break
194  * existing scanners that call yyless() from OUTSIDE netlist_lex.
195  * One obvious solution it to make yy_act a global. I tried that, and saw
196  * a 5% performance hit in a non-netlist_lineno scanner, because yy_act is
197  * normally declared as a register variable-- so it is not worth it.
198  */
199  #define YY_LESS_LINENO(n) \
200  do { \
201  int yyl;\
202  for ( yyl = n; yyl < netlist_leng; ++yyl )\
203  if ( netlist_text[yyl] == '\n' )\
204  --netlist_lineno;\
205  }while(0)
206 
207 /* Return all but the first "n" matched characters back to the input stream. */
208 #define yyless(n) \
209  do \
210  { \
211  /* Undo effects of setting up netlist_text. */ \
212  int yyless_macro_arg = (n); \
213  YY_LESS_LINENO(yyless_macro_arg);\
214  *yy_cp = (yy_hold_char); \
215  YY_RESTORE_YY_MORE_OFFSET \
216  (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
217  YY_DO_BEFORE_ACTION; /* set up netlist_text again */ \
218  } \
219  while ( 0 )
220 
221 #define unput(c) yyunput( c, (yytext_ptr) )
222 
223 #ifndef YY_TYPEDEF_YY_SIZE_T
224 #define YY_TYPEDEF_YY_SIZE_T
225 typedef size_t yy_size_t;
226 #endif
227 
228 #ifndef YY_STRUCT_YY_BUFFER_STATE
229 #define YY_STRUCT_YY_BUFFER_STATE
230 struct yy_buffer_state
231  {
232  FILE *yy_input_file;
233 
234  char *yy_ch_buf; /* input buffer */
235  char *yy_buf_pos; /* current position in input buffer */
236 
237  /* Size of input buffer in bytes, not including room for EOB
238  * characters.
239  */
241 
242  /* Number of characters read into yy_ch_buf, not including EOB
243  * characters.
244  */
245  int yy_n_chars;
246 
247  /* Whether we "own" the buffer - i.e., we know we created it,
248  * and can realloc() it to grow it, and should free() it to
249  * delete it.
250  */
251  int yy_is_our_buffer;
252 
253  /* Whether this is an "interactive" input source; if so, and
254  * if we're using stdio for input, then we want to use getc()
255  * instead of fread(), to make sure we stop fetching input after
256  * each newline.
257  */
258  int yy_is_interactive;
259 
260  /* Whether we're considered to be at the beginning of a line.
261  * If so, '^' rules will be active on the next match, otherwise
262  * not.
263  */
264  int yy_at_bol;
265 
266  int yy_bs_lineno;
267  int yy_bs_column;
269  /* Whether to try to fill the input buffer when we reach the
270  * end of it.
271  */
272  int yy_fill_buffer;
273 
274  int yy_buffer_status;
275 
276 #define YY_BUFFER_NEW 0
277 #define YY_BUFFER_NORMAL 1
278  /* When an EOF's been seen but there's still some text to process
279  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
280  * shouldn't try reading from the input source any more. We might
281  * still have a bunch of tokens to match, though, because of
282  * possible backing-up.
283  *
284  * When we actually see the EOF, we change the status to "new"
285  * (via netlist_restart()), so that the user can continue scanning by
286  * just pointing netlist_in at a new input file.
287  */
288 #define YY_BUFFER_EOF_PENDING 2
289 
290  };
291 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
292 
293 /* Stack of input buffers. */
294 static size_t yy_buffer_stack_top = 0;
295 static size_t yy_buffer_stack_max = 0;
296 static YY_BUFFER_STATE * yy_buffer_stack = 0;
298 /* We provide macros for accessing buffer states in case in the
299  * future we want to put the buffer states in a more general
300  * "scanner state".
301  *
302  * Returns the top of the stack, or NULL.
303  */
304 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
305  ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
306  : NULL)
307 
308 /* Same as previous macro, but useful when we know that the buffer stack is not
309  * NULL or when we need an lvalue. For internal use only.
310  */
311 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
312 
313 /* yy_hold_char holds the character lost when netlist_text is formed. */
314 static char yy_hold_char;
315 static int yy_n_chars; /* number of characters read into yy_ch_buf */
317 
318 /* Points to current character in buffer. */
319 static char *yy_c_buf_p = (char *) 0;
320 static int yy_init = 0; /* whether we need to initialize */
321 static int yy_start = 0; /* start state number */
322 
323 /* Flag which is used to allow netlist_wrap()'s to do buffer switches
324  * instead of setting up a fresh netlist_in. A bit of a hack ...
325  */
326 static int yy_did_buffer_switch_on_eof;
327 
328 void netlist_restart (FILE *input_file );
329 void netlist__switch_to_buffer (YY_BUFFER_STATE new_buffer );
330 YY_BUFFER_STATE netlist__create_buffer (FILE *file,int size );
331 void netlist__delete_buffer (YY_BUFFER_STATE b );
332 void netlist__flush_buffer (YY_BUFFER_STATE b );
333 void netlist_push_buffer_state (YY_BUFFER_STATE new_buffer );
334 void netlist_pop_buffer_state (void );
335 
336 static void netlist_ensure_buffer_stack (void );
337 static void netlist__load_buffer_state (void );
338 static void netlist__init_buffer (YY_BUFFER_STATE b,FILE *file );
339 
340 #define YY_FLUSH_BUFFER netlist__flush_buffer(YY_CURRENT_BUFFER )
341 
342 YY_BUFFER_STATE netlist__scan_buffer (char *base,yy_size_t size );
343 YY_BUFFER_STATE netlist__scan_string (yyconst char *yy_str );
344 YY_BUFFER_STATE netlist__scan_bytes (yyconst char *bytes,int len );
345 
346 void *netlist_alloc (yy_size_t );
347 void *netlist_realloc (void *,yy_size_t );
348 void netlist_free (void * );
349 
350 #define yy_new_buffer netlist__create_buffer
351 
352 #define yy_set_interactive(is_interactive) \
353  { \
354  if ( ! YY_CURRENT_BUFFER ){ \
355  netlist_ensure_buffer_stack (); \
356  YY_CURRENT_BUFFER_LVALUE = \
357  netlist__create_buffer(netlist_in,YY_BUF_SIZE ); \
358  } \
359  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
360  }
361 
362 #define yy_set_bol(at_bol) \
363  { \
364  if ( ! YY_CURRENT_BUFFER ){\
365  netlist_ensure_buffer_stack (); \
366  YY_CURRENT_BUFFER_LVALUE = \
367  netlist__create_buffer(netlist_in,YY_BUF_SIZE ); \
368  } \
369  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
370  }
371 
372 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
373 
374 /* Begin user sect3 */
375 
376 #define netlist_wrap(n) 1
377 #define YY_SKIP_YYWRAP
378 
379 typedef unsigned char YY_CHAR;
380 
381 FILE *netlist_in = (FILE *) 0, *netlist_out = (FILE *) 0;
382 
383 typedef int yy_state_type;
384 
385 extern int netlist_lineno;
386 
387 int netlist_lineno = 1;
388 
389 extern char *netlist_text;
390 #define yytext_ptr netlist_text
391 
392 static yy_state_type yy_get_previous_state (void );
393 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
394 static int yy_get_next_buffer (void );
395 static void yy_fatal_error (yyconst char msg[] );
396 
397 /* Done after the current pattern has been matched and before the
398  * corresponding action - sets up netlist_text.
399  */
400 #define YY_DO_BEFORE_ACTION \
401  (yytext_ptr) = yy_bp; \
402  netlist_leng = (size_t) (yy_cp - yy_bp); \
403  (yy_hold_char) = *yy_cp; \
404  *yy_cp = '\0'; \
405  (yy_c_buf_p) = yy_cp;
406 
407 #define YY_NUM_RULES 47
408 #define YY_END_OF_BUFFER 48
409 /* This struct is not used in this scanner,
410  but its presence is necessary. */
411 struct yy_trans_info
412  {
415  };
416 static yyconst flex_int16_t yy_accept[238] =
417  { 0,
418  0, 0, 0, 0, 0, 0, 0, 0, 48, 22,
419  19, 18, 22, 21, 20, 22, 15, 8, 16, 14,
420  17, 1, 5, 1, 1, 1, 5, 12, 22, 13,
421  5, 1, 5, 5, 1, 5, 22, 23, 24, 23,
422  28, 27, 26, 28, 25, 28, 28, 8, 14, 1,
423  5, 1, 1, 5, 12, 13, 5, 1, 5, 5,
424  1, 5, 28, 46, 19, 45, 46, 38, 29, 46,
425  46, 29, 46, 40, 39, 36, 46, 37, 42, 46,
426  41, 46, 18, 0, 8, 9, 0, 8, 0, 0,
427  0, 10, 0, 6, 0, 5, 0, 1, 1, 5,
428 
429  5, 1, 5, 19, 0, 1, 1, 0, 5, 5,
430  1, 0, 24, 26, 0, 5, 1, 1, 5, 1,
431  5, 1, 1, 0, 5, 5, 1, 45, 32, 34,
432  0, 44, 40, 40, 0, 40, 40, 40, 0, 0,
433  31, 33, 30, 0, 42, 41, 0, 41, 41, 42,
434  35, 0, 9, 0, 0, 0, 8, 0, 10, 5,
435  11, 5, 2, 1, 1, 5, 5, 7, 5, 5,
436  1, 1, 5, 5, 0, 43, 40, 0, 0, 40,
437  40, 42, 41, 0, 41, 41, 42, 41, 9, 0,
438  0, 8, 0, 10, 0, 5, 0, 5, 5, 5,
439 
440  0, 40, 40, 41, 41, 41, 42, 42, 0, 41,
441  41, 0, 9, 0, 3, 0, 0, 10, 0, 5,
442  5, 41, 0, 41, 41, 41, 9, 0, 0, 0,
443  10, 41, 41, 41, 0, 4, 0
444  } ;
445 
446 static yyconst flex_int32_t yy_ec[256] =
447  { 0,
448  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
449  1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
450  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451  1, 5, 6, 7, 8, 1, 9, 10, 11, 9,
452  9, 9, 12, 13, 12, 14, 9, 15, 15, 15,
453  15, 15, 15, 15, 15, 15, 15, 16, 17, 18,
454  19, 20, 9, 1, 21, 22, 23, 24, 25, 26,
455  27, 28, 23, 23, 29, 23, 30, 23, 31, 32,
456  23, 23, 33, 34, 23, 35, 36, 23, 23, 23,
457  37, 38, 39, 9, 23, 1, 40, 23, 23, 41,
458 
459  42, 43, 23, 44, 45, 46, 47, 48, 49, 50,
460  23, 51, 52, 23, 53, 54, 55, 23, 23, 23,
461  56, 57, 58, 59, 60, 1, 1, 1, 1, 1,
462  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
463  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
464  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
465  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
466  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
467  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
468  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 
470  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
471  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
472  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
473  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
474  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
475  1, 1, 1, 1, 1
476  } ;
477 
478 static yyconst flex_int32_t yy_meta[61] =
479  { 0,
480  1, 2, 3, 3, 4, 5, 1, 1, 1, 1,
481  1, 1, 1, 6, 7, 1, 1, 1, 8, 1,
482  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
483  7, 7, 7, 7, 7, 7, 1, 1, 1, 7,
484  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
485  7, 7, 7, 7, 7, 7, 7, 1, 1, 9
486  } ;
487 
488 static yyconst flex_int16_t yy_base[249] =
489  { 0,
490  0, 0, 58, 60, 64, 0, 124, 0, 717, 856,
491  856, 856, 710, 856, 856, 171, 185, 177, 856, 856,
492  856, 191, 193, 222, 652, 228, 254, 856, 200, 856,
493  264, 154, 274, 285, 166, 300, 0, 856, 856, 700,
494  856, 856, 856, 699, 856, 199, 686, 297, 856, 682,
495  681, 330, 174, 218, 856, 856, 207, 637, 211, 223,
496  190, 226, 0, 856, 856, 856, 685, 668, 856, 672,
497  670, 856, 659, 382, 856, 653, 652, 646, 311, 260,
498  436, 602, 856, 636, 303, 267, 305, 308, 604, 249,
499  234, 282, 333, 856, 0, 362, 0, 372, 387, 434,
500 
501  440, 487, 493, 856, 635, 282, 503, 618, 509, 357,
502  388, 558, 856, 856, 0, 598, 597, 251, 240, 596,
503  278, 277, 580, 571, 442, 307, 571, 856, 856, 856,
504  568, 856, 488, 373, 563, 0, 345, 856, 536, 358,
505  856, 856, 856, 0, 524, 550, 539, 369, 530, 531,
506  856, 526, 506, 405, 496, 510, 525, 503, 532, 554,
507  856, 547, 573, 452, 436, 602, 594, 856, 468, 287,
508  0, 0, 588, 450, 464, 856, 406, 437, 458, 445,
509  291, 562, 856, 436, 643, 620, 635, 650, 385, 457,
510  432, 614, 626, 485, 459, 695, 428, 664, 482, 420,
511 
512  413, 411, 856, 320, 706, 710, 714, 725, 404, 466,
513  729, 504, 393, 651, 558, 580, 389, 380, 375, 736,
514  551, 856, 370, 599, 740, 661, 365, 618, 312, 332,
515  288, 262, 744, 257, 211, 856, 856, 795, 803, 811,
516  814, 821, 829, 213, 837, 194, 846, 187
517  } ;
518 
519 static yyconst flex_int16_t yy_def[249] =
520  { 0,
521  237, 1, 238, 238, 237, 5, 237, 7, 237, 237,
522  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
523  237, 239, 239, 239, 24, 239, 239, 237, 237, 237,
524  239, 24, 239, 239, 24, 239, 240, 237, 237, 237,
525  237, 237, 237, 237, 237, 237, 237, 237, 237, 241,
526  241, 241, 241, 241, 237, 237, 241, 52, 241, 241,
527  52, 241, 240, 237, 237, 237, 237, 237, 237, 237,
528  242, 237, 237, 237, 237, 237, 237, 237, 243, 237,
529  243, 237, 237, 237, 237, 237, 237, 237, 237, 237,
530  237, 237, 237, 237, 244, 239, 245, 239, 239, 239,
531 
532  239, 239, 239, 237, 237, 24, 239, 244, 239, 109,
533  109, 240, 237, 237, 246, 241, 241, 241, 241, 241,
534  241, 52, 241, 246, 241, 241, 241, 237, 237, 237,
535  247, 237, 74, 133, 237, 74, 237, 237, 237, 237,
536  237, 237, 237, 248, 243, 237, 248, 81, 243, 243,
537  237, 237, 237, 237, 237, 237, 237, 237, 237, 244,
538  237, 109, 109, 24, 24, 244, 109, 237, 246, 241,
539  52, 52, 246, 241, 247, 237, 237, 237, 237, 134,
540  237, 248, 237, 237, 248, 243, 243, 243, 237, 237,
541  237, 237, 237, 237, 237, 244, 237, 109, 246, 241,
542 
543  237, 134, 237, 237, 248, 248, 248, 248, 237, 81,
544  243, 237, 237, 237, 237, 237, 237, 237, 237, 244,
545  246, 237, 237, 185, 248, 146, 237, 237, 237, 237,
546  237, 226, 248, 226, 237, 237, 0, 237, 237, 237,
547  237, 237, 237, 237, 237, 237, 237, 237
548  } ;
549 
550 static yyconst flex_int16_t yy_nxt[917] =
551  { 0,
552  10, 11, 12, 13, 11, 10, 14, 15, 10, 10,
553  10, 16, 10, 17, 18, 19, 20, 10, 21, 10,
554  22, 23, 23, 23, 24, 22, 25, 26, 22, 25,
555  27, 25, 22, 25, 22, 22, 28, 29, 30, 25,
556  31, 23, 32, 23, 33, 34, 25, 23, 35, 25,
557  25, 23, 22, 23, 25, 36, 23, 37, 10, 10,
558  39, 40, 39, 40, 41, 42, 43, 44, 42, 41,
559  45, 41, 41, 41, 41, 46, 41, 47, 48, 41,
560  49, 41, 41, 41, 50, 51, 51, 51, 52, 50,
561  52, 53, 50, 52, 54, 52, 50, 52, 50, 50,
562 
563  55, 41, 56, 52, 57, 51, 58, 51, 59, 60,
564  52, 51, 61, 52, 52, 51, 50, 51, 52, 62,
565  51, 63, 41, 41, 64, 65, 66, 67, 65, 68,
566  69, 64, 69, 70, 71, 69, 72, 73, 74, 69,
567  75, 76, 77, 78, 79, 79, 79, 79, 79, 79,
568  79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
569  69, 80, 69, 79, 79, 79, 79, 79, 81, 81,
570  79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
571  79, 64, 82, 64, 84, 85, 87, 115, 90, 87,
572  84, 85, 93, 182, 93, 93, 94, 93, 94, 88,
573 
574  169, 91, 104, 105, 95, 96, 95, 107, 89, 97,
575  110, 97, 84, 85, 111, 86, 86, 96, 91, 160,
576  115, 92, 92, 93, 124, 125, 93, 94, 122, 93,
577  120, 115, 93, 94, 126, 95, 124, 125, 127, 115,
578  97, 95, 98, 86, 86, 156, 97, 98, 157, 99,
579  98, 236, 100, 115, 98, 93, 98, 98, 93, 94,
580  123, 121, 104, 105, 115, 93, 123, 95, 93, 94,
581  98, 237, 97, 101, 98, 93, 232, 95, 93, 94,
582  152, 153, 97, 170, 102, 106, 93, 108, 109, 93,
583  94, 115, 97, 92, 92, 158, 159, 103, 108, 109,
584 
585  115, 93, 231, 97, 93, 94, 87, 117, 90, 87,
586  84, 85, 93, 95, 90, 93, 84, 85, 97, 90,
587  115, 91, 88, 107, 144, 171, 120, 91, 89, 97,
588  164, 172, 154, 96, 93, 117, 165, 93, 91, 203,
589  107, 92, 92, 115, 91, 203, 231, 92, 92, 154,
590  117, 97, 92, 92, 123, 117, 179, 118, 117, 180,
591  119, 235, 117, 93, 117, 117, 93, 94, 222, 179,
592  95, 96, 180, 93, 222, 95, 93, 94, 117, 227,
593  97, 96, 117, 134, 232, 95, 134, 237, 93, 227,
594  97, 93, 94, 186, 218, 135, 136, 138, 96, 189,
595 
596  95, 95, 96, 218, 107, 97, 137, 213, 138, 212,
597  187, 138, 96, 138, 237, 138, 191, 201, 226, 192,
598  202, 138, 139, 140, 138, 202, 212, 202, 138, 96,
599  138, 138, 138, 115, 200, 93, 138, 146, 93, 94,
600  146, 93, 213, 98, 93, 94, 192, 95, 201, 147,
601  148, 202, 97, 95, 97, 124, 125, 204, 97, 180,
602  149, 197, 149, 115, 200, 149, 174, 149, 197, 149,
603  217, 213, 180, 218, 132, 149, 150, 162, 149, 144,
604  210, 115, 149, 174, 149, 149, 149, 96, 93, 163,
605  149, 93, 94, 219, 93, 115, 221, 93, 94, 194,
606 
607  95, 237, 133, 96, 93, 97, 95, 93, 94, 216,
608  93, 97, 177, 93, 94, 219, 95, 194, 227, 152,
609  153, 97, 108, 109, 157, 93, 216, 97, 93, 178,
610  190, 93, 93, 167, 93, 93, 90, 144, 193, 157,
611  189, 102, 97, 144, 144, 158, 159, 190, 97, 97,
612  167, 146, 188, 185, 146, 93, 195, 181, 93, 228,
613  95, 96, 228, 93, 115, 221, 93, 95, 97, 92,
614  92, 96, 97, 195, 183, 144, 183, 133, 176, 183,
615  97, 183, 229, 183, 115, 173, 95, 96, 96, 183,
616  184, 230, 183, 115, 231, 98, 183, 96, 183, 183,
617 
618  183, 115, 173, 93, 183, 197, 93, 95, 198, 115,
619  115, 115, 199, 224, 96, 95, 166, 168, 96, 228,
620  97, 93, 228, 206, 93, 90, 196, 214, 192, 199,
621  214, 209, 166, 144, 210, 96, 93, 104, 97, 93,
622  182, 215, 229, 196, 146, 155, 209, 146, 144, 210,
623  88, 93, 214, 97, 93, 214, 144, 185, 92, 92,
624  151, 97, 234, 144, 143, 234, 215, 205, 97, 206,
625  142, 141, 206, 133, 206, 226, 206, 95, 198, 237,
626  132, 130, 206, 207, 208, 206, 129, 128, 96, 206,
627  123, 206, 206, 206, 115, 115, 93, 206, 211, 93,
628 
629  88, 114, 113, 96, 211, 96, 219, 93, 95, 220,
630  93, 93, 83, 97, 93, 93, 237, 223, 93, 144,
631  224, 237, 237, 144, 97, 237, 93, 144, 97, 93,
632  93, 237, 97, 93, 237, 225, 223, 93, 144, 224,
633  93, 93, 144, 97, 93, 93, 237, 97, 93, 95,
634  220, 237, 237, 144, 97, 237, 237, 144, 97, 237,
635  237, 237, 97, 237, 237, 237, 237, 237, 237, 237,
636  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
637  237, 237, 237, 237, 237, 237, 237, 237, 233, 237,
638  237, 237, 237, 237, 233, 38, 38, 38, 38, 38,
639 
640  38, 38, 38, 38, 96, 237, 96, 96, 96, 96,
641  96, 112, 237, 237, 112, 112, 112, 112, 112, 116,
642  116, 131, 131, 237, 131, 131, 131, 131, 131, 131,
643  145, 237, 145, 237, 145, 145, 145, 161, 161, 161,
644  161, 161, 161, 161, 237, 161, 175, 175, 237, 175,
645  175, 175, 175, 175, 175, 9, 237, 237, 237, 237,
646  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
647  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
648  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
649  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
650 
651  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
652  237, 237, 237, 237, 237, 237
653  } ;
654 
655 static yyconst flex_int16_t yy_chk[917] =
656  { 0,
657  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
658  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
659  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
660  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
661  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
662  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
663  3, 3, 4, 4, 5, 5, 5, 5, 5, 5,
664  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
665  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
666  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
667 
668  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
669  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
670  5, 5, 5, 5, 7, 7, 7, 7, 7, 7,
671  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
672  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
673  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
674  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
675  7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
676  7, 7, 7, 7, 16, 16, 17, 53, 18, 17,
677  18, 18, 22, 248, 23, 22, 22, 23, 23, 17,
678 
679  246, 18, 29, 29, 22, 32, 23, 32, 17, 22,
680  35, 23, 46, 46, 35, 16, 16, 35, 18, 244,
681  57, 18, 18, 24, 59, 59, 24, 24, 57, 26,
682  53, 54, 26, 26, 61, 24, 60, 60, 61, 62,
683  24, 26, 24, 46, 46, 91, 26, 24, 91, 24,
684  24, 235, 24, 119, 24, 27, 24, 24, 27, 27,
685  59, 54, 80, 80, 118, 31, 62, 27, 31, 31,
686  24, 234, 27, 24, 24, 33, 232, 31, 33, 33,
687  86, 86, 31, 119, 26, 31, 34, 33, 33, 34,
688  34, 121, 33, 90, 90, 92, 92, 27, 34, 34,
689 
690  170, 36, 231, 34, 36, 36, 87, 118, 48, 87,
691  48, 48, 79, 36, 85, 79, 85, 85, 36, 88,
692  126, 48, 88, 33, 79, 122, 121, 85, 87, 79,
693  106, 122, 88, 106, 93, 170, 106, 93, 48, 181,
694  36, 48, 48, 52, 85, 181, 230, 85, 85, 88,
695  52, 93, 88, 88, 126, 52, 137, 52, 52, 137,
696  52, 229, 52, 96, 52, 52, 96, 96, 204, 140,
697  110, 110, 140, 98, 204, 96, 98, 98, 52, 227,
698  96, 110, 52, 74, 223, 98, 74, 134, 99, 219,
699  98, 99, 99, 148, 218, 74, 74, 134, 110, 189,
700 
701  99, 111, 111, 217, 110, 99, 74, 213, 74, 189,
702  148, 74, 111, 74, 134, 74, 154, 177, 209, 154,
703  177, 74, 74, 74, 74, 202, 189, 201, 74, 111,
704  74, 74, 74, 200, 200, 100, 74, 81, 100, 100,
705  81, 101, 197, 99, 101, 101, 191, 100, 178, 81,
706  81, 178, 100, 101, 81, 125, 125, 184, 101, 180,
707  81, 174, 81, 174, 174, 81, 125, 81, 190, 81,
708  195, 190, 179, 195, 175, 81, 81, 100, 81, 210,
709  210, 169, 81, 125, 81, 81, 81, 165, 102, 101,
710  81, 102, 102, 199, 103, 199, 199, 103, 103, 194,
711 
712  102, 133, 133, 164, 107, 102, 103, 107, 107, 194,
713  109, 103, 133, 109, 109, 212, 107, 158, 212, 153,
714  153, 107, 109, 109, 156, 145, 194, 109, 145, 133,
715  153, 149, 150, 109, 149, 150, 157, 145, 155, 157,
716  152, 103, 145, 149, 150, 159, 159, 153, 149, 150,
717  109, 146, 150, 147, 146, 160, 159, 139, 160, 215,
718  162, 162, 215, 182, 221, 221, 182, 160, 146, 157,
719  157, 162, 160, 159, 146, 182, 146, 135, 131, 146,
720  182, 146, 215, 146, 127, 124, 163, 163, 162, 146,
721  146, 216, 146, 123, 216, 162, 146, 163, 146, 146,
722 
723  146, 173, 173, 166, 146, 167, 166, 167, 167, 120,
724  117, 116, 173, 224, 163, 166, 166, 112, 167, 228,
725  166, 186, 228, 224, 186, 192, 166, 193, 192, 173,
726  193, 186, 108, 186, 186, 167, 187, 105, 186, 187,
727  224, 193, 228, 166, 185, 89, 187, 185, 187, 187,
728  84, 188, 214, 187, 188, 214, 185, 185, 192, 192,
729  82, 185, 226, 188, 78, 226, 214, 185, 188, 185,
730  77, 76, 185, 73, 185, 226, 185, 198, 198, 226,
731  71, 70, 185, 185, 185, 185, 68, 67, 198, 185,
732  58, 185, 185, 185, 51, 50, 196, 185, 188, 196,
733 
734  47, 44, 40, 25, 188, 198, 196, 205, 196, 196,
735  205, 206, 13, 196, 206, 207, 9, 205, 207, 205,
736  205, 0, 0, 206, 205, 0, 208, 207, 206, 208,
737  211, 0, 207, 211, 0, 207, 208, 220, 208, 208,
738  220, 225, 211, 208, 225, 233, 0, 211, 233, 220,
739  220, 0, 0, 225, 220, 0, 0, 233, 225, 0,
740  0, 0, 233, 0, 0, 0, 0, 0, 0, 0,
741  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
742  0, 0, 0, 0, 0, 0, 0, 0, 225, 0,
743  0, 0, 0, 0, 225, 238, 238, 238, 238, 238,
744 
745  238, 238, 238, 238, 239, 0, 239, 239, 239, 239,
746  239, 240, 0, 0, 240, 240, 240, 240, 240, 241,
747  241, 242, 242, 0, 242, 242, 242, 242, 242, 242,
748  243, 0, 243, 0, 243, 243, 243, 245, 245, 245,
749  245, 245, 245, 245, 0, 245, 247, 247, 0, 247,
750  247, 247, 247, 247, 247, 237, 237, 237, 237, 237,
751  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
752  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
753  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
754  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
755 
756  237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
757  237, 237, 237, 237, 237, 237
758  } ;
759 
760 /* Table of booleans, true if rule could match eol. */
761 static yyconst flex_int32_t yy_rule_can_match_eol[48] =
762  { 0,
763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1,
764  0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
765  0, 0, 0, 0, 0, 1, 0, 0, };
766 
767 static yy_state_type yy_last_accepting_state;
768 static char *yy_last_accepting_cpos;
769 
770 extern int netlist__flex_debug;
771 int netlist__flex_debug = 0;
772 
773 /* The intent behind this definition is that it'll catch
774  * any uses of REJECT which flex missed.
775  */
776 #define REJECT reject_used_but_not_detected
777 #define yymore() yymore_used_but_not_detected
778 #define YY_MORE_ADJ 0
779 #define YY_RESTORE_YY_MORE_OFFSET
781 #line 1 "scan_netlist.l"
782 /* -*-c-*- */
783 #line 4 "scan_netlist.l"
784 /*
785  * scan_netlist.l - scanner for the Qucs netlist
786  *
787  * Copyright (C) 2003-2009 Stefan Jahn <stefan@lkcc.org>
788  *
789  * This is free software; you can redistribute it and/or modify
790  * it under the terms of the GNU General Public License as published by
791  * the Free Software Foundation; either version 2, or (at your option)
792  * any later version.
793  *
794  * This software is distributed in the hope that it will be useful,
795  * but WITHOUT ANY WARRANTY; without even the implied warranty of
796  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
797  * GNU General Public License for more details.
798  *
799  * You should have received a copy of the GNU General Public License
800  * along with this package; see the file COPYING. If not, write to
801  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
802  * Boston, MA 02110-1301, USA.
803  *
804  * $Id: scan_netlist.l 1825 2011-03-11 20:42:14Z ela $
805  *
806  */
807 
808 #if HAVE_CONFIG_H
809 # include <config.h>
810 #endif
811 
812 #include <stdio.h>
813 #include <stdlib.h>
814 #include <string.h>
815 #include <ctype.h>
816 
817 #ifdef __MINGW32__
818 #include <io.h>
819 #endif
820 
821 #ifdef HAVE_UNISTD_H
822 #include <unistd.h>
823 #endif
824 
825 #include "logging.h"
826 #include "equation.h"
827 #include "check_netlist.h"
828 #include "tokens_netlist.h"
829 
830 #if !HAVE_STRCHR
831 # define strchr index
832 # define strrchr rindex
833 #endif
834 
835 static double netlist_evaluate_scale (double val, char * scale) {
836  double factor = 1.0;
837  while (isspace (scale[0])) scale++;
838  switch (scale[0]) {
839  case 'E': factor = 1e+18; break;
840  case 'P': factor = 1e+15; break;
841  case 'T': factor = 1e+12; break;
842  case 'G': factor = 1e+09; break;
843  case 'M': factor = 1e+06; break;
844  case 'k': factor = 1e+03; break;
845  case 'm':
846  if (scale[1] == 'i' && scale[2] == 'l')
847  factor = 2.54e-5;
848  else
849  factor = 1e-03;
850  break;
851  case 'u': factor = 1e-06; break;
852  case 'n': factor = 1e-09; break;
853  case 'p': factor = 1e-12; break;
854  case 'f':
855  if (scale[1] == 't')
856  factor = 0.3048;
857  else
858  factor = 1e-15;
859  break;
860  case 'a': factor = 1e-18; break;
861  case 'd':
862  if (scale[1] == 'B') {
863  val = pow (10.0, val / 10.0);
864  if (scale[2] == 'm')
865  factor = 1e-03;
866  else if (scale[2] == 'u')
867  factor = 1e-06;
868  }
869  break;
870  case 'i':
871  if (scale[1] == 'n')
872  factor = 2.54e-2;
873  break;
874  case 'y':
875  if (scale[1] == 'd')
876  factor = 0.9144;
877  break;
878  }
879  return val * factor;
880 }
881 
882 
883 #line 884 "scan_netlist.cpp"
884 
885 #define INITIAL 0
886 #define COMMENT 1
887 #define STR 2
888 #define EQN 3
889 
890 #ifndef YY_EXTRA_TYPE
891 #define YY_EXTRA_TYPE void *
892 #endif
893 
894 static int yy_init_globals (void );
895 
896 /* Accessor methods to globals.
897  These are made visible to non-reentrant scanners for convenience. */
898 
899 int netlist_lex_destroy (void );
900 
901 int netlist_get_debug (void );
902 
903 void netlist_set_debug (int debug_flag );
904 
906 
907 void netlist_set_extra (YY_EXTRA_TYPE user_defined );
908 
909 FILE *netlist_get_in (void );
910 
911 void netlist_set_in (FILE * in_str );
912 
913 FILE *netlist_get_out (void );
914 
915 void netlist_set_out (FILE * out_str );
916 
917 int netlist_get_leng (void );
918 
919 char *netlist_get_text (void );
920 
921 int netlist_get_lineno (void );
922 
923 void netlist_set_lineno (int line_number );
924 
925 /* Macros after this point can all be overridden by user definitions in
926  * section 1.
927  */
928 
929 #ifndef YY_SKIP_YYWRAP
930 #ifdef __cplusplus
931 extern "C" int netlist_wrap (void );
932 #else
933 extern int netlist_wrap (void );
934 #endif
935 #endif
936 
937 #ifndef yytext_ptr
938 static void yy_flex_strncpy (char *,yyconst char *,int );
939 #endif
940 
941 #ifdef YY_NEED_STRLEN
942 static int yy_flex_strlen (yyconst char * );
943 #endif
944 
945 #ifndef YY_NO_INPUT
946 
947 #ifdef __cplusplus
948 static int yyinput (void );
949 #else
950 static int input (void );
951 #endif
952 
953 #endif
954 
955 /* Amount of stuff to slurp up with each read. */
956 #ifndef YY_READ_BUF_SIZE
957 #ifdef __ia64__
958 /* On IA-64, the buffer size is 16k, not 8k */
959 #define YY_READ_BUF_SIZE 16384
960 #else
961 #define YY_READ_BUF_SIZE 8192
962 #endif /* __ia64__ */
963 #endif
964 
965 /* Copy whatever the last rule matched to the standard output. */
966 #ifndef ECHO
967 /* This used to be an fputs(), but since the string might contain NUL's,
968  * we now use fwrite().
969  */
970 #define ECHO do { if (fwrite( netlist_text, netlist_leng, 1, netlist_out )) {} } while (0)
971 #endif
972 
973 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
974  * is returned in "result".
975  */
976 #ifndef YY_INPUT
977 #define YY_INPUT(buf,result,max_size) \
978  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
979  { \
980  int c = '*'; \
981  size_t n; \
982  for ( n = 0; n < max_size && \
983  (c = getc( netlist_in )) != EOF && c != '\n'; ++n ) \
984  buf[n] = (char) c; \
985  if ( c == '\n' ) \
986  buf[n++] = (char) c; \
987  if ( c == EOF && ferror( netlist_in ) ) \
988  YY_FATAL_ERROR( "input in flex scanner failed" ); \
989  result = n; \
990  } \
991  else \
992  { \
993  errno=0; \
994  while ( (result = fread(buf, 1, max_size, netlist_in))==0 && ferror(netlist_in)) \
995  { \
996  if( errno != EINTR) \
997  { \
998  YY_FATAL_ERROR( "input in flex scanner failed" ); \
999  break; \
1000  } \
1001  errno=0; \
1002  clearerr(netlist_in); \
1003  } \
1004  }\
1005 \
1006 
1007 #endif
1008 
1009 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1010  * we don't want an extra ';' after the "return" because that will cause
1011  * some compilers to complain about unreachable statements.
1012  */
1013 #ifndef yyterminate
1014 #define yyterminate() return YY_NULL
1015 #endif
1016 
1017 /* Number of entries by which start-condition stack grows. */
1018 #ifndef YY_START_STACK_INCR
1019 #define YY_START_STACK_INCR 25
1020 #endif
1021 
1022 /* Report a fatal error. */
1023 #ifndef YY_FATAL_ERROR
1024 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1025 #endif
1026 
1027 /* end tables serialization structures and prototypes */
1028 
1029 /* Default declaration of generated scanner - a define so the user can
1030  * easily add parameters.
1031  */
1032 #ifndef YY_DECL
1033 #define YY_DECL_IS_OURS 1
1034 
1035 extern int netlist_lex (void);
1036 
1037 #define YY_DECL int netlist_lex (void)
1038 #endif /* !YY_DECL */
1039 
1040 /* Code executed at the beginning of each rule, after netlist_text and netlist_leng
1041  * have been set up.
1042  */
1043 #ifndef YY_USER_ACTION
1044 #define YY_USER_ACTION
1045 #endif
1046 
1047 /* Code executed at the end of each rule. */
1048 #ifndef YY_BREAK
1049 #define YY_BREAK break;
1050 #endif
1051 
1052 #define YY_RULE_SETUP \
1053  YY_USER_ACTION
1054 
1057 YY_DECL
1059  register yy_state_type yy_current_state;
1060  register char *yy_cp, *yy_bp;
1061  register int yy_act;
1062 
1063 #line 145 "scan_netlist.l"
1064 
1065 
1066 #line 1067 "scan_netlist.cpp"
1067 
1068  if ( !(yy_init) )
1069  {
1070  (yy_init) = 1;
1071 
1072 #ifdef YY_USER_INIT
1073  YY_USER_INIT;
1074 #endif
1075 
1076  if ( ! (yy_start) )
1077  (yy_start) = 1; /* first start state */
1078 
1079  if ( ! netlist_in )
1080  netlist_in = stdin;
1081 
1082  if ( ! netlist_out )
1083  netlist_out = stdout;
1084 
1085  if ( ! YY_CURRENT_BUFFER ) {
1086  netlist_ensure_buffer_stack ();
1089  }
1090 
1091  netlist__load_buffer_state( );
1092  }
1093 
1094  while ( 1 ) /* loops until end-of-file is reached */
1095  {
1096  yy_cp = (yy_c_buf_p);
1097 
1098  /* Support of netlist_text. */
1099  *yy_cp = (yy_hold_char);
1100 
1101  /* yy_bp points to the position in yy_ch_buf of the start of
1102  * the current run.
1103  */
1104  yy_bp = yy_cp;
1105 
1106  yy_current_state = (yy_start);
1107 yy_match:
1108  do
1109  {
1110  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1111  if ( yy_accept[yy_current_state] )
1112  {
1113  (yy_last_accepting_state) = yy_current_state;
1114  (yy_last_accepting_cpos) = yy_cp;
1115  }
1116  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1117  {
1118  yy_current_state = (int) yy_def[yy_current_state];
1119  if ( yy_current_state >= 238 )
1120  yy_c = yy_meta[(unsigned int) yy_c];
1121  }
1122  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1123  ++yy_cp;
1124  }
1125  while ( yy_base[yy_current_state] != 856 );
1126 
1127 yy_find_action:
1128  yy_act = yy_accept[yy_current_state];
1129  if ( yy_act == 0 )
1130  { /* have to back up */
1131  yy_cp = (yy_last_accepting_cpos);
1132  yy_current_state = (yy_last_accepting_state);
1133  yy_act = yy_accept[yy_current_state];
1134  }
1135 
1137 
1138  if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1139  {
1140  int yyl;
1141  for ( yyl = 0; yyl < netlist_leng; ++yyl )
1142  if ( netlist_text[yyl] == '\n' )
1143 
1144  netlist_lineno++;
1145 ;
1146  }
1147 
1148 do_action: /* This label is used only to access EOF actions. */
1149 
1150  switch ( yy_act )
1151  { /* beginning of action switch */
1152  case 0: /* must back up */
1153  /* undo the effects of YY_DO_BEFORE_ACTION */
1154  *yy_cp = (yy_hold_char);
1155  yy_cp = (yy_last_accepting_cpos);
1156  yy_current_state = (yy_last_accepting_state);
1157  goto yy_find_action;
1158 
1159 case 1:
1161 #line 147 "scan_netlist.l"
1162 { /* identify scale and/or unit */
1163  netlist_lval.str = strdup (netlist_text);
1164  return ScaleOrUnit;
1165  }
1166  YY_BREAK
1167 case 2:
1169 #line 151 "scan_netlist.l"
1170 { /* special equation case */
1171  BEGIN(EQN);
1172  return Eqn;
1173  }
1174  YY_BREAK
1175 case 3:
1177 #line 155 "scan_netlist.l"
1178 {
1179  /* subcircuit definition begins */
1180  return DefSub;
1181  }
1182  YY_BREAK
1183 case 4:
1185 #line 159 "scan_netlist.l"
1186 {
1187  /* subcircuit definition ends */
1188  return EndSub;
1189  }
1190  YY_BREAK
1191 case 5:
1193 #line 163 "scan_netlist.l"
1194 { /* identify identifier */
1195  netlist_lval.ident = strdup (netlist_text);
1196  return Identifier;
1197  }
1198  YY_BREAK
1199 case 6:
1201 #line 167 "scan_netlist.l"
1202 { /* identify node identifier */
1203  netlist_lval.ident = strdup (netlist_text);
1204  return Identifier;
1205  }
1206  YY_BREAK
1207 case 7:
1209 #line 171 "scan_netlist.l"
1210 { /* identify file reference */
1211  char * p = strrchr (netlist_text, '}'); *p = '\0';
1212  netlist_lval.ident = strdup (&netlist_text[1]);
1213  return Identifier;
1214  }
1215  YY_BREAK
1216 case 8:
1218 #line 176 "scan_netlist.l"
1219 { /* identify (signed) real float */
1220  netlist_lval.d = strtod (netlist_text, NULL);
1221  return REAL;
1222  }
1223  YY_BREAK
1224 case 9:
1226 #line 180 "scan_netlist.l"
1227 { /* identify (signed) imaginary float */
1228  if (netlist_text[0] == 'i' || netlist_text[0] == 'j')
1229  netlist_text[0] = (netlist_text[1] == '\0') ? '1' : '0';
1230  else
1231  netlist_text[1] = '0';
1232  netlist_lval.d = strtod (netlist_text, NULL);
1233  return IMAG;
1234  }
1235  YY_BREAK
1236 case 10:
1238 #line 188 "scan_netlist.l"
1239 { /* identify complete (signed) complex number */
1240  int i = 0;
1241  while (netlist_text[i] != 'i' && netlist_text[i] != 'j') i++;
1242  netlist_text[i] = netlist_text[i - 1];
1243  netlist_text[i - 1] = '\0';
1244  netlist_lval.c.r = strtod (netlist_text, NULL);
1245  netlist_lval.c.i = strtod (&netlist_text[i], NULL);
1246  return COMPLEX;
1247  }
1248  YY_BREAK
1249 case 11:
1250 /* rule 11 can match eol */
1252 #line 197 "scan_netlist.l"
1253 { /* identify 'identifier =' assign */
1254  int len = netlist_leng - 3;
1255  while (isspace (netlist_text[len])) len--;
1256  netlist_lval.ident = (char *) calloc (len + 2, 1);
1257  memcpy (netlist_lval.ident, netlist_text, len + 1);
1258  yyless (netlist_leng - 1); /* push back last character */
1259  return Assign;
1260  }
1261  YY_BREAK
1262 case 12:
1264 #line 206 "scan_netlist.l"
1265 { /* special token for the value list */ return '['; }
1266  YY_BREAK
1267 case 13:
1269 #line 207 "scan_netlist.l"
1270 { /* special token for the value list */ return ']'; }
1271  YY_BREAK
1272 case 14:
1274 #line 208 "scan_netlist.l"
1275 { /* special token for the value list */ return ';'; }
1276  YY_BREAK
1277 case 15:
1279 #line 210 "scan_netlist.l"
1280 { /* pass the '.' to the parser */ return '.'; }
1281  YY_BREAK
1282 case 16:
1284 #line 211 "scan_netlist.l"
1285 { /* pass the ':' to the parser */ return ':'; }
1286  YY_BREAK
1287 case 17:
1289 #line 212 "scan_netlist.l"
1290 { /* pass the '=' to the parser */ return '='; }
1291  YY_BREAK
1292 case 18:
1293 /* rule 18 can match eol */
1295 #line 213 "scan_netlist.l"
1296 { /* detect end of line */ return Eol; }
1297  YY_BREAK
1298 case 19:
1299 /* rule 19 can match eol */
1301 #line 215 "scan_netlist.l"
1302 /* skip spaces and the trailing '\' */
1303  YY_BREAK
1304 case 20:
1306 #line 217 "scan_netlist.l"
1307 { /* leave these characters */
1308  BEGIN(COMMENT);
1309  }
1310  YY_BREAK
1311 case 21:
1313 #line 220 "scan_netlist.l"
1314 { /* string constant starts here */
1315  BEGIN(STR);
1316  return '"';
1317  }
1318  YY_BREAK
1319 case 22:
1321 #line 224 "scan_netlist.l"
1322 { /* any other character in invalid */
1323  logprint (LOG_ERROR,
1324  "line %d: syntax error, unrecognized character: `%s'\n",
1325  netlist_lineno, netlist_text);
1326  return InvalidCharacter;
1327  }
1328  YY_BREAK
1329 case 23:
1331 #line 231 "scan_netlist.l"
1332 { /* skip any character in here */ }
1333  YY_BREAK
1334 case 24:
1335 /* rule 24 can match eol */
1337 #line 232 "scan_netlist.l"
1338 { BEGIN(INITIAL); /* skipping ends here */ }
1339  YY_BREAK
1340 case 25:
1342 #line 234 "scan_netlist.l"
1343 { /* string constant ends here */
1344  BEGIN(INITIAL);
1345  return '"';
1346  }
1347  YY_BREAK
1348 case 26:
1349 /* rule 26 can match eol */
1351 #line 238 "scan_netlist.l"
1352 { /* string in a single line only */
1353  logprint (LOG_ERROR,
1354  "line %d: syntax error, unterminated string constant\n",
1355  netlist_lineno);
1356  return Eol;
1357  }
1358  YY_BREAK
1359 case 27:
1361 #line 244 "scan_netlist.l"
1362 /* skip spaces */
1363  YY_BREAK
1364 case 28:
1366 #line 246 "scan_netlist.l"
1367 { /* any other character is invalid */
1368  logprint (LOG_ERROR,
1369  "line %d: syntax error, unrecognized character: `%s'\n",
1370  netlist_lineno, netlist_text);
1371  return InvalidCharacter;
1372  }
1373  YY_BREAK
1374 case 29:
1376 #line 253 "scan_netlist.l"
1377 { /* return operators unchanged */
1378  return netlist_text[0];
1379  }
1380  YY_BREAK
1381 case 30:
1383 #line 257 "scan_netlist.l"
1384 { return GreaterOrEqual; }
1385  YY_BREAK
1386 case 31:
1388 #line 258 "scan_netlist.l"
1389 { return LessOrEqual; }
1390  YY_BREAK
1391 case 32:
1393 #line 259 "scan_netlist.l"
1394 { return NotEqual; }
1395  YY_BREAK
1396 case 33:
1398 #line 260 "scan_netlist.l"
1399 { return Equal; }
1400  YY_BREAK
1401 case 34:
1403 #line 261 "scan_netlist.l"
1404 { return And; }
1405  YY_BREAK
1406 case 35:
1408 #line 262 "scan_netlist.l"
1409 { return Or; }
1410  YY_BREAK
1411 case 36:
1413 #line 263 "scan_netlist.l"
1414 { return Less; }
1415  YY_BREAK
1416 case 37:
1418 #line 264 "scan_netlist.l"
1419 { return Greater; }
1420  YY_BREAK
1421 case 38:
1423 #line 265 "scan_netlist.l"
1424 { return Not; }
1425  YY_BREAK
1426 case 39:
1428 #line 267 "scan_netlist.l"
1429 { /* special tokens for vectors / matrices */
1430  return netlist_text[0];
1431  }
1432  YY_BREAK
1433 case 40:
1435 #line 271 "scan_netlist.l"
1436 { /* identify unsigned real float */
1437  char * endptr = NULL;
1438  netlist_lval.d = strtod (netlist_text, &endptr);
1439  netlist_lval.d = netlist_evaluate_scale (netlist_lval.d, endptr);
1440  return REAL;
1441  }
1442  YY_BREAK
1443 case 41:
1445 #line 277 "scan_netlist.l"
1446 { /* identify unsigned imaginary float */
1447  if (netlist_text[0] == 'i' || netlist_text[0] == 'j')
1448  netlist_text[0] = (netlist_text[1] == '\0') ? '1' : '0';
1449  else
1450  netlist_text[1] = '0';
1451  char * endptr = NULL;
1452  netlist_lval.d = strtod (netlist_text, &endptr);
1453  netlist_lval.d = netlist_evaluate_scale (netlist_lval.d, endptr);
1454  return IMAG;
1455  }
1456  YY_BREAK
1457 case 42:
1459 #line 287 "scan_netlist.l"
1460 { /* identify identifier */
1461  netlist_lval.ident = strdup (netlist_text);
1462  return Identifier;
1463  }
1464  YY_BREAK
1465 case 43:
1467 #line 291 "scan_netlist.l"
1468 {
1469  netlist_lval.chr = netlist_text[1];
1470  return Character;
1471  }
1472  YY_BREAK
1473 case 44:
1475 #line 295 "scan_netlist.l"
1476 {
1477  netlist_lval.str = strdup (&netlist_text[1]);
1478  netlist_lval.str[strlen (netlist_lval.str) - 1] = '\0';
1479  return STRING;
1480  }
1481  YY_BREAK
1482 case 45:
1483 /* rule 45 can match eol */
1485 #line 300 "scan_netlist.l"
1486 { /* detect end of line */ BEGIN(INITIAL); return Eol; }
1487  YY_BREAK
1488 case 46:
1490 #line 302 "scan_netlist.l"
1491 { /* any other character in invalid */
1492  logprint (LOG_ERROR,
1493  "line %d: syntax error, unrecognized character: `%s'\n",
1494  netlist_lineno, netlist_text);
1495  return InvalidCharacter;
1496  }
1497  YY_BREAK
1498 case 47:
1500 #line 309 "scan_netlist.l"
1501 ECHO;
1502  YY_BREAK
1503 #line 1504 "scan_netlist.cpp"
1504 case YY_STATE_EOF(INITIAL):
1505 case YY_STATE_EOF(COMMENT):
1506 case YY_STATE_EOF(STR):
1507 case YY_STATE_EOF(EQN):
1508  yyterminate();
1509 
1510  case YY_END_OF_BUFFER:
1511  {
1512  /* Amount of text matched not including the EOB char. */
1513  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1514 
1515  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1516  *yy_cp = (yy_hold_char);
1518 
1519  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1520  {
1521  /* We're scanning a new file or input source. It's
1522  * possible that this happened because the user
1523  * just pointed netlist_in at a new source and called
1524  * netlist_lex(). If so, then we have to assure
1525  * consistency between YY_CURRENT_BUFFER and our
1526  * globals. Here is the right place to do so, because
1527  * this is the first action (other than possibly a
1528  * back-up) that will match for the new input source.
1529  */
1530  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1531  YY_CURRENT_BUFFER_LVALUE->yy_input_file = netlist_in;
1532  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1533  }
1534 
1535  /* Note that here we test for yy_c_buf_p "<=" to the position
1536  * of the first EOB in the buffer, since yy_c_buf_p will
1537  * already have been incremented past the NUL character
1538  * (since all states make transitions on EOB to the
1539  * end-of-buffer state). Contrast this with the test
1540  * in input().
1541  */
1542  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1543  { /* This was really a NUL. */
1544  yy_state_type yy_next_state;
1545 
1546  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1547 
1548  yy_current_state = yy_get_previous_state( );
1549 
1550  /* Okay, we're now positioned to make the NUL
1551  * transition. We couldn't have
1552  * yy_get_previous_state() go ahead and do it
1553  * for us because it doesn't know how to deal
1554  * with the possibility of jamming (and we don't
1555  * want to build jamming into it because then it
1556  * will run more slowly).
1557  */
1558 
1559  yy_next_state = yy_try_NUL_trans( yy_current_state );
1560 
1561  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1562 
1563  if ( yy_next_state )
1564  {
1565  /* Consume the NUL. */
1566  yy_cp = ++(yy_c_buf_p);
1567  yy_current_state = yy_next_state;
1568  goto yy_match;
1569  }
1570 
1571  else
1572  {
1573  yy_cp = (yy_c_buf_p);
1574  goto yy_find_action;
1575  }
1576  }
1577 
1578  else switch ( yy_get_next_buffer( ) )
1579  {
1580  case EOB_ACT_END_OF_FILE:
1581  {
1582  (yy_did_buffer_switch_on_eof) = 0;
1583 
1584  if ( netlist_wrap( ) )
1585  {
1586  /* Note: because we've taken care in
1587  * yy_get_next_buffer() to have set up
1588  * netlist_text, we can now set up
1589  * yy_c_buf_p so that if some total
1590  * hoser (like flex itself) wants to
1591  * call the scanner after we return the
1592  * YY_NULL, it'll still work - another
1593  * YY_NULL will get returned.
1594  */
1595  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1596 
1597  yy_act = YY_STATE_EOF(YY_START);
1598  goto do_action;
1599  }
1600 
1601  else
1602  {
1603  if ( ! (yy_did_buffer_switch_on_eof) )
1604  YY_NEW_FILE;
1605  }
1606  break;
1607  }
1608 
1609  case EOB_ACT_CONTINUE_SCAN:
1610  (yy_c_buf_p) =
1611  (yytext_ptr) + yy_amount_of_matched_text;
1612 
1613  yy_current_state = yy_get_previous_state( );
1614 
1615  yy_cp = (yy_c_buf_p);
1616  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1617  goto yy_match;
1618 
1619  case EOB_ACT_LAST_MATCH:
1620  (yy_c_buf_p) =
1621  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1622 
1623  yy_current_state = yy_get_previous_state( );
1624 
1625  yy_cp = (yy_c_buf_p);
1626  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1627  goto yy_find_action;
1628  }
1629  break;
1630  }
1631 
1632  default:
1634  "fatal flex scanner internal error--no action found" );
1635  } /* end of action switch */
1636  } /* end of scanning one token */
1637 } /* end of netlist_lex */
1638 
1639 /* yy_get_next_buffer - try to read in a new buffer
1640  *
1641  * Returns a code representing an action:
1642  * EOB_ACT_LAST_MATCH -
1643  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1644  * EOB_ACT_END_OF_FILE - end of file
1645  */
1646 static int yy_get_next_buffer (void)
1647 {
1648  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1649  register char *source = (yytext_ptr);
1650  register int number_to_move, i;
1651  int ret_val;
1652 
1653  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1655  "fatal flex scanner internal error--end of buffer missed" );
1656 
1657  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1658  { /* Don't try to fill the buffer, so this is an EOF. */
1659  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1660  {
1661  /* We matched a single character, the EOB, so
1662  * treat this as a final EOF.
1663  */
1664  return EOB_ACT_END_OF_FILE;
1665  }
1666 
1667  else
1668  {
1669  /* We matched some text prior to the EOB, first
1670  * process it.
1671  */
1672  return EOB_ACT_LAST_MATCH;
1673  }
1674  }
1675 
1676  /* Try to read more data. */
1677 
1678  /* First move last chars to start of buffer. */
1679  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1680 
1681  for ( i = 0; i < number_to_move; ++i )
1682  *(dest++) = *(source++);
1683 
1684  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1685  /* don't do the read, it's not guaranteed to return an EOF,
1686  * just force an EOF
1687  */
1688  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1689 
1690  else
1691  {
1692  int num_to_read =
1693  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1694 
1695  while ( num_to_read <= 0 )
1696  { /* Not enough room in the buffer - grow it. */
1697 
1698  /* just a shorter name for the current buffer */
1699  YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1700 
1701  int yy_c_buf_p_offset =
1702  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1703 
1704  if ( b->yy_is_our_buffer )
1705  {
1706  int new_size = b->yy_buf_size * 2;
1707 
1708  if ( new_size <= 0 )
1709  b->yy_buf_size += b->yy_buf_size / 8;
1710  else
1711  b->yy_buf_size *= 2;
1712 
1713  b->yy_ch_buf = (char *)
1714  /* Include room in for 2 EOB chars. */
1715  netlist_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1716  }
1717  else
1718  /* Can't grow it, we don't own it. */
1719  b->yy_ch_buf = 0;
1720 
1721  if ( ! b->yy_ch_buf )
1723  "fatal error - scanner input buffer overflow" );
1724 
1725  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1726 
1727  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1728  number_to_move - 1;
1729 
1730  }
1731 
1732  if ( num_to_read > YY_READ_BUF_SIZE )
1733  num_to_read = YY_READ_BUF_SIZE;
1734 
1735  /* Read in more data. */
1736  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1737  (yy_n_chars), (size_t) num_to_read );
1738 
1739  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1740  }
1741 
1742  if ( (yy_n_chars) == 0 )
1743  {
1744  if ( number_to_move == YY_MORE_ADJ )
1745  {
1746  ret_val = EOB_ACT_END_OF_FILE;
1748  }
1749 
1750  else
1751  {
1752  ret_val = EOB_ACT_LAST_MATCH;
1753  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1755  }
1756  }
1757 
1758  else
1759  ret_val = EOB_ACT_CONTINUE_SCAN;
1760 
1761  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1762  /* Extend the array by 50%, plus the number we really need. */
1763  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1764  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) netlist_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1765  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1766  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1767  }
1768 
1769  (yy_n_chars) += number_to_move;
1770  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1771  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1772 
1773  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1774 
1775  return ret_val;
1776 }
1777 
1778 /* yy_get_previous_state - get the state just before the EOB char was reached */
1779 
1780  static yy_state_type yy_get_previous_state (void)
1781 {
1782  register yy_state_type yy_current_state;
1783  register char *yy_cp;
1784 
1785  yy_current_state = (yy_start);
1786 
1787  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1788  {
1789  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1790  if ( yy_accept[yy_current_state] )
1791  {
1792  (yy_last_accepting_state) = yy_current_state;
1793  (yy_last_accepting_cpos) = yy_cp;
1794  }
1795  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1796  {
1797  yy_current_state = (int) yy_def[yy_current_state];
1798  if ( yy_current_state >= 238 )
1799  yy_c = yy_meta[(unsigned int) yy_c];
1800  }
1801  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1802  }
1803 
1804  return yy_current_state;
1805 }
1806 
1807 /* yy_try_NUL_trans - try to make a transition on the NUL character
1808  *
1809  * synopsis
1810  * next_state = yy_try_NUL_trans( current_state );
1811  */
1812  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1813 {
1814  register int yy_is_jam;
1815  register char *yy_cp = (yy_c_buf_p);
1816 
1817  register YY_CHAR yy_c = 1;
1818  if ( yy_accept[yy_current_state] )
1819  {
1820  (yy_last_accepting_state) = yy_current_state;
1821  (yy_last_accepting_cpos) = yy_cp;
1822  }
1823  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1824  {
1825  yy_current_state = (int) yy_def[yy_current_state];
1826  if ( yy_current_state >= 238 )
1827  yy_c = yy_meta[(unsigned int) yy_c];
1828  }
1829  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1830  yy_is_jam = (yy_current_state == 237);
1831 
1832  return yy_is_jam ? 0 : yy_current_state;
1833 }
1834 
1835 #ifndef YY_NO_INPUT
1836 #ifdef __cplusplus
1837  static int yyinput (void)
1838 #else
1839  static int input (void)
1840 #endif
1841 
1842 {
1843  int c;
1844 
1845  *(yy_c_buf_p) = (yy_hold_char);
1846 
1847  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1848  {
1849  /* yy_c_buf_p now points to the character we want to return.
1850  * If this occurs *before* the EOB characters, then it's a
1851  * valid NUL; if not, then we've hit the end of the buffer.
1852  */
1853  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1854  /* This was really a NUL. */
1855  *(yy_c_buf_p) = '\0';
1856 
1857  else
1858  { /* need more input */
1859  int offset = (yy_c_buf_p) - (yytext_ptr);
1860  ++(yy_c_buf_p);
1861 
1862  switch ( yy_get_next_buffer( ) )
1863  {
1864  case EOB_ACT_LAST_MATCH:
1865  /* This happens because yy_g_n_b()
1866  * sees that we've accumulated a
1867  * token and flags that we need to
1868  * try matching the token before
1869  * proceeding. But for input(),
1870  * there's no matching to consider.
1871  * So convert the EOB_ACT_LAST_MATCH
1872  * to EOB_ACT_END_OF_FILE.
1873  */
1874 
1875  /* Reset buffer status. */
1877 
1878  /*FALLTHROUGH*/
1879 
1880  case EOB_ACT_END_OF_FILE:
1881  {
1882  if ( netlist_wrap( ) )
1883  return EOF;
1884 
1885  if ( ! (yy_did_buffer_switch_on_eof) )
1886  YY_NEW_FILE;
1887 #ifdef __cplusplus
1888  return yyinput();
1889 #else
1890  return input();
1891 #endif
1892  }
1893 
1894  case EOB_ACT_CONTINUE_SCAN:
1895  (yy_c_buf_p) = (yytext_ptr) + offset;
1896  break;
1897  }
1898  }
1899  }
1900 
1901  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1902  *(yy_c_buf_p) = '\0'; /* preserve netlist_text */
1903  (yy_hold_char) = *++(yy_c_buf_p);
1904 
1905  if ( c == '\n' )
1906 
1907  netlist_lineno++;
1908 ;
1909 
1910  return c;
1911 }
1912 #endif /* ifndef YY_NO_INPUT */
1913 
1919  void netlist_restart (FILE * input_file )
1920 {
1921 
1922  if ( ! YY_CURRENT_BUFFER ){
1923  netlist_ensure_buffer_stack ();
1926  }
1927 
1928  netlist__init_buffer(YY_CURRENT_BUFFER,input_file );
1929  netlist__load_buffer_state( );
1930 }
1931 
1936  void netlist__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1937 {
1938 
1939  /* TODO. We should be able to replace this entire function body
1940  * with
1941  * netlist_pop_buffer_state();
1942  * netlist_push_buffer_state(new_buffer);
1943  */
1944  netlist_ensure_buffer_stack ();
1945  if ( YY_CURRENT_BUFFER == new_buffer )
1946  return;
1947 
1948  if ( YY_CURRENT_BUFFER )
1949  {
1950  /* Flush out information for old buffer. */
1951  *(yy_c_buf_p) = (yy_hold_char);
1952  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1953  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1954  }
1955 
1956  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1957  netlist__load_buffer_state( );
1958 
1959  /* We don't actually know whether we did this switch during
1960  * EOF (netlist_wrap()) processing, but the only time this flag
1961  * is looked at is after netlist_wrap() is called, so it's safe
1962  * to go ahead and always set it.
1963  */
1964  (yy_did_buffer_switch_on_eof) = 1;
1965 }
1966 
1967 static void netlist__load_buffer_state (void)
1968 {
1969  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1970  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1971  netlist_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1972  (yy_hold_char) = *(yy_c_buf_p);
1973 }
1974 
1981  YY_BUFFER_STATE netlist__create_buffer (FILE * file, int size )
1982 {
1983  YY_BUFFER_STATE b;
1984 
1985  b = (YY_BUFFER_STATE) netlist_alloc(sizeof( struct yy_buffer_state ) );
1986  if ( ! b )
1987  YY_FATAL_ERROR( "out of dynamic memory in netlist__create_buffer()" );
1988 
1989  b->yy_buf_size = size;
1990 
1991  /* yy_ch_buf has to be 2 characters longer than the size given because
1992  * we need to put in 2 end-of-buffer characters.
1993  */
1994  b->yy_ch_buf = (char *) netlist_alloc(b->yy_buf_size + 2 );
1995  if ( ! b->yy_ch_buf )
1996  YY_FATAL_ERROR( "out of dynamic memory in netlist__create_buffer()" );
1997 
1998  b->yy_is_our_buffer = 1;
1999 
2000  netlist__init_buffer(b,file );
2001 
2002  return b;
2003 }
2004 
2009  void netlist__delete_buffer (YY_BUFFER_STATE b )
2010 {
2011 
2012  if ( ! b )
2013  return;
2014 
2015  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2017 
2018  if ( b->yy_is_our_buffer )
2019  netlist_free((void *) b->yy_ch_buf );
2020 
2021  netlist_free((void *) b );
2022 }
2023 
2024 #ifndef __cplusplus
2025 extern int isatty (int );
2026 #endif /* __cplusplus */
2027 
2028 /* Initializes or reinitializes a buffer.
2029  * This function is sometimes called more than once on the same buffer,
2030  * such as during a netlist_restart() or at EOF.
2031  */
2032  static void netlist__init_buffer (YY_BUFFER_STATE b, FILE * file )
2033 
2034 {
2035  int oerrno = errno;
2036 
2038 
2039  b->yy_input_file = file;
2040  b->yy_fill_buffer = 1;
2041 
2042  /* If b is the current buffer, then netlist__init_buffer was _probably_
2043  * called from netlist_restart() or through yy_get_next_buffer.
2044  * In that case, we don't want to reset the lineno or column.
2045  */
2046  if (b != YY_CURRENT_BUFFER){
2047  b->yy_bs_lineno = 1;
2048  b->yy_bs_column = 0;
2049  }
2050 
2051  b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2052 
2053  errno = oerrno;
2054 }
2055 
2060  void netlist__flush_buffer (YY_BUFFER_STATE b )
2061 {
2062  if ( ! b )
2063  return;
2064 
2065  b->yy_n_chars = 0;
2066 
2067  /* We always need two end-of-buffer characters. The first causes
2068  * a transition to the end-of-buffer state. The second causes
2069  * a jam in that state.
2070  */
2073 
2074  b->yy_buf_pos = &b->yy_ch_buf[0];
2075 
2076  b->yy_at_bol = 1;
2078 
2079  if ( b == YY_CURRENT_BUFFER )
2080  netlist__load_buffer_state( );
2081 }
2082 
2089 void netlist_push_buffer_state (YY_BUFFER_STATE new_buffer )
2090 {
2091  if (new_buffer == NULL)
2092  return;
2093 
2094  netlist_ensure_buffer_stack();
2095 
2096  /* This block is copied from netlist__switch_to_buffer. */
2097  if ( YY_CURRENT_BUFFER )
2098  {
2099  /* Flush out information for old buffer. */
2100  *(yy_c_buf_p) = (yy_hold_char);
2101  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2102  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2103  }
2104 
2105  /* Only push if top exists. Otherwise, replace top. */
2106  if (YY_CURRENT_BUFFER)
2107  (yy_buffer_stack_top)++;
2108  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2109 
2110  /* copied from netlist__switch_to_buffer. */
2111  netlist__load_buffer_state( );
2112  (yy_did_buffer_switch_on_eof) = 1;
2113 }
2114 
2120 {
2121  if (!YY_CURRENT_BUFFER)
2122  return;
2123 
2125  YY_CURRENT_BUFFER_LVALUE = NULL;
2126  if ((yy_buffer_stack_top) > 0)
2127  --(yy_buffer_stack_top);
2128 
2129  if (YY_CURRENT_BUFFER) {
2130  netlist__load_buffer_state( );
2131  (yy_did_buffer_switch_on_eof) = 1;
2132  }
2133 }
2134 
2135 /* Allocates the stack if it does not exist.
2136  * Guarantees space for at least one push.
2137  */
2138 static void netlist_ensure_buffer_stack (void)
2139 {
2140  int num_to_alloc;
2141 
2142  if (!(yy_buffer_stack)) {
2143 
2144  /* First allocation is just for 2 elements, since we don't know if this
2145  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2146  * immediate realloc on the next call.
2147  */
2148  num_to_alloc = 1;
2149  (yy_buffer_stack) = (struct yy_buffer_state**)netlist_alloc
2150  (num_to_alloc * sizeof(struct yy_buffer_state*)
2151  );
2152  if ( ! (yy_buffer_stack) )
2153  YY_FATAL_ERROR( "out of dynamic memory in netlist_ensure_buffer_stack()" );
2154 
2155  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2156 
2157  (yy_buffer_stack_max) = num_to_alloc;
2158  (yy_buffer_stack_top) = 0;
2159  return;
2160  }
2161 
2162  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2163 
2164  /* Increase the buffer to prepare for a possible push. */
2165  int grow_size = 8 /* arbitrary grow size */;
2166 
2167  num_to_alloc = (yy_buffer_stack_max) + grow_size;
2168  (yy_buffer_stack) = (struct yy_buffer_state**)netlist_realloc
2169  ((yy_buffer_stack),
2170  num_to_alloc * sizeof(struct yy_buffer_state*)
2171  );
2172  if ( ! (yy_buffer_stack) )
2173  YY_FATAL_ERROR( "out of dynamic memory in netlist_ensure_buffer_stack()" );
2174 
2175  /* zero only the new slots.*/
2176  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2177  (yy_buffer_stack_max) = num_to_alloc;
2178  }
2179 }
2180 
2187 YY_BUFFER_STATE netlist__scan_buffer (char * base, yy_size_t size )
2188 {
2189  YY_BUFFER_STATE b;
2190 
2191  if ( size < 2 ||
2192  base[size-2] != YY_END_OF_BUFFER_CHAR ||
2193  base[size-1] != YY_END_OF_BUFFER_CHAR )
2194  /* They forgot to leave room for the EOB's. */
2195  return 0;
2196 
2197  b = (YY_BUFFER_STATE) netlist_alloc(sizeof( struct yy_buffer_state ) );
2198  if ( ! b )
2199  YY_FATAL_ERROR( "out of dynamic memory in netlist__scan_buffer()" );
2200 
2201  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2202  b->yy_buf_pos = b->yy_ch_buf = base;
2203  b->yy_is_our_buffer = 0;
2204  b->yy_input_file = 0;
2205  b->yy_n_chars = b->yy_buf_size;
2206  b->yy_is_interactive = 0;
2207  b->yy_at_bol = 1;
2208  b->yy_fill_buffer = 0;
2210 
2212 
2213  return b;
2214 }
2215 
2224 YY_BUFFER_STATE netlist__scan_string (yyconst char * yystr )
2225 {
2226 
2227  return netlist__scan_bytes(yystr,strlen(yystr) );
2228 }
2229 
2237 YY_BUFFER_STATE netlist__scan_bytes (yyconst char * yybytes, int _yybytes_len )
2238 {
2239  YY_BUFFER_STATE b;
2240  char *buf;
2241  yy_size_t n;
2242  int i;
2243 
2244  /* Get memory for full buffer, including space for trailing EOB's. */
2245  n = _yybytes_len + 2;
2246  buf = (char *) netlist_alloc(n );
2247  if ( ! buf )
2248  YY_FATAL_ERROR( "out of dynamic memory in netlist__scan_bytes()" );
2249 
2250  for ( i = 0; i < _yybytes_len; ++i )
2251  buf[i] = yybytes[i];
2252 
2253  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2254 
2255  b = netlist__scan_buffer(buf,n );
2256  if ( ! b )
2257  YY_FATAL_ERROR( "bad buffer in netlist__scan_bytes()" );
2258 
2259  /* It's okay to grow etc. this buffer, and we should throw it
2260  * away when we're done.
2261  */
2262  b->yy_is_our_buffer = 1;
2263 
2264  return b;
2265 }
2266 
2267 #ifndef YY_EXIT_FAILURE
2268 #define YY_EXIT_FAILURE 2
2269 #endif
2270 
2271 static void yy_fatal_error (yyconst char* msg )
2272 {
2273  (void) fprintf( stderr, "%s\n", msg );
2274  exit( YY_EXIT_FAILURE );
2275 }
2276 
2277 /* Redefine yyless() so it works in section 3 code. */
2278 
2279 #undef yyless
2280 #define yyless(n) \
2281  do \
2282  { \
2283  /* Undo effects of setting up netlist_text. */ \
2284  int yyless_macro_arg = (n); \
2285  YY_LESS_LINENO(yyless_macro_arg);\
2286  netlist_text[netlist_leng] = (yy_hold_char); \
2287  (yy_c_buf_p) = netlist_text + yyless_macro_arg; \
2288  (yy_hold_char) = *(yy_c_buf_p); \
2289  *(yy_c_buf_p) = '\0'; \
2290  netlist_leng = yyless_macro_arg; \
2291  } \
2292  while ( 0 )
2293 
2294 /* Accessor methods (get/set functions) to struct members. */
2295 
2300 {
2301 
2302  return netlist_lineno;
2303 }
2304 
2308 FILE *netlist_get_in (void)
2309 {
2310  return netlist_in;
2311 }
2312 
2316 FILE *netlist_get_out (void)
2317 {
2318  return netlist_out;
2319 }
2320 
2325 {
2326  return netlist_leng;
2327 }
2328 
2333 char *netlist_get_text (void)
2334 {
2335  return netlist_text;
2336 }
2337 
2342 void netlist_set_lineno (int line_number )
2343 {
2344 
2345  netlist_lineno = line_number;
2346 }
2347 
2354 void netlist_set_in (FILE * in_str )
2355 {
2356  netlist_in = in_str ;
2357 }
2358 
2359 void netlist_set_out (FILE * out_str )
2360 {
2361  netlist_out = out_str ;
2362 }
2363 
2365 {
2366  return netlist__flex_debug;
2367 }
2368 
2369 void netlist_set_debug (int bdebug )
2370 {
2371  netlist__flex_debug = bdebug ;
2372 }
2373 
2374 static int yy_init_globals (void)
2375 {
2376  /* Initialization is the same as for the non-reentrant scanner.
2377  * This function is called from netlist_lex_destroy(), so don't allocate here.
2378  */
2379 
2380  /* We do not touch netlist_lineno unless the option is enabled. */
2381  netlist_lineno = 1;
2382 
2383  (yy_buffer_stack) = 0;
2384  (yy_buffer_stack_top) = 0;
2385  (yy_buffer_stack_max) = 0;
2386  (yy_c_buf_p) = (char *) 0;
2387  (yy_init) = 0;
2388  (yy_start) = 0;
2389 
2390 /* Defined in main.c */
2391 #ifdef YY_STDINIT
2392  netlist_in = stdin;
2393  netlist_out = stdout;
2394 #else
2395  netlist_in = (FILE *) 0;
2396  netlist_out = (FILE *) 0;
2397 #endif
2398 
2399  /* For future reference: Set errno on error, since we are called by
2400  * netlist_lex_init()
2401  */
2402  return 0;
2403 }
2404 
2405 /* netlist_lex_destroy is for both reentrant and non-reentrant scanners. */
2407 {
2408 
2409  /* Pop the buffer stack, destroying each element. */
2410  while(YY_CURRENT_BUFFER){
2412  YY_CURRENT_BUFFER_LVALUE = NULL;
2414  }
2415 
2416  /* Destroy the stack itself. */
2417  netlist_free((yy_buffer_stack) );
2418  (yy_buffer_stack) = NULL;
2419 
2420  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2421  * netlist_lex() is called, initialization will occur. */
2422  yy_init_globals( );
2423 
2424  return 0;
2425 }
2426 
2427 /*
2428  * Internal utility routines.
2429  */
2430 
2431 #ifndef yytext_ptr
2432 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2433 {
2434  register int i;
2435  for ( i = 0; i < n; ++i )
2436  s1[i] = s2[i];
2437 }
2438 #endif
2439 
2440 #ifdef YY_NEED_STRLEN
2441 static int yy_flex_strlen (yyconst char * s )
2442 {
2443  register int n;
2444  for ( n = 0; s[n]; ++n )
2445  ;
2446 
2447  return n;
2448 }
2449 #endif
2450 
2452 {
2453  return (void *) malloc( size );
2454 }
2455 
2456 void *netlist_realloc (void * ptr, yy_size_t size )
2457 {
2458  /* The cast to (char *) in the following accommodates both
2459  * implementations that use char* generic pointers, and those
2460  * that use void* generic pointers. It works with the latter
2461  * because both ANSI C and C++ allow castless assignment from
2462  * any pointer type to void*, and deal with argument conversions
2463  * as though doing an assignment.
2464  */
2465  return (void *) realloc( (char *) ptr, size );
2466 }
2467 
2468 void netlist_free (void * ptr )
2469 {
2470  free( (char *) ptr ); /* see netlist_realloc() for (char *) cast */
2471 }
2472 
2473 #define YYTABLES_NAME "yytables"
2474 
2475 #line 309 "scan_netlist.l"
2476 
2477 
2478