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