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