initial setup of thesis repository
[cluster_expansion_thesis.git] / little_helpers / tikz / sketch-0.2.161 / lex.yy.c
blob4edf4437bed5e96a0cc87ddb29220b4313b5622a
1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
5 */
7 #define FLEX_SCANNER
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
11 #include <stdio.h>
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
15 #ifdef c_plusplus
16 #ifndef __cplusplus
17 #define __cplusplus
18 #endif
19 #endif
22 #ifdef __cplusplus
24 #include <stdlib.h>
25 #include <unistd.h>
27 /* Use prototypes in function declarations. */
28 #define YY_USE_PROTOS
30 /* The "const" storage-class-modifier is valid. */
31 #define YY_USE_CONST
33 #else /* ! __cplusplus */
35 #if __STDC__
37 #define YY_USE_PROTOS
38 #define YY_USE_CONST
40 #endif /* __STDC__ */
41 #endif /* ! __cplusplus */
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
52 #ifdef YY_USE_CONST
53 #define yyconst const
54 #else
55 #define yyconst
56 #endif
59 #ifdef YY_USE_PROTOS
60 #define YY_PROTO(proto) proto
61 #else
62 #define YY_PROTO(proto) ()
63 #endif
65 /* Returned upon end-of-file. */
66 #define YY_NULL 0
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.
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
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.
79 #define BEGIN yy_start = 1 + 2 *
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.
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
101 extern int yyleng;
102 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
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:
112 * if ( condition_holds )
113 * yyless( 5 );
114 * else
115 * do_something_else();
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.
122 /* Return all but the first 'n' matched characters back to the input stream. */
124 #define yyless(n) \
125 do \
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 */ \
133 while ( 0 )
135 #define unput(c) yyunput( c, yytext_ptr )
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).
141 typedef unsigned int yy_size_t;
144 struct yy_buffer_state
146 FILE *yy_input_file;
148 char *yy_ch_buf; /* input buffer */
149 char *yy_buf_pos; /* current position in input buffer */
151 /* Size of input buffer in bytes, not including room for EOB
152 * characters.
154 yy_size_t yy_buf_size;
156 /* Number of characters read into yy_ch_buf, not including EOB
157 * characters.
159 int yy_n_chars;
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.
165 int yy_is_our_buffer;
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.
172 int yy_is_interactive;
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.
178 int yy_at_bol;
180 /* Whether to try to fill the input buffer when we reach the
181 * end of it.
183 int yy_fill_buffer;
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.
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.
198 #define YY_BUFFER_EOF_PENDING 2
201 static YY_BUFFER_STATE yy_current_buffer = 0;
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".
207 #define YY_CURRENT_BUFFER yy_current_buffer
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
213 static int yy_n_chars; /* number of characters read into yy_ch_buf */
216 int yyleng;
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 */
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 ...
226 static int yy_did_buffer_switch_on_eof;
228 void yyrestart YY_PROTO(( FILE *input_file ));
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 )
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 ));
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 * ));
246 #define yy_new_buffer yy_create_buffer
248 #define yy_set_interactive(is_interactive) \
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; \
255 #define yy_set_bol(at_bol) \
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; \
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
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
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[] ));
275 /* Done after the current pattern has been matched and before the
276 * corresponding action - sets up yytext.
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;
285 #define YY_NUM_RULES 57
286 #define YY_END_OF_BUFFER 58
287 static yyconst short int yy_accept[283] =
288 { 0,
289 0, 0, 0, 0, 58, 56, 2, 3, 1, 56,
290 54, 54, 54, 48, 56, 38, 54, 38, 38, 38,
291 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
292 54, 57, 57, 2, 1, 0, 41, 42, 43, 0,
293 0, 48, 48, 48, 0, 0, 40, 0, 38, 0,
294 0, 0, 0, 0, 38, 38, 38, 38, 38, 38,
295 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
296 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
297 38, 38, 38, 38, 0, 0, 0, 55, 0, 0,
298 44, 0, 0, 48, 0, 48, 0, 0, 0, 39,
300 0, 0, 0, 0, 0, 45, 0, 0, 0, 38,
301 38, 38, 38, 38, 13, 38, 38, 38, 38, 38,
302 38, 38, 38, 38, 38, 38, 38, 38, 19, 38,
303 38, 38, 21, 38, 38, 38, 38, 38, 38, 38,
304 38, 38, 0, 0, 0, 0, 47, 49, 0, 0,
305 0, 53, 0, 0, 0, 50, 0, 0, 0, 0,
306 0, 0, 38, 38, 38, 0, 25, 38, 14, 38,
307 38, 38, 38, 38, 38, 17, 38, 38, 38, 38,
308 38, 38, 38, 38, 0, 32, 38, 38, 38, 23,
309 7, 38, 38, 38, 0, 0, 51, 4, 0, 0,
311 0, 46, 38, 38, 38, 11, 15, 38, 10, 38,
312 38, 8, 38, 38, 38, 38, 38, 38, 38, 38,
313 38, 0, 34, 22, 38, 0, 36, 0, 37, 52,
314 0, 24, 12, 38, 16, 10, 38, 38, 38, 38,
315 38, 38, 38, 20, 38, 0, 31, 38, 38, 9,
316 38, 38, 38, 38, 18, 38, 38, 0, 30, 33,
317 38, 0, 26, 5, 38, 38, 0, 29, 6, 33,
318 38, 38, 38, 38, 38, 27, 0, 35, 38, 0,
319 28, 0
322 static yyconst int yy_ec[256] =
323 { 0,
324 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
325 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 2, 1, 1, 4, 1, 4, 1, 5, 6,
328 7, 8, 9, 8, 9, 10, 8, 11, 11, 12,
329 11, 11, 11, 11, 11, 11, 11, 1, 1, 13,
330 14, 15, 1, 1, 16, 16, 16, 16, 17, 16,
331 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
332 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
333 18, 1, 19, 8, 20, 1, 21, 22, 23, 24,
335 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
336 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
337 45, 46, 47, 8, 48, 1, 1, 1, 1, 1,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1
354 static yyconst int yy_meta[49] =
355 { 0,
356 1, 2, 3, 1, 1, 1, 4, 1, 1, 1,
357 5, 5, 1, 6, 7, 8, 8, 1, 9, 5,
358 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
359 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
360 8, 8, 8, 8, 8, 8, 1, 10
363 static yyconst short int yy_base[306] =
364 { 0,
365 0, 0, 884, 883, 926, 1093, 923, 1093, 0, 47,
366 49, 1093, 42, 45, 56, 904, 93, 40, 43, 41,
367 45, 47, 48, 52, 87, 89, 107, 109, 54, 57,
368 87, 1093, 875, 911, 0, 115, 1093, 1093, 1093, 117,
369 132, 137, 146, 155, 144, 143, 1093, 166, 879, 878,
370 883, 186, 234, 282, 153, 90, 144, 49, 95, 111,
371 155, 150, 225, 226, 230, 231, 159, 236, 235, 237,
372 238, 239, 311, 242, 312, 245, 251, 315, 313, 314,
373 316, 252, 113, 317, 338, 341, 848, 1093, 343, 352,
374 1093, 355, 362, 355, 337, 359, 371, 375, 381, 1093,
376 385, 0, 405, 414, 453, 1093, 419, 501, 549, 359,
377 356, 406, 428, 407, 874, 365, 409, 372, 164, 377,
378 412, 378, 415, 425, 430, 424, 55, 427, 869, 416,
379 454, 336, 867, 474, 458, 459, 462, 417, 540, 463,
380 541, 545, 569, 571, 573, 575, 1093, 1093, 580, 596,
381 589, 1093, 605, 866, 625, 1093, 582, 673, 634, 721,
382 865, 603, 472, 574, 465, 608, 1093, 466, 860, 468,
383 475, 550, 604, 260, 621, 855, 582, 626, 627, 630,
384 469, 559, 629, 631, 655, 1093, 639, 692, 664, 795,
385 756, 632, 699, 712, 735, 740, 1093, 1093, 788, 692,
387 687, 1093, 742, 642, 665, 650, 646, 676, 744, 677,
388 683, 644, 729, 679, 730, 687, 733, 693, 732, 764,
389 738, 769, 1093, 640, 731, 771, 1093, 776, 1093, 1093,
390 807, 1093, 546, 741, 500, 783, 779, 760, 791, 780,
391 792, 797, 796, 423, 818, 816, 1093, 808, 809, 379,
392 839, 814, 803, 593, 375, 844, 805, 846, 1093, 851,
393 811, 854, 1093, 340, 838, 835, 859, 1093, 254, 830,
394 843, 846, 849, 870, 854, 157, 875, 1093, 880, 889,
395 1093, 1093, 900, 910, 919, 926, 930, 938, 947, 955,
396 964, 971, 978, 985, 993, 1003, 1012, 1019, 1028, 1035,
398 1043, 1053, 1063, 1072, 1082
401 static yyconst short int yy_def[306] =
402 { 0,
403 282, 1, 283, 283, 282, 282, 282, 282, 284, 282,
404 285, 282, 282, 282, 286, 287, 288, 287, 287, 287,
405 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
406 289, 282, 290, 282, 284, 282, 282, 282, 282, 291,
407 292, 282, 282, 282, 282, 293, 282, 294, 287, 287,
408 295, 282, 296, 282, 287, 287, 287, 287, 287, 287,
409 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
410 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
411 287, 287, 287, 287, 297, 298, 290, 282, 299, 282,
412 282, 292, 292, 282, 282, 282, 300, 282, 294, 282,
414 294, 301, 302, 295, 296, 282, 105, 282, 303, 287,
415 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
416 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
417 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
418 287, 287, 304, 282, 298, 298, 282, 282, 299, 299,
419 300, 282, 300, 301, 302, 282, 155, 305, 295, 303,
420 282, 160, 287, 287, 287, 282, 282, 287, 287, 287,
421 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
422 287, 287, 287, 287, 282, 282, 287, 287, 287, 287,
423 287, 287, 287, 287, 304, 304, 282, 282, 305, 282,
425 199, 282, 287, 287, 287, 287, 287, 287, 287, 287,
426 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
427 287, 282, 282, 287, 287, 282, 282, 282, 282, 282,
428 282, 282, 287, 287, 287, 282, 287, 287, 287, 287,
429 287, 287, 287, 287, 287, 282, 282, 287, 287, 287,
430 287, 287, 287, 287, 287, 287, 287, 282, 282, 287,
431 287, 282, 282, 287, 287, 287, 282, 282, 287, 282,
432 287, 287, 287, 287, 287, 287, 282, 282, 287, 282,
433 282, 0, 282, 282, 282, 282, 282, 282, 282, 282,
434 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
436 282, 282, 282, 282, 282
439 static yyconst short int yy_nxt[1142] =
440 { 0,
441 6, 7, 8, 9, 10, 11, 12, 12, 12, 13,
442 14, 14, 15, 12, 6, 16, 16, 17, 12, 6,
443 18, 16, 19, 20, 16, 21, 22, 16, 23, 16,
444 16, 24, 16, 16, 16, 25, 16, 26, 27, 28,
445 29, 30, 16, 16, 16, 16, 31, 12, 36, 36,
446 40, 40, 42, 42, 43, 44, 44, 46, 46, 50,
447 50, 45, 50, 56, 50, 59, 50, 50, 50, 45,
448 47, 50, 64, 50, 50, 60, 50, 57, 62, 55,
449 65, 63, 61, 58, 180, 84, 114, 83, 85, 85,
450 37, 38, 39, 51, 52, 52, 51, 51, 51, 51,
452 51, 51, 51, 51, 51, 51, 50, 51, 50, 50,
453 54, 66, 51, 72, 50, 67, 36, 36, 40, 40,
454 115, 68, 111, 73, 69, 70, 50, 71, 50, 74,
455 50, 75, 50, 90, 90, 76, 80, 81, 91, 51,
456 51, 141, 77, 78, 46, 46, 82, 42, 42, 79,
457 116, 93, 95, 45, 96, 96, 94, 94, 37, 38,
458 39, 45, 45, 50, 43, 44, 44, 98, 98, 50,
459 45, 45, 50, 110, 50, 117, 50, 112, 50, 45,
460 100, 125, 113, 50, 118, 101, 51, 52, 52, 51,
461 51, 51, 51, 51, 51, 51, 51, 51, 51, 102,
463 51, 103, 103, 51, 172, 51, 103, 103, 103, 103,
464 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
465 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
466 103, 103, 51, 51, 51, 104, 104, 51, 51, 51,
467 51, 51, 51, 51, 50, 50, 51, 102, 51, 50,
468 50, 51, 106, 107, 50, 50, 50, 50, 50, 121,
469 119, 50, 132, 123, 50, 122, 120, 126, 124, 127,
470 50, 50, 140, 50, 130, 135, 128, 129, 134, 50,
471 51, 51, 51, 108, 108, 51, 51, 51, 51, 51,
472 51, 51, 51, 51, 51, 102, 51, 109, 109, 51,
474 211, 51, 109, 109, 109, 109, 109, 109, 109, 109,
475 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
476 109, 109, 109, 109, 109, 109, 109, 109, 51, 51,
477 50, 50, 50, 50, 50, 50, 50, 137, 138, 85,
478 85, 142, 144, 144, 90, 90, 139, 96, 96, 148,
479 131, 133, 136, 90, 90, 50, 90, 90, 148, 50,
480 146, 91, 150, 282, 282, 94, 94, 184, 282, 96,
481 96, 45, 98, 98, 93, 50, 98, 98, 50, 45,
482 164, 93, 98, 98, 50, 152, 282, 282, 147, 152,
483 153, 50, 163, 171, 50, 100, 50, 50, 50, 282,
485 101, 173, 175, 169, 101, 51, 104, 104, 51, 51,
486 51, 51, 51, 51, 51, 104, 104, 51, 102, 51,
487 51, 51, 51, 156, 157, 50, 50, 102, 50, 166,
488 166, 50, 156, 167, 50, 50, 50, 282, 174, 176,
489 182, 170, 50, 50, 50, 165, 50, 50, 168, 50,
490 190, 51, 51, 51, 104, 104, 51, 51, 51, 51,
491 51, 51, 51, 177, 181, 51, 102, 51, 179, 178,
492 51, 106, 107, 50, 183, 185, 185, 50, 50, 186,
493 187, 50, 50, 203, 50, 50, 189, 50, 50, 205,
494 206, 50, 207, 50, 50, 208, 192, 217, 188, 51,
496 51, 51, 108, 108, 51, 51, 51, 51, 51, 51,
497 51, 51, 51, 51, 102, 51, 158, 158, 51, 50,
498 51, 158, 158, 158, 158, 158, 158, 158, 158, 158,
499 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
500 158, 158, 158, 158, 158, 158, 158, 51, 51, 51,
501 159, 159, 51, 51, 51, 51, 51, 51, 51, 50,
502 50, 51, 102, 51, 50, 50, 51, 161, 162, 50,
503 144, 144, 144, 144, 144, 144, 282, 282, 50, 218,
504 193, 90, 90, 51, 51, 191, 148, 194, 196, 209,
505 98, 98, 146, 50, 146, 51, 51, 282, 282, 150,
507 282, 50, 282, 152, 51, 51, 282, 282, 153, 166,
508 166, 204, 50, 167, 266, 150, 197, 213, 197, 282,
509 147, 282, 282, 50, 153, 51, 104, 104, 51, 51,
510 51, 51, 51, 51, 51, 159, 159, 51, 102, 51,
511 50, 210, 51, 156, 157, 50, 50, 102, 50, 50,
512 50, 50, 200, 215, 216, 220, 185, 185, 50, 50,
513 186, 50, 233, 50, 212, 50, 214, 221, 219, 50,
514 225, 51, 51, 51, 159, 159, 51, 51, 51, 51,
515 51, 51, 51, 50, 50, 51, 102, 51, 51, 51,
516 51, 200, 201, 222, 222, 50, 50, 223, 50, 224,
518 226, 226, 50, 238, 227, 282, 50, 235, 234, 242,
519 230, 50, 50, 228, 228, 237, 240, 229, 50, 51,
520 51, 51, 159, 159, 51, 51, 51, 51, 51, 51,
521 51, 50, 244, 51, 102, 51, 144, 144, 51, 161,
522 162, 282, 282, 231, 231, 236, 236, 232, 50, 50,
523 50, 50, 50, 239, 196, 243, 245, 50, 248, 196,
524 50, 50, 249, 50, 241, 246, 246, 51, 51, 247,
525 222, 222, 226, 226, 223, 50, 227, 228, 228, 50,
526 250, 229, 197, 50, 236, 236, 252, 282, 51, 159,
527 159, 51, 51, 51, 51, 51, 51, 51, 50, 50,
529 51, 102, 51, 251, 254, 51, 200, 201, 231, 231,
530 50, 50, 232, 253, 50, 50, 50, 246, 246, 258,
531 258, 247, 50, 259, 50, 255, 257, 50, 50, 261,
532 50, 270, 270, 50, 51, 51, 256, 50, 264, 260,
533 262, 262, 265, 269, 263, 267, 267, 258, 258, 268,
534 271, 259, 270, 270, 50, 262, 262, 50, 50, 263,
535 267, 267, 50, 50, 268, 50, 272, 274, 50, 273,
536 50, 277, 277, 50, 50, 278, 277, 277, 279, 50,
537 278, 280, 280, 202, 198, 281, 50, 275, 50, 50,
538 280, 280, 276, 50, 281, 88, 102, 50, 50, 50,
540 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
541 35, 35, 34, 35, 35, 35, 35, 35, 35, 35,
542 41, 41, 88, 50, 34, 282, 41, 48, 48, 33,
543 33, 282, 48, 48, 49, 282, 282, 49, 53, 53,
544 53, 53, 53, 282, 53, 53, 282, 53, 86, 86,
545 282, 282, 282, 282, 86, 87, 87, 87, 87, 87,
546 87, 87, 87, 87, 87, 89, 89, 282, 282, 282,
547 282, 89, 92, 92, 92, 92, 282, 282, 92, 97,
548 97, 282, 282, 282, 282, 97, 99, 99, 282, 99,
549 282, 99, 99, 51, 51, 51, 51, 51, 51, 51,
551 51, 282, 51, 105, 105, 105, 105, 105, 105, 105,
552 105, 105, 105, 143, 143, 282, 282, 282, 282, 143,
553 145, 145, 282, 145, 282, 282, 145, 282, 145, 149,
554 149, 149, 149, 282, 282, 149, 151, 151, 282, 151,
555 282, 151, 151, 154, 154, 154, 154, 154, 154, 154,
556 154, 282, 154, 155, 155, 155, 155, 155, 155, 155,
557 155, 155, 155, 160, 160, 160, 160, 160, 160, 160,
558 160, 160, 160, 195, 195, 282, 195, 282, 282, 195,
559 282, 195, 199, 199, 199, 199, 199, 199, 199, 199,
560 199, 199, 5, 282, 282, 282, 282, 282, 282, 282,
562 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
563 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
564 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
565 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
569 static yyconst short int yy_chk[1142] =
570 { 0,
571 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
572 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
573 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
574 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
575 1, 1, 1, 1, 1, 1, 1, 1, 10, 10,
576 11, 11, 13, 13, 14, 14, 14, 15, 15, 18,
577 20, 14, 19, 19, 21, 20, 22, 23, 58, 14,
578 15, 24, 24, 29, 127, 20, 30, 19, 22, 18,
579 24, 23, 21, 19, 127, 30, 58, 29, 31, 31,
580 10, 10, 10, 17, 17, 17, 17, 17, 17, 17,
582 17, 17, 17, 17, 17, 17, 25, 17, 26, 56,
583 17, 25, 17, 26, 59, 25, 36, 36, 40, 40,
584 59, 25, 56, 26, 25, 25, 27, 25, 28, 27,
585 60, 27, 83, 41, 41, 27, 28, 28, 41, 17,
586 17, 83, 27, 27, 46, 46, 28, 42, 42, 27,
587 60, 41, 45, 42, 45, 45, 43, 43, 36, 36,
588 36, 42, 43, 57, 44, 44, 44, 48, 48, 62,
589 43, 44, 55, 55, 61, 61, 276, 57, 67, 44,
590 48, 67, 57, 119, 62, 48, 52, 52, 52, 52,
591 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
593 52, 52, 52, 52, 119, 52, 52, 52, 52, 52,
594 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
595 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
596 52, 52, 52, 52, 53, 53, 53, 53, 53, 53,
597 53, 53, 53, 53, 63, 64, 53, 53, 53, 65,
598 66, 53, 53, 53, 69, 68, 70, 71, 72, 64,
599 63, 74, 74, 65, 76, 64, 63, 68, 66, 69,
600 77, 82, 82, 269, 72, 77, 70, 71, 76, 174,
601 53, 53, 54, 54, 54, 54, 54, 54, 54, 54,
602 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
604 174, 54, 54, 54, 54, 54, 54, 54, 54, 54,
605 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
606 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
607 73, 75, 79, 80, 78, 81, 84, 79, 80, 85,
608 85, 84, 86, 86, 89, 89, 81, 95, 95, 89,
609 73, 75, 78, 90, 90, 132, 92, 92, 90, 264,
610 86, 92, 89, 93, 93, 94, 94, 132, 93, 96,
611 96, 94, 97, 97, 92, 111, 98, 98, 110, 94,
612 111, 93, 99, 99, 116, 97, 101, 101, 86, 98,
613 97, 118, 110, 118, 255, 99, 120, 122, 250, 101,
615 99, 120, 122, 116, 101, 103, 103, 103, 103, 103,
616 103, 103, 103, 103, 103, 104, 104, 103, 103, 103,
617 107, 107, 103, 103, 103, 112, 114, 104, 117, 113,
618 113, 121, 104, 113, 123, 130, 138, 107, 121, 123,
619 130, 117, 244, 126, 124, 112, 128, 113, 114, 125,
620 138, 103, 103, 105, 105, 105, 105, 105, 105, 105,
621 105, 105, 105, 124, 128, 105, 105, 105, 126, 125,
622 105, 105, 105, 131, 131, 134, 134, 135, 136, 134,
623 135, 137, 140, 163, 165, 168, 137, 170, 181, 165,
624 168, 163, 170, 134, 171, 171, 140, 181, 136, 105,
626 105, 108, 108, 108, 108, 108, 108, 108, 108, 108,
627 108, 108, 108, 108, 108, 108, 108, 108, 108, 235,
628 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
629 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
630 108, 108, 108, 108, 108, 108, 108, 108, 108, 109,
631 109, 109, 109, 109, 109, 109, 109, 109, 109, 139,
632 141, 109, 109, 109, 142, 233, 109, 109, 109, 172,
633 143, 143, 144, 144, 145, 145, 146, 146, 182, 182,
634 141, 149, 149, 157, 157, 139, 149, 142, 143, 172,
635 151, 151, 145, 164, 146, 109, 109, 150, 150, 149,
637 157, 177, 150, 151, 162, 162, 153, 153, 151, 166,
638 166, 164, 254, 166, 254, 150, 143, 177, 144, 153,
639 145, 162, 146, 173, 153, 155, 155, 155, 155, 155,
640 155, 155, 155, 155, 155, 159, 159, 155, 155, 155,
641 175, 173, 155, 155, 155, 178, 179, 159, 183, 180,
642 184, 192, 159, 179, 180, 184, 185, 185, 187, 224,
643 185, 204, 204, 212, 175, 207, 178, 187, 183, 206,
644 192, 155, 155, 158, 158, 158, 158, 158, 158, 158,
645 158, 158, 158, 189, 205, 158, 158, 158, 201, 201,
646 158, 158, 158, 188, 188, 208, 210, 188, 214, 189,
648 193, 193, 211, 211, 193, 201, 216, 208, 205, 216,
649 200, 188, 218, 194, 194, 210, 214, 194, 193, 158,
650 158, 160, 160, 160, 160, 160, 160, 160, 160, 160,
651 160, 194, 218, 160, 160, 160, 195, 195, 160, 160,
652 160, 196, 196, 203, 203, 209, 209, 203, 213, 215,
653 225, 219, 217, 213, 195, 217, 219, 221, 221, 196,
654 234, 203, 225, 209, 215, 220, 220, 160, 160, 220,
655 222, 222, 226, 226, 222, 191, 226, 228, 228, 238,
656 234, 228, 195, 220, 236, 236, 238, 196, 199, 199,
657 199, 199, 199, 199, 199, 199, 199, 199, 237, 240,
659 199, 199, 199, 237, 240, 199, 199, 199, 231, 231,
660 239, 241, 231, 239, 190, 243, 242, 246, 246, 245,
661 245, 246, 253, 245, 257, 241, 243, 248, 249, 249,
662 261, 270, 270, 252, 199, 199, 242, 245, 252, 248,
663 251, 251, 253, 257, 251, 256, 256, 258, 258, 256,
664 261, 258, 260, 260, 266, 262, 262, 265, 251, 262,
665 267, 267, 271, 256, 267, 272, 265, 271, 273, 266,
666 260, 274, 274, 275, 176, 274, 277, 277, 275, 169,
667 277, 279, 279, 161, 154, 279, 133, 272, 129, 274,
668 280, 280, 273, 115, 280, 87, 51, 50, 49, 279,
670 283, 283, 283, 283, 283, 283, 283, 283, 283, 283,
671 284, 284, 34, 284, 284, 284, 284, 284, 284, 284,
672 285, 285, 33, 16, 7, 5, 285, 286, 286, 4,
673 3, 0, 286, 286, 287, 0, 0, 287, 288, 288,
674 288, 288, 288, 0, 288, 288, 0, 288, 289, 289,
675 0, 0, 0, 0, 289, 290, 290, 290, 290, 290,
676 290, 290, 290, 290, 290, 291, 291, 0, 0, 0,
677 0, 291, 292, 292, 292, 292, 0, 0, 292, 293,
678 293, 0, 0, 0, 0, 293, 294, 294, 0, 294,
679 0, 294, 294, 295, 295, 295, 295, 295, 295, 295,
681 295, 0, 295, 296, 296, 296, 296, 296, 296, 296,
682 296, 296, 296, 297, 297, 0, 0, 0, 0, 297,
683 298, 298, 0, 298, 0, 0, 298, 0, 298, 299,
684 299, 299, 299, 0, 0, 299, 300, 300, 0, 300,
685 0, 300, 300, 301, 301, 301, 301, 301, 301, 301,
686 301, 0, 301, 302, 302, 302, 302, 302, 302, 302,
687 302, 302, 302, 303, 303, 303, 303, 303, 303, 303,
688 303, 303, 303, 304, 304, 0, 304, 0, 0, 304,
689 0, 304, 305, 305, 305, 305, 305, 305, 305, 305,
690 305, 305, 282, 282, 282, 282, 282, 282, 282, 282,
692 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
693 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
694 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
695 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
699 static yy_state_type yy_last_accepting_state;
700 static char *yy_last_accepting_cpos;
702 /* The intent behind this definition is that it'll catch
703 * any uses of REJECT which flex missed.
705 #define REJECT reject_used_but_not_detected
706 #define yymore() yymore_used_but_not_detected
707 #define YY_MORE_ADJ 0
708 #define YY_RESTORE_YY_MORE_OFFSET
709 char *yytext;
710 #line 1 "sketch.l"
711 #define INITIAL 0
712 #line 2 "sketch.l"
714 /* sketch.l
715 Copyright (C) 2005,2006,2007,2008 Eugene K. Ressler, Jr.
717 This file is part of Sketch, a small, simple system for making
718 3d drawings with LaTeX and the PSTricks or TikZ package.
720 Sketch is free software; you can redistribute it and/or modify
721 it under the terms of the GNU General Public License as published by
722 the Free Software Foundation; either version 3, or (at your option)
723 any later version.
725 Sketch is distributed in the hope that it will be useful,
726 but WITHOUT ANY WARRANTY; without even the implied warranty of
727 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
728 GNU General Public License for more details.
730 You should have received a copy of the GNU General Public License
731 along with Sketch; see the file COPYING.txt. If not, see
732 http://www.gnu.org/copyleft */
734 #include <stdio.h>
735 #include <stdlib.h>
736 #include <string.h>
737 #include "geometry.h"
738 #include "symbol.h"
739 #include "expr.h"
740 #include "parse.h"
741 #include "y.tab.h"
742 #include "error.h"
743 #include "opts.h"
745 #if defined(_WIN32) && !defined fileno
746 #define fileno(F) _fileno(F)
747 #pragma warning(disable:4102)
748 #endif
750 // undo the safety net in polygon.h so flex scanner can use these library functions
751 #undef malloc
752 #undef realloc
753 #undef free
754 #undef strdup
756 SRC_LINE line;
758 #define MAX_INPUT_DEPTH 10
760 struct {
761 YY_BUFFER_STATE buffer_state;
762 SRC_LINE line;
763 } input_stack[MAX_INPUT_DEPTH];
764 int input_stack_ptr = 0;
766 #define INIT_SPECIAL_BUF_SIZE 40
768 void update_line_number(void)
770 int i;
772 for (i = 0; yytext[i]; i++)
773 if (yytext[i] == '\n')
774 line.number++;
777 #define inputdirective 1
779 #line 780 "lex.yy.c"
781 /* Macros after this point can all be overridden by user definitions in
782 * section 1.
785 #ifndef YY_SKIP_YYWRAP
786 #ifdef __cplusplus
787 extern "C" int yywrap YY_PROTO(( void ));
788 #else
789 extern int yywrap YY_PROTO(( void ));
790 #endif
791 #endif
793 #ifndef YY_NO_UNPUT
794 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
795 #endif
797 #ifndef yytext_ptr
798 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
799 #endif
801 #ifdef YY_NEED_STRLEN
802 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
803 #endif
805 #ifndef YY_NO_INPUT
806 #ifdef __cplusplus
807 static int yyinput YY_PROTO(( void ));
808 #else
809 static int input YY_PROTO(( void ));
810 #endif
811 #endif
813 #if YY_STACK_USED
814 static int yy_start_stack_ptr = 0;
815 static int yy_start_stack_depth = 0;
816 static int *yy_start_stack = 0;
817 #ifndef YY_NO_PUSH_STATE
818 static void yy_push_state YY_PROTO(( int new_state ));
819 #endif
820 #ifndef YY_NO_POP_STATE
821 static void yy_pop_state YY_PROTO(( void ));
822 #endif
823 #ifndef YY_NO_TOP_STATE
824 static int yy_top_state YY_PROTO(( void ));
825 #endif
827 #else
828 #define YY_NO_PUSH_STATE 1
829 #define YY_NO_POP_STATE 1
830 #define YY_NO_TOP_STATE 1
831 #endif
833 #ifdef YY_MALLOC_DECL
834 YY_MALLOC_DECL
835 #else
836 #if __STDC__
837 #ifndef __cplusplus
838 #include <stdlib.h>
839 #endif
840 #else
841 /* Just try to get by without declaring the routines. This will fail
842 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
843 * or sizeof(void*) != sizeof(int).
845 #endif
846 #endif
848 /* Amount of stuff to slurp up with each read. */
849 #ifndef YY_READ_BUF_SIZE
850 #define YY_READ_BUF_SIZE 8192
851 #endif
853 /* Copy whatever the last rule matched to the standard output. */
855 #ifndef ECHO
856 /* This used to be an fputs(), but since the string might contain NUL's,
857 * we now use fwrite().
859 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
860 #endif
862 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
863 * is returned in "result".
865 #ifndef YY_INPUT
866 #define YY_INPUT(buf,result,max_size) \
867 if ( yy_current_buffer->yy_is_interactive ) \
869 int c = '*', n; \
870 for ( n = 0; n < max_size && \
871 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
872 buf[n] = (char) c; \
873 if ( c == '\n' ) \
874 buf[n++] = (char) c; \
875 if ( c == EOF && ferror( yyin ) ) \
876 YY_FATAL_ERROR( "input in flex scanner failed" ); \
877 result = n; \
879 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
880 && ferror( yyin ) ) \
881 YY_FATAL_ERROR( "input in flex scanner failed" );
882 #endif
884 /* No semi-colon after return; correct usage is to write "yyterminate();" -
885 * we don't want an extra ';' after the "return" because that will cause
886 * some compilers to complain about unreachable statements.
888 #ifndef yyterminate
889 #define yyterminate() return YY_NULL
890 #endif
892 /* Number of entries by which start-condition stack grows. */
893 #ifndef YY_START_STACK_INCR
894 #define YY_START_STACK_INCR 25
895 #endif
897 /* Report a fatal error. */
898 #ifndef YY_FATAL_ERROR
899 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
900 #endif
902 /* Default declaration of generated scanner - a define so the user can
903 * easily add parameters.
905 #ifndef YY_DECL
906 #define YY_DECL int yylex YY_PROTO(( void ))
907 #endif
909 /* Code executed at the beginning of each rule, after yytext and yyleng
910 * have been set up.
912 #ifndef YY_USER_ACTION
913 #define YY_USER_ACTION
914 #endif
916 /* Code executed at the end of each rule. */
917 #ifndef YY_BREAK
918 #define YY_BREAK break;
919 #endif
921 #define YY_RULE_SETUP \
922 YY_USER_ACTION
924 YY_DECL
926 register yy_state_type yy_current_state;
927 register char *yy_cp, *yy_bp;
928 register int yy_act;
930 #line 74 "sketch.l"
933 #line 934 "lex.yy.c"
935 if ( yy_init )
937 yy_init = 0;
939 #ifdef YY_USER_INIT
940 YY_USER_INIT;
941 #endif
943 if ( ! yy_start )
944 yy_start = 1; /* first start state */
946 if ( ! yyin )
947 yyin = stdin;
949 if ( ! yyout )
950 yyout = stdout;
952 if ( ! yy_current_buffer )
953 yy_current_buffer =
954 yy_create_buffer( yyin, YY_BUF_SIZE );
956 yy_load_buffer_state();
959 while ( 1 ) /* loops until end-of-file is reached */
961 yy_cp = yy_c_buf_p;
963 /* Support of yytext. */
964 *yy_cp = yy_hold_char;
966 /* yy_bp points to the position in yy_ch_buf of the start of
967 * the current run.
969 yy_bp = yy_cp;
971 yy_current_state = yy_start;
972 yy_match:
975 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
976 if ( yy_accept[yy_current_state] )
978 yy_last_accepting_state = yy_current_state;
979 yy_last_accepting_cpos = yy_cp;
981 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
983 yy_current_state = (int) yy_def[yy_current_state];
984 if ( yy_current_state >= 283 )
985 yy_c = yy_meta[(unsigned int) yy_c];
987 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
988 ++yy_cp;
990 while ( yy_base[yy_current_state] != 1093 );
992 yy_find_action:
993 yy_act = yy_accept[yy_current_state];
994 if ( yy_act == 0 )
995 { /* have to back up */
996 yy_cp = yy_last_accepting_cpos;
997 yy_current_state = yy_last_accepting_state;
998 yy_act = yy_accept[yy_current_state];
1001 YY_DO_BEFORE_ACTION;
1004 do_action: /* This label is used only to access EOF actions. */
1007 switch ( yy_act )
1008 { /* beginning of action switch */
1009 case 0: /* must back up */
1010 /* undo the effects of YY_DO_BEFORE_ACTION */
1011 *yy_cp = yy_hold_char;
1012 yy_cp = yy_last_accepting_cpos;
1013 yy_current_state = yy_last_accepting_state;
1014 goto yy_find_action;
1016 case 1:
1017 YY_RULE_SETUP
1018 #line 76 "sketch.l"
1019 /* comment; do nothing */
1020 YY_BREAK
1021 case 2:
1022 YY_RULE_SETUP
1023 #line 78 "sketch.l"
1024 /* white space; do nothing */
1025 YY_BREAK
1026 case 3:
1027 YY_RULE_SETUP
1028 #line 80 "sketch.l"
1030 line.number++;
1032 YY_BREAK
1033 case 4:
1034 YY_RULE_SETUP
1035 #line 84 "sketch.l"
1036 { /* [<stuff>=<stuff>] */
1037 // elide the brackets
1038 yylval.str = safe_malloc(yyleng + 1 - 2);
1039 str_slice(yylval.str, yyleng + 1 - 2, yytext, 1, -1);
1040 return OPTS_STR;
1042 YY_BREAK
1043 case 5:
1044 YY_RULE_SETUP
1045 #line 91 "sketch.l"
1047 return LANGUAGE;
1049 YY_BREAK
1050 case 6:
1051 YY_RULE_SETUP
1052 #line 95 "sketch.l"
1054 return PSTRICKS;
1056 YY_BREAK
1057 case 7:
1058 YY_RULE_SETUP
1059 #line 99 "sketch.l"
1061 return TIKZ;
1063 YY_BREAK
1064 case 8:
1065 YY_RULE_SETUP
1066 #line 103 "sketch.l"
1068 return LaTeX;
1070 YY_BREAK
1071 case 9:
1072 YY_RULE_SETUP
1073 #line 107 "sketch.l"
1075 return ConTeXt;
1077 YY_BREAK
1078 case 10:
1079 YY_RULE_SETUP
1080 #line 111 "sketch.l"
1082 update_line_number();
1083 BEGIN(inputdirective);
1085 YY_BREAK
1086 case 11:
1087 YY_RULE_SETUP
1088 #line 116 "sketch.l"
1090 return CURVE;
1092 YY_BREAK
1093 case 12:
1094 YY_RULE_SETUP
1095 #line 120 "sketch.l"
1097 return CAMERA;
1099 YY_BREAK
1100 case 13:
1101 YY_RULE_SETUP
1102 #line 124 "sketch.l"
1104 return DEF;
1106 YY_BREAK
1107 case 14:
1108 YY_RULE_SETUP
1109 #line 128 "sketch.l"
1111 return DOTS;
1113 YY_BREAK
1114 case 15:
1115 YY_RULE_SETUP
1116 #line 132 "sketch.l"
1118 return FRAME;
1120 YY_BREAK
1121 case 16:
1122 YY_RULE_SETUP
1123 #line 136 "sketch.l"
1125 return GLOBAL;
1127 YY_BREAK
1128 case 17:
1129 YY_RULE_SETUP
1130 #line 140 "sketch.l"
1132 return LINE;
1134 YY_BREAK
1135 case 18:
1136 YY_RULE_SETUP
1137 #line 144 "sketch.l"
1139 return POLYGON;
1141 YY_BREAK
1142 case 19:
1143 YY_RULE_SETUP
1144 #line 148 "sketch.l"
1146 return PUT;
1148 YY_BREAK
1149 case 20:
1150 YY_RULE_SETUP
1151 #line 152 "sketch.l"
1153 return REPEAT;
1155 YY_BREAK
1156 case 21:
1157 YY_RULE_SETUP
1158 #line 156 "sketch.l"
1160 return SET;
1162 YY_BREAK
1163 case 22:
1164 YY_RULE_SETUP
1165 #line 160 "sketch.l"
1167 return SWEEP;
1169 YY_BREAK
1170 case 23:
1171 YY_RULE_SETUP
1172 #line 164 "sketch.l"
1174 return THEN;
1176 YY_BREAK
1177 case 24:
1178 YY_RULE_SETUP
1179 #line 168 "sketch.l"
1181 update_line_number();
1182 return ATAN2;
1184 YY_BREAK
1185 case 25:
1186 YY_RULE_SETUP
1187 #line 173 "sketch.l"
1189 update_line_number();
1190 return COS;
1192 YY_BREAK
1193 case 26:
1194 YY_RULE_SETUP
1195 #line 178 "sketch.l"
1197 update_line_number();
1198 return INVERSE;
1200 YY_BREAK
1201 case 27:
1202 YY_RULE_SETUP
1203 #line 183 "sketch.l"
1205 return PICTUREBOX;
1207 YY_BREAK
1208 case 28:
1209 YY_RULE_SETUP
1210 #line 187 "sketch.l"
1212 update_line_number();
1213 return PERSPECTIVE;
1215 YY_BREAK
1216 case 29:
1217 YY_RULE_SETUP
1218 #line 192 "sketch.l"
1220 update_line_number();
1221 return PROJECT;
1223 YY_BREAK
1224 case 30:
1225 YY_RULE_SETUP
1226 #line 197 "sketch.l"
1228 update_line_number();
1229 return ROTATE;
1231 YY_BREAK
1232 case 31:
1233 YY_RULE_SETUP
1234 #line 202 "sketch.l"
1236 update_line_number();
1237 return SCALE;
1239 YY_BREAK
1240 case 32:
1241 YY_RULE_SETUP
1242 #line 207 "sketch.l"
1244 update_line_number();
1245 return SIN;
1247 YY_BREAK
1248 case 33:
1249 YY_RULE_SETUP
1250 #line 212 "sketch.l"
1252 char *rtn;
1253 int max_rtn_len, delim, i, ch;
1255 update_line_number();
1257 max_rtn_len = INIT_SPECIAL_BUF_SIZE - 1;
1258 rtn = safe_malloc(max_rtn_len + 1);
1259 i = 0;
1261 delim = input();
1263 if (delim == EOF) {
1264 err(line, "expected special text, found end of file");
1266 else {
1267 while ((ch = input()) != delim && ch != EOF) {
1268 if (ch == '\n')
1269 ++line.number;
1270 if (i == max_rtn_len) {
1271 max_rtn_len *= 2;
1272 rtn = safe_realloc(rtn, max_rtn_len + 1);
1274 rtn[i++] = ch;
1276 if (ch != delim)
1277 err(line, "missing end delimeter '%c' in special", delim);
1279 rtn[i] = '\0';
1280 yylval.str = rtn;
1281 return SPECIAL;
1283 YY_BREAK
1284 case 34:
1285 YY_RULE_SETUP
1286 #line 245 "sketch.l"
1288 update_line_number();
1289 return SQRT;
1291 YY_BREAK
1292 case 35:
1293 YY_RULE_SETUP
1294 #line 250 "sketch.l"
1296 update_line_number();
1297 return TRANSLATE;
1299 YY_BREAK
1300 case 36:
1301 YY_RULE_SETUP
1302 #line 255 "sketch.l"
1304 update_line_number();
1305 return UNIT;
1307 YY_BREAK
1308 case 37:
1309 YY_RULE_SETUP
1310 #line 260 "sketch.l"
1312 update_line_number();
1313 return VIEW;
1315 YY_BREAK
1316 case 38:
1317 YY_RULE_SETUP
1318 #line 265 "sketch.l"
1320 str_slice(yylval.name, sizeof yylval.name, yytext, 0, sizeof yylval.name);
1321 return ID;
1323 YY_BREAK
1324 case 39:
1325 YY_RULE_SETUP
1326 #line 270 "sketch.l"
1328 str_slice(yylval.name, sizeof yylval.name, yytext, 1, -1);
1329 return ANGLE_ID;
1331 YY_BREAK
1332 case 40:
1333 YY_RULE_SETUP
1334 #line 275 "sketch.l"
1336 return EMPTY_ANGLE;
1338 YY_BREAK
1339 case 41:
1340 YY_RULE_SETUP
1341 #line 279 "sketch.l"
1343 update_line_number();
1344 yylval.index = 0;
1345 return TICK;
1347 YY_BREAK
1348 case 42:
1349 YY_RULE_SETUP
1350 #line 285 "sketch.l"
1352 update_line_number();
1353 yylval.index = 1;
1354 return TICK;
1356 YY_BREAK
1357 case 43:
1358 YY_RULE_SETUP
1359 #line 291 "sketch.l"
1361 update_line_number();
1362 yylval.index = 2;
1363 return TICK;
1365 YY_BREAK
1366 case 44:
1367 YY_RULE_SETUP
1368 #line 297 "sketch.l"
1370 str_slice(yylval.name, sizeof yylval.name, yytext, 1, -1);
1371 return PAREN_ID;
1373 YY_BREAK
1374 case 45:
1375 YY_RULE_SETUP
1376 #line 302 "sketch.l"
1378 str_slice(yylval.name, sizeof yylval.name, yytext, 1, -1);
1379 return BRACKET_ID;
1381 YY_BREAK
1382 case 46:
1383 YY_RULE_SETUP
1384 #line 307 "sketch.l"
1386 str_slice(yylval.name, sizeof yylval.name, yytext, 2, -2);
1387 return DBL_BRACKET_ID;
1389 YY_BREAK
1390 case 47:
1391 YY_RULE_SETUP
1392 #line 312 "sketch.l"
1394 str_slice(yylval.name, sizeof yylval.name, yytext, 1, -1);
1395 return CURLY_ID;
1397 YY_BREAK
1398 case 48:
1399 YY_RULE_SETUP
1400 #line 317 "sketch.l"
1402 if (sscanf(yytext, FLOAT_SCAN_FMT, &yylval.flt) != 1) {
1403 err(line, "numeric constant %s could not be converted (probably out of range)", yytext);
1404 yylval.flt = 0;
1406 return NUM;
1408 YY_BREAK
1409 case 49:
1410 YY_RULE_SETUP
1411 #line 325 "sketch.l"
1413 warn(line, "found parenthesized identifier '%s'; delete space if you meant a point ref", yytext);
1414 yyless(1);
1415 return '(';
1417 YY_BREAK
1418 case 50:
1419 YY_RULE_SETUP
1420 #line 331 "sketch.l"
1422 warn(line, "found id in brackets '%s'; delete space if you meant a vector ref", yytext);
1423 yyless(1);
1424 return '[';
1426 YY_BREAK
1427 case 51:
1428 YY_RULE_SETUP
1429 #line 337 "sketch.l"
1431 warn(line, "found id in braces '%s'; delete space if you meant a drawable ref", yytext);
1432 yyless(1);
1433 return '{';
1435 YY_BREAK
1436 case 52:
1437 YY_RULE_SETUP
1438 #line 343 "sketch.l"
1440 warn(line, "found id in double-brackets '%s'; delete space if you meant a transform ref", yytext);
1441 yyless(1);
1442 return '[';
1444 YY_BREAK
1445 case 53:
1446 YY_RULE_SETUP
1447 #line 349 "sketch.l"
1449 warn(line, "found id in angle-brackets '%s'; delete space if you meant a tag ref", yytext);
1450 yyless(1);
1451 return '<';
1453 YY_BREAK
1454 case 54:
1455 YY_RULE_SETUP
1456 #line 355 "sketch.l"
1458 return yytext[0];
1460 YY_BREAK
1461 case 55:
1462 YY_RULE_SETUP
1463 #line 359 "sketch.l"
1466 FILE *f;
1467 char buf[1024];
1468 int i;
1470 if (line.file_name[0] != '/' && line.file_name[0] != '\\')
1471 i = str_last_occurance(line.file_name, "/\\");
1472 if (i >= 0) {
1473 str_slice(buf, sizeof buf, line.file_name, 0, i + 1);
1475 else {
1476 buf[0] = '\0';
1479 i = strlen(buf);
1480 str_slice(&buf[i], sizeof buf - i, yytext, 1, -1);
1482 if (input_stack_ptr >= MAX_INPUT_DEPTH) {
1483 err(line, "inputs nested too deeply (file '%s' ignored)", buf);
1485 else {
1486 f = fopen(buf, "r");
1487 if (f) {
1488 yyin = f;
1489 input_stack[input_stack_ptr].buffer_state = YY_CURRENT_BUFFER;
1490 input_stack[input_stack_ptr].line = line;
1491 input_stack_ptr++;
1492 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
1493 line.number = 1;
1494 line.include_p = 1;
1495 line.file_name = safe_strdup(buf);
1497 else
1498 err(line, "can't open input '%s'", buf);
1500 BEGIN(INITIAL);
1502 YY_BREAK
1503 case YY_STATE_EOF(INITIAL):
1504 case YY_STATE_EOF(inputdirective):
1505 #line 398 "sketch.l"
1507 if (input_stack_ptr == 0) {
1508 yyterminate();
1510 else {
1511 yy_delete_buffer(YY_CURRENT_BUFFER);
1512 // don't free: refs may still exist for def locs in the symbol table
1513 // safe_free(line.file_name);
1514 --input_stack_ptr;
1515 yy_switch_to_buffer(input_stack[input_stack_ptr].buffer_state);
1516 line = input_stack[input_stack_ptr].line;
1519 YY_BREAK
1520 case 56:
1521 YY_RULE_SETUP
1522 #line 412 "sketch.l"
1524 die(line, "bad char '%c' (%d)\n", yytext[0], (int)yytext[0]);
1526 YY_BREAK
1527 case 57:
1528 YY_RULE_SETUP
1529 #line 416 "sketch.l"
1530 ECHO;
1531 YY_BREAK
1532 #line 1533 "lex.yy.c"
1534 case YY_END_OF_BUFFER:
1536 /* Amount of text matched not including the EOB char. */
1537 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1539 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1540 *yy_cp = yy_hold_char;
1541 YY_RESTORE_YY_MORE_OFFSET
1543 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1545 /* We're scanning a new file or input source. It's
1546 * possible that this happened because the user
1547 * just pointed yyin at a new source and called
1548 * yylex(). If so, then we have to assure
1549 * consistency between yy_current_buffer and our
1550 * globals. Here is the right place to do so, because
1551 * this is the first action (other than possibly a
1552 * back-up) that will match for the new input source.
1554 yy_n_chars = yy_current_buffer->yy_n_chars;
1555 yy_current_buffer->yy_input_file = yyin;
1556 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1559 /* Note that here we test for yy_c_buf_p "<=" to the position
1560 * of the first EOB in the buffer, since yy_c_buf_p will
1561 * already have been incremented past the NUL character
1562 * (since all states make transitions on EOB to the
1563 * end-of-buffer state). Contrast this with the test
1564 * in input().
1566 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1567 { /* This was really a NUL. */
1568 yy_state_type yy_next_state;
1570 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1572 yy_current_state = yy_get_previous_state();
1574 /* Okay, we're now positioned to make the NUL
1575 * transition. We couldn't have
1576 * yy_get_previous_state() go ahead and do it
1577 * for us because it doesn't know how to deal
1578 * with the possibility of jamming (and we don't
1579 * want to build jamming into it because then it
1580 * will run more slowly).
1583 yy_next_state = yy_try_NUL_trans( yy_current_state );
1585 yy_bp = yytext_ptr + YY_MORE_ADJ;
1587 if ( yy_next_state )
1589 /* Consume the NUL. */
1590 yy_cp = ++yy_c_buf_p;
1591 yy_current_state = yy_next_state;
1592 goto yy_match;
1595 else
1597 yy_cp = yy_c_buf_p;
1598 goto yy_find_action;
1602 else switch ( yy_get_next_buffer() )
1604 case EOB_ACT_END_OF_FILE:
1606 yy_did_buffer_switch_on_eof = 0;
1608 if ( yywrap() )
1610 /* Note: because we've taken care in
1611 * yy_get_next_buffer() to have set up
1612 * yytext, we can now set up
1613 * yy_c_buf_p so that if some total
1614 * hoser (like flex itself) wants to
1615 * call the scanner after we return the
1616 * YY_NULL, it'll still work - another
1617 * YY_NULL will get returned.
1619 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1621 yy_act = YY_STATE_EOF(YY_START);
1622 goto do_action;
1625 else
1627 if ( ! yy_did_buffer_switch_on_eof )
1628 YY_NEW_FILE;
1630 break;
1633 case EOB_ACT_CONTINUE_SCAN:
1634 yy_c_buf_p =
1635 yytext_ptr + yy_amount_of_matched_text;
1637 yy_current_state = yy_get_previous_state();
1639 yy_cp = yy_c_buf_p;
1640 yy_bp = yytext_ptr + YY_MORE_ADJ;
1641 goto yy_match;
1643 case EOB_ACT_LAST_MATCH:
1644 yy_c_buf_p =
1645 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1647 yy_current_state = yy_get_previous_state();
1649 yy_cp = yy_c_buf_p;
1650 yy_bp = yytext_ptr + YY_MORE_ADJ;
1651 goto yy_find_action;
1653 break;
1656 default:
1657 YY_FATAL_ERROR(
1658 "fatal flex scanner internal error--no action found" );
1659 } /* end of action switch */
1660 } /* end of scanning one token */
1661 } /* end of yylex */
1664 /* yy_get_next_buffer - try to read in a new buffer
1666 * Returns a code representing an action:
1667 * EOB_ACT_LAST_MATCH -
1668 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1669 * EOB_ACT_END_OF_FILE - end of file
1672 static int yy_get_next_buffer()
1674 register char *dest = yy_current_buffer->yy_ch_buf;
1675 register char *source = yytext_ptr;
1676 register int number_to_move, i;
1677 int ret_val;
1679 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1680 YY_FATAL_ERROR(
1681 "fatal flex scanner internal error--end of buffer missed" );
1683 if ( yy_current_buffer->yy_fill_buffer == 0 )
1684 { /* Don't try to fill the buffer, so this is an EOF. */
1685 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1687 /* We matched a single character, the EOB, so
1688 * treat this as a final EOF.
1690 return EOB_ACT_END_OF_FILE;
1693 else
1695 /* We matched some text prior to the EOB, first
1696 * process it.
1698 return EOB_ACT_LAST_MATCH;
1702 /* Try to read more data. */
1704 /* First move last chars to start of buffer. */
1705 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1707 for ( i = 0; i < number_to_move; ++i )
1708 *(dest++) = *(source++);
1710 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1711 /* don't do the read, it's not guaranteed to return an EOF,
1712 * just force an EOF
1714 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1716 else
1718 int num_to_read =
1719 yy_current_buffer->yy_buf_size - number_to_move - 1;
1721 while ( num_to_read <= 0 )
1722 { /* Not enough room in the buffer - grow it. */
1723 #ifdef YY_USES_REJECT
1724 YY_FATAL_ERROR(
1725 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1726 #else
1728 /* just a shorter name for the current buffer */
1729 YY_BUFFER_STATE b = yy_current_buffer;
1731 int yy_c_buf_p_offset =
1732 (int) (yy_c_buf_p - b->yy_ch_buf);
1734 if ( b->yy_is_our_buffer )
1736 int new_size = b->yy_buf_size * 2;
1738 if ( new_size <= 0 )
1739 b->yy_buf_size += b->yy_buf_size / 8;
1740 else
1741 b->yy_buf_size *= 2;
1743 b->yy_ch_buf = (char *)
1744 /* Include room in for 2 EOB chars. */
1745 yy_flex_realloc( (void *) b->yy_ch_buf,
1746 b->yy_buf_size + 2 );
1748 else
1749 /* Can't grow it, we don't own it. */
1750 b->yy_ch_buf = 0;
1752 if ( ! b->yy_ch_buf )
1753 YY_FATAL_ERROR(
1754 "fatal error - scanner input buffer overflow" );
1756 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1758 num_to_read = yy_current_buffer->yy_buf_size -
1759 number_to_move - 1;
1760 #endif
1763 if ( num_to_read > YY_READ_BUF_SIZE )
1764 num_to_read = YY_READ_BUF_SIZE;
1766 /* Read in more data. */
1767 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1768 yy_n_chars, num_to_read );
1770 yy_current_buffer->yy_n_chars = yy_n_chars;
1773 if ( yy_n_chars == 0 )
1775 if ( number_to_move == YY_MORE_ADJ )
1777 ret_val = EOB_ACT_END_OF_FILE;
1778 yyrestart( yyin );
1781 else
1783 ret_val = EOB_ACT_LAST_MATCH;
1784 yy_current_buffer->yy_buffer_status =
1785 YY_BUFFER_EOF_PENDING;
1789 else
1790 ret_val = EOB_ACT_CONTINUE_SCAN;
1792 yy_n_chars += number_to_move;
1793 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1794 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1796 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1798 return ret_val;
1802 /* yy_get_previous_state - get the state just before the EOB char was reached */
1804 static yy_state_type yy_get_previous_state()
1806 register yy_state_type yy_current_state;
1807 register char *yy_cp;
1809 yy_current_state = yy_start;
1811 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1813 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1814 if ( yy_accept[yy_current_state] )
1816 yy_last_accepting_state = yy_current_state;
1817 yy_last_accepting_cpos = yy_cp;
1819 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1821 yy_current_state = (int) yy_def[yy_current_state];
1822 if ( yy_current_state >= 283 )
1823 yy_c = yy_meta[(unsigned int) yy_c];
1825 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1828 return yy_current_state;
1832 /* yy_try_NUL_trans - try to make a transition on the NUL character
1834 * synopsis
1835 * next_state = yy_try_NUL_trans( current_state );
1838 #ifdef YY_USE_PROTOS
1839 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1840 #else
1841 static yy_state_type yy_try_NUL_trans( yy_current_state )
1842 yy_state_type yy_current_state;
1843 #endif
1845 register int yy_is_jam;
1846 register char *yy_cp = yy_c_buf_p;
1848 register YY_CHAR yy_c = 1;
1849 if ( yy_accept[yy_current_state] )
1851 yy_last_accepting_state = yy_current_state;
1852 yy_last_accepting_cpos = yy_cp;
1854 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1856 yy_current_state = (int) yy_def[yy_current_state];
1857 if ( yy_current_state >= 283 )
1858 yy_c = yy_meta[(unsigned int) yy_c];
1860 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1861 yy_is_jam = (yy_current_state == 282);
1863 return yy_is_jam ? 0 : yy_current_state;
1867 #ifndef YY_NO_UNPUT
1868 #ifdef YY_USE_PROTOS
1869 static void yyunput( int c, register char *yy_bp )
1870 #else
1871 static void yyunput( c, yy_bp )
1872 int c;
1873 register char *yy_bp;
1874 #endif
1876 register char *yy_cp = yy_c_buf_p;
1878 /* undo effects of setting up yytext */
1879 *yy_cp = yy_hold_char;
1881 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1882 { /* need to shift things up to make room */
1883 /* +2 for EOB chars. */
1884 register int number_to_move = yy_n_chars + 2;
1885 register char *dest = &yy_current_buffer->yy_ch_buf[
1886 yy_current_buffer->yy_buf_size + 2];
1887 register char *source =
1888 &yy_current_buffer->yy_ch_buf[number_to_move];
1890 while ( source > yy_current_buffer->yy_ch_buf )
1891 *--dest = *--source;
1893 yy_cp += (int) (dest - source);
1894 yy_bp += (int) (dest - source);
1895 yy_current_buffer->yy_n_chars =
1896 yy_n_chars = yy_current_buffer->yy_buf_size;
1898 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1899 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1902 *--yy_cp = (char) c;
1905 yytext_ptr = yy_bp;
1906 yy_hold_char = *yy_cp;
1907 yy_c_buf_p = yy_cp;
1909 #endif /* ifndef YY_NO_UNPUT */
1912 #ifdef __cplusplus
1913 static int yyinput()
1914 #else
1915 static int input()
1916 #endif
1918 int c;
1920 *yy_c_buf_p = yy_hold_char;
1922 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1924 /* yy_c_buf_p now points to the character we want to return.
1925 * If this occurs *before* the EOB characters, then it's a
1926 * valid NUL; if not, then we've hit the end of the buffer.
1928 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1929 /* This was really a NUL. */
1930 *yy_c_buf_p = '\0';
1932 else
1933 { /* need more input */
1934 int offset = yy_c_buf_p - yytext_ptr;
1935 ++yy_c_buf_p;
1937 switch ( yy_get_next_buffer() )
1939 case EOB_ACT_LAST_MATCH:
1940 /* This happens because yy_g_n_b()
1941 * sees that we've accumulated a
1942 * token and flags that we need to
1943 * try matching the token before
1944 * proceeding. But for input(),
1945 * there's no matching to consider.
1946 * So convert the EOB_ACT_LAST_MATCH
1947 * to EOB_ACT_END_OF_FILE.
1950 /* Reset buffer status. */
1951 yyrestart( yyin );
1953 /* fall through */
1955 case EOB_ACT_END_OF_FILE:
1957 if ( yywrap() )
1958 return EOF;
1960 if ( ! yy_did_buffer_switch_on_eof )
1961 YY_NEW_FILE;
1962 #ifdef __cplusplus
1963 return yyinput();
1964 #else
1965 return input();
1966 #endif
1969 case EOB_ACT_CONTINUE_SCAN:
1970 yy_c_buf_p = yytext_ptr + offset;
1971 break;
1976 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1977 *yy_c_buf_p = '\0'; /* preserve yytext */
1978 yy_hold_char = *++yy_c_buf_p;
1981 return c;
1985 #ifdef YY_USE_PROTOS
1986 void yyrestart( FILE *input_file )
1987 #else
1988 void yyrestart( input_file )
1989 FILE *input_file;
1990 #endif
1992 if ( ! yy_current_buffer )
1993 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1995 yy_init_buffer( yy_current_buffer, input_file );
1996 yy_load_buffer_state();
2000 #ifdef YY_USE_PROTOS
2001 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2002 #else
2003 void yy_switch_to_buffer( new_buffer )
2004 YY_BUFFER_STATE new_buffer;
2005 #endif
2007 if ( yy_current_buffer == new_buffer )
2008 return;
2010 if ( yy_current_buffer )
2012 /* Flush out information for old buffer. */
2013 *yy_c_buf_p = yy_hold_char;
2014 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2015 yy_current_buffer->yy_n_chars = yy_n_chars;
2018 yy_current_buffer = new_buffer;
2019 yy_load_buffer_state();
2021 /* We don't actually know whether we did this switch during
2022 * EOF (yywrap()) processing, but the only time this flag
2023 * is looked at is after yywrap() is called, so it's safe
2024 * to go ahead and always set it.
2026 yy_did_buffer_switch_on_eof = 1;
2030 #ifdef YY_USE_PROTOS
2031 void yy_load_buffer_state( void )
2032 #else
2033 void yy_load_buffer_state()
2034 #endif
2036 yy_n_chars = yy_current_buffer->yy_n_chars;
2037 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2038 yyin = yy_current_buffer->yy_input_file;
2039 yy_hold_char = *yy_c_buf_p;
2043 #ifdef YY_USE_PROTOS
2044 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2045 #else
2046 YY_BUFFER_STATE yy_create_buffer( file, size )
2047 FILE *file;
2048 int size;
2049 #endif
2051 YY_BUFFER_STATE b;
2053 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2054 if ( ! b )
2055 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2057 b->yy_buf_size = size;
2059 /* yy_ch_buf has to be 2 characters longer than the size given because
2060 * we need to put in 2 end-of-buffer characters.
2062 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2063 if ( ! b->yy_ch_buf )
2064 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2066 b->yy_is_our_buffer = 1;
2068 yy_init_buffer( b, file );
2070 return b;
2074 #ifdef YY_USE_PROTOS
2075 void yy_delete_buffer( YY_BUFFER_STATE b )
2076 #else
2077 void yy_delete_buffer( b )
2078 YY_BUFFER_STATE b;
2079 #endif
2081 if ( ! b )
2082 return;
2084 if ( b == yy_current_buffer )
2085 yy_current_buffer = (YY_BUFFER_STATE) 0;
2087 if ( b->yy_is_our_buffer )
2088 yy_flex_free( (void *) b->yy_ch_buf );
2090 yy_flex_free( (void *) b );
2094 #ifndef YY_ALWAYS_INTERACTIVE
2095 #ifndef YY_NEVER_INTERACTIVE
2096 extern int isatty YY_PROTO(( int ));
2097 #endif
2098 #endif
2100 #ifdef YY_USE_PROTOS
2101 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2102 #else
2103 void yy_init_buffer( b, file )
2104 YY_BUFFER_STATE b;
2105 FILE *file;
2106 #endif
2110 yy_flush_buffer( b );
2112 b->yy_input_file = file;
2113 b->yy_fill_buffer = 1;
2115 #if YY_ALWAYS_INTERACTIVE
2116 b->yy_is_interactive = 1;
2117 #else
2118 #if YY_NEVER_INTERACTIVE
2119 b->yy_is_interactive = 0;
2120 #else
2121 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2122 #endif
2123 #endif
2127 #ifdef YY_USE_PROTOS
2128 void yy_flush_buffer( YY_BUFFER_STATE b )
2129 #else
2130 void yy_flush_buffer( b )
2131 YY_BUFFER_STATE b;
2132 #endif
2135 if ( ! b )
2136 return;
2138 b->yy_n_chars = 0;
2140 /* We always need two end-of-buffer characters. The first causes
2141 * a transition to the end-of-buffer state. The second causes
2142 * a jam in that state.
2144 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2145 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2147 b->yy_buf_pos = &b->yy_ch_buf[0];
2149 b->yy_at_bol = 1;
2150 b->yy_buffer_status = YY_BUFFER_NEW;
2152 if ( b == yy_current_buffer )
2153 yy_load_buffer_state();
2157 #ifndef YY_NO_SCAN_BUFFER
2158 #ifdef YY_USE_PROTOS
2159 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2160 #else
2161 YY_BUFFER_STATE yy_scan_buffer( base, size )
2162 char *base;
2163 yy_size_t size;
2164 #endif
2166 YY_BUFFER_STATE b;
2168 if ( size < 2 ||
2169 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2170 base[size-1] != YY_END_OF_BUFFER_CHAR )
2171 /* They forgot to leave room for the EOB's. */
2172 return 0;
2174 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2175 if ( ! b )
2176 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2178 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2179 b->yy_buf_pos = b->yy_ch_buf = base;
2180 b->yy_is_our_buffer = 0;
2181 b->yy_input_file = 0;
2182 b->yy_n_chars = b->yy_buf_size;
2183 b->yy_is_interactive = 0;
2184 b->yy_at_bol = 1;
2185 b->yy_fill_buffer = 0;
2186 b->yy_buffer_status = YY_BUFFER_NEW;
2188 yy_switch_to_buffer( b );
2190 return b;
2192 #endif
2195 #ifndef YY_NO_SCAN_STRING
2196 #ifdef YY_USE_PROTOS
2197 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2198 #else
2199 YY_BUFFER_STATE yy_scan_string( yy_str )
2200 yyconst char *yy_str;
2201 #endif
2203 int len;
2204 for ( len = 0; yy_str[len]; ++len )
2207 return yy_scan_bytes( yy_str, len );
2209 #endif
2212 #ifndef YY_NO_SCAN_BYTES
2213 #ifdef YY_USE_PROTOS
2214 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2215 #else
2216 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2217 yyconst char *bytes;
2218 int len;
2219 #endif
2221 YY_BUFFER_STATE b;
2222 char *buf;
2223 yy_size_t n;
2224 int i;
2226 /* Get memory for full buffer, including space for trailing EOB's. */
2227 n = len + 2;
2228 buf = (char *) yy_flex_alloc( n );
2229 if ( ! buf )
2230 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2232 for ( i = 0; i < len; ++i )
2233 buf[i] = bytes[i];
2235 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2237 b = yy_scan_buffer( buf, n );
2238 if ( ! b )
2239 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2241 /* It's okay to grow etc. this buffer, and we should throw it
2242 * away when we're done.
2244 b->yy_is_our_buffer = 1;
2246 return b;
2248 #endif
2251 #ifndef YY_NO_PUSH_STATE
2252 #ifdef YY_USE_PROTOS
2253 static void yy_push_state( int new_state )
2254 #else
2255 static void yy_push_state( new_state )
2256 int new_state;
2257 #endif
2259 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2261 yy_size_t new_size;
2263 yy_start_stack_depth += YY_START_STACK_INCR;
2264 new_size = yy_start_stack_depth * sizeof( int );
2266 if ( ! yy_start_stack )
2267 yy_start_stack = (int *) yy_flex_alloc( new_size );
2269 else
2270 yy_start_stack = (int *) yy_flex_realloc(
2271 (void *) yy_start_stack, new_size );
2273 if ( ! yy_start_stack )
2274 YY_FATAL_ERROR(
2275 "out of memory expanding start-condition stack" );
2278 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2280 BEGIN(new_state);
2282 #endif
2285 #ifndef YY_NO_POP_STATE
2286 static void yy_pop_state()
2288 if ( --yy_start_stack_ptr < 0 )
2289 YY_FATAL_ERROR( "start-condition stack underflow" );
2291 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2293 #endif
2296 #ifndef YY_NO_TOP_STATE
2297 static int yy_top_state()
2299 return yy_start_stack[yy_start_stack_ptr - 1];
2301 #endif
2303 #ifndef YY_EXIT_FAILURE
2304 #define YY_EXIT_FAILURE 2
2305 #endif
2307 #ifdef YY_USE_PROTOS
2308 static void yy_fatal_error( yyconst char msg[] )
2309 #else
2310 static void yy_fatal_error( msg )
2311 char msg[];
2312 #endif
2314 (void) fprintf( stderr, "%s\n", msg );
2315 exit( YY_EXIT_FAILURE );
2320 /* Redefine yyless() so it works in section 3 code. */
2322 #undef yyless
2323 #define yyless(n) \
2324 do \
2326 /* Undo effects of setting up yytext. */ \
2327 yytext[yyleng] = yy_hold_char; \
2328 yy_c_buf_p = yytext + n; \
2329 yy_hold_char = *yy_c_buf_p; \
2330 *yy_c_buf_p = '\0'; \
2331 yyleng = n; \
2333 while ( 0 )
2336 /* Internal utility routines. */
2338 #ifndef yytext_ptr
2339 #ifdef YY_USE_PROTOS
2340 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2341 #else
2342 static void yy_flex_strncpy( s1, s2, n )
2343 char *s1;
2344 yyconst char *s2;
2345 int n;
2346 #endif
2348 register int i;
2349 for ( i = 0; i < n; ++i )
2350 s1[i] = s2[i];
2352 #endif
2354 #ifdef YY_NEED_STRLEN
2355 #ifdef YY_USE_PROTOS
2356 static int yy_flex_strlen( yyconst char *s )
2357 #else
2358 static int yy_flex_strlen( s )
2359 yyconst char *s;
2360 #endif
2362 register int n;
2363 for ( n = 0; s[n]; ++n )
2366 return n;
2368 #endif
2371 #ifdef YY_USE_PROTOS
2372 static void *yy_flex_alloc( yy_size_t size )
2373 #else
2374 static void *yy_flex_alloc( size )
2375 yy_size_t size;
2376 #endif
2378 return (void *) malloc( size );
2381 #ifdef YY_USE_PROTOS
2382 static void *yy_flex_realloc( void *ptr, yy_size_t size )
2383 #else
2384 static void *yy_flex_realloc( ptr, size )
2385 void *ptr;
2386 yy_size_t size;
2387 #endif
2389 /* The cast to (char *) in the following accommodates both
2390 * implementations that use char* generic pointers, and those
2391 * that use void* generic pointers. It works with the latter
2392 * because both ANSI C and C++ allow castless assignment from
2393 * any pointer type to void*, and deal with argument conversions
2394 * as though doing an assignment.
2396 return (void *) realloc( (char *) ptr, size );
2399 #ifdef YY_USE_PROTOS
2400 static void yy_flex_free( void *ptr )
2401 #else
2402 static void yy_flex_free( ptr )
2403 void *ptr;
2404 #endif
2406 free( ptr );
2409 #if YY_MAIN
2410 int main()
2412 yylex();
2413 return 0;
2415 #endif
2416 #line 416 "sketch.l"
2419 void set_lexer_file(char *file_name, FILE *f)
2421 line.file_name = safe_strdup(file_name);
2422 line.include_p = 0;
2423 line.number = 1;
2424 yyin = f;