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