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