]> matita.cs.unibo.it Git - helm.git/blob - helm/metadata/create_V7_mowgli/METADATA/lex.yy.c
Bug fixed: refSort were exported (as refObj) also when occurring InHypothesis
[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                        (first_child == HERE))
877                      {
878                        tmp=(char *)malloc((sizeof('a')*200)); 
879                        strcpy(tmp,yytext);
880                        strsep(&tmp,&sep); 
881                        if (position == INTYPE) /* SORT on the spine */
882                          { 
883                            position = INCONCL;
884                            search(tmp,first_child,position,spine_depth);
885                          }
886                        else search(tmp,first_child,position,depth);
887                        first_child = AFTER;
888                      }
889                    }
890         YY_BREAK
891 case 14:
892 YY_RULE_SETUP
893 #line 178 "meta_lex.l"
894 {
895                      skip = 1;
896                      first_child = AFTER;
897                    }
898         YY_BREAK
899 case 15:
900 YY_RULE_SETUP
901 #line 183 "meta_lex.l"
902
903                      if (position == INTYPE) /* CONST on the spine */
904                         position = INCONCL;
905                      where = CONST;
906                    }
907         YY_BREAK
908 case 16:
909 YY_RULE_SETUP
910 #line 189 "meta_lex.l"
911
912                      if (position == INTYPE) /* MUTIND on the spine */
913                         position = INCONCL;
914                      where = MUTIND;
915                    }
916         YY_BREAK
917 case 17:
918 YY_RULE_SETUP
919 #line 195 "meta_lex.l"
920
921                      if (position == INTYPE) /* MUTCONSTRUCT on the spine */
922                         position = INCONCL;
923                      where = MUTCONSTRUCT;
924                    }
925         YY_BREAK
926 case 18:
927 YY_RULE_SETUP
928 #line 201 "meta_lex.l"
929 {     
930                          if (!skip) {
931                             uri=(char *)malloc((sizeof('a')*200)); 
932                             strcpy(uri,yytext);
933                             strsep(&uri,&sep);
934                             if (where == CONST)
935                               {
936                                 if (position == INCONCL)
937                                   search(uri,first_child,position,spine_depth);
938                                 else search(uri,first_child,position,depth);
939                                 where = NOWHERE;
940                                 first_child = AFTER;
941                                 free(uri); 
942                               };
943                          } else skip = 0;
944                    } 
945         YY_BREAK
946 case 19:
947 YY_RULE_SETUP
948 #line 218 "meta_lex.l"
949 {
950                          if ((where == MUTIND) || (where == MUTCONSTRUCT))
951                           { strsep(&yytext,&sep);
952                             tmp=(char *)malloc((sizeof(sep)*(strlen(yytext)+1)));
953                             strcpy(tmp,yytext);
954                             tmp_n = atoi(tmp)+1;
955                             sprintf(tmp,"%d",tmp_n);
956                             strcat(uri,"#xpointer(1/"); 
957                             strcat(uri,tmp); 
958                           };
959                          if (where == MUTIND) 
960                              { 
961                                strcat(uri,")");
962                                if (position == INCONCL)
963                                   search(uri,first_child,position,spine_depth);
964                                else search(uri,first_child,position,depth);
965                                free(uri);
966                                free(tmp);
967                                where = NOWHERE; 
968                                first_child = AFTER;};
969                    } 
970         YY_BREAK
971 case 20:
972 YY_RULE_SETUP
973 #line 240 "meta_lex.l"
974 {
975                          if (where == MUTCONSTRUCT)
976                           { strsep(&yytext,&sep);
977                             tmp=(char *)malloc((sizeof(sep)*(strlen(yytext)+1)));
978                             strcpy(tmp,yytext);
979                             strcat(uri,"/");
980                             strcat(uri,tmp);
981                             strcat(uri,")");
982                             if (position == INCONCL)
983                               search(uri,first_child,position,spine_depth);
984                             else search(uri,first_child,position,depth);
985                             free(uri);
986                             free(tmp);
987                             where = NOWHERE; 
988                             first_child = AFTER;};
989                    } 
990         YY_BREAK
991 case 21:
992 YY_RULE_SETUP
993 #line 259 "meta_lex.l"
994 ECHO;
995         YY_BREAK
996 #line 997 "lex.yy.c"
997 case YY_STATE_EOF(INITIAL):
998         yyterminate();
999
1000         case YY_END_OF_BUFFER:
1001                 {
1002                 /* Amount of text matched not including the EOB char. */
1003                 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1004
1005                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1006                 *yy_cp = yy_hold_char;
1007                 YY_RESTORE_YY_MORE_OFFSET
1008
1009                 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1010                         {
1011                         /* We're scanning a new file or input source.  It's
1012                          * possible that this happened because the user
1013                          * just pointed yyin at a new source and called
1014                          * yylex().  If so, then we have to assure
1015                          * consistency between yy_current_buffer and our
1016                          * globals.  Here is the right place to do so, because
1017                          * this is the first action (other than possibly a
1018                          * back-up) that will match for the new input source.
1019                          */
1020                         yy_n_chars = yy_current_buffer->yy_n_chars;
1021                         yy_current_buffer->yy_input_file = yyin;
1022                         yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1023                         }
1024
1025                 /* Note that here we test for yy_c_buf_p "<=" to the position
1026                  * of the first EOB in the buffer, since yy_c_buf_p will
1027                  * already have been incremented past the NUL character
1028                  * (since all states make transitions on EOB to the
1029                  * end-of-buffer state).  Contrast this with the test
1030                  * in input().
1031                  */
1032                 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1033                         { /* This was really a NUL. */
1034                         yy_state_type yy_next_state;
1035
1036                         yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1037
1038                         yy_current_state = yy_get_previous_state();
1039
1040                         /* Okay, we're now positioned to make the NUL
1041                          * transition.  We couldn't have
1042                          * yy_get_previous_state() go ahead and do it
1043                          * for us because it doesn't know how to deal
1044                          * with the possibility of jamming (and we don't
1045                          * want to build jamming into it because then it
1046                          * will run more slowly).
1047                          */
1048
1049                         yy_next_state = yy_try_NUL_trans( yy_current_state );
1050
1051                         yy_bp = yytext_ptr + YY_MORE_ADJ;
1052
1053                         if ( yy_next_state )
1054                                 {
1055                                 /* Consume the NUL. */
1056                                 yy_cp = ++yy_c_buf_p;
1057                                 yy_current_state = yy_next_state;
1058                                 goto yy_match;
1059                                 }
1060
1061                         else
1062                                 {
1063                                 yy_cp = yy_c_buf_p;
1064                                 goto yy_find_action;
1065                                 }
1066                         }
1067
1068                 else switch ( yy_get_next_buffer() )
1069                         {
1070                         case EOB_ACT_END_OF_FILE:
1071                                 {
1072                                 yy_did_buffer_switch_on_eof = 0;
1073
1074                                 if ( yywrap() )
1075                                         {
1076                                         /* Note: because we've taken care in
1077                                          * yy_get_next_buffer() to have set up
1078                                          * yytext, we can now set up
1079                                          * yy_c_buf_p so that if some total
1080                                          * hoser (like flex itself) wants to
1081                                          * call the scanner after we return the
1082                                          * YY_NULL, it'll still work - another
1083                                          * YY_NULL will get returned.
1084                                          */
1085                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1086
1087                                         yy_act = YY_STATE_EOF(YY_START);
1088                                         goto do_action;
1089                                         }
1090
1091                                 else
1092                                         {
1093                                         if ( ! yy_did_buffer_switch_on_eof )
1094                                                 YY_NEW_FILE;
1095                                         }
1096                                 break;
1097                                 }
1098
1099                         case EOB_ACT_CONTINUE_SCAN:
1100                                 yy_c_buf_p =
1101                                         yytext_ptr + yy_amount_of_matched_text;
1102
1103                                 yy_current_state = yy_get_previous_state();
1104
1105                                 yy_cp = yy_c_buf_p;
1106                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1107                                 goto yy_match;
1108
1109                         case EOB_ACT_LAST_MATCH:
1110                                 yy_c_buf_p =
1111                                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1112
1113                                 yy_current_state = yy_get_previous_state();
1114
1115                                 yy_cp = yy_c_buf_p;
1116                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1117                                 goto yy_find_action;
1118                         }
1119                 break;
1120                 }
1121
1122         default:
1123                 YY_FATAL_ERROR(
1124                         "fatal flex scanner internal error--no action found" );
1125         } /* end of action switch */
1126                 } /* end of scanning one token */
1127         } /* end of yylex */
1128
1129
1130 /* yy_get_next_buffer - try to read in a new buffer
1131  *
1132  * Returns a code representing an action:
1133  *      EOB_ACT_LAST_MATCH -
1134  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1135  *      EOB_ACT_END_OF_FILE - end of file
1136  */
1137
1138 static int yy_get_next_buffer()
1139         {
1140         register char *dest = yy_current_buffer->yy_ch_buf;
1141         register char *source = yytext_ptr;
1142         register int number_to_move, i;
1143         int ret_val;
1144
1145         if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1146                 YY_FATAL_ERROR(
1147                 "fatal flex scanner internal error--end of buffer missed" );
1148
1149         if ( yy_current_buffer->yy_fill_buffer == 0 )
1150                 { /* Don't try to fill the buffer, so this is an EOF. */
1151                 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1152                         {
1153                         /* We matched a single character, the EOB, so
1154                          * treat this as a final EOF.
1155                          */
1156                         return EOB_ACT_END_OF_FILE;
1157                         }
1158
1159                 else
1160                         {
1161                         /* We matched some text prior to the EOB, first
1162                          * process it.
1163                          */
1164                         return EOB_ACT_LAST_MATCH;
1165                         }
1166                 }
1167
1168         /* Try to read more data. */
1169
1170         /* First move last chars to start of buffer. */
1171         number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1172
1173         for ( i = 0; i < number_to_move; ++i )
1174                 *(dest++) = *(source++);
1175
1176         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1177                 /* don't do the read, it's not guaranteed to return an EOF,
1178                  * just force an EOF
1179                  */
1180                 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1181
1182         else
1183                 {
1184                 int num_to_read =
1185                         yy_current_buffer->yy_buf_size - number_to_move - 1;
1186
1187                 while ( num_to_read <= 0 )
1188                         { /* Not enough room in the buffer - grow it. */
1189 #ifdef YY_USES_REJECT
1190                         YY_FATAL_ERROR(
1191 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1192 #else
1193
1194                         /* just a shorter name for the current buffer */
1195                         YY_BUFFER_STATE b = yy_current_buffer;
1196
1197                         int yy_c_buf_p_offset =
1198                                 (int) (yy_c_buf_p - b->yy_ch_buf);
1199
1200                         if ( b->yy_is_our_buffer )
1201                                 {
1202                                 int new_size = b->yy_buf_size * 2;
1203
1204                                 if ( new_size <= 0 )
1205                                         b->yy_buf_size += b->yy_buf_size / 8;
1206                                 else
1207                                         b->yy_buf_size *= 2;
1208
1209                                 b->yy_ch_buf = (char *)
1210                                         /* Include room in for 2 EOB chars. */
1211                                         yy_flex_realloc( (void *) b->yy_ch_buf,
1212                                                          b->yy_buf_size + 2 );
1213                                 }
1214                         else
1215                                 /* Can't grow it, we don't own it. */
1216                                 b->yy_ch_buf = 0;
1217
1218                         if ( ! b->yy_ch_buf )
1219                                 YY_FATAL_ERROR(
1220                                 "fatal error - scanner input buffer overflow" );
1221
1222                         yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1223
1224                         num_to_read = yy_current_buffer->yy_buf_size -
1225                                                 number_to_move - 1;
1226 #endif
1227                         }
1228
1229                 if ( num_to_read > YY_READ_BUF_SIZE )
1230                         num_to_read = YY_READ_BUF_SIZE;
1231
1232                 /* Read in more data. */
1233                 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1234                         yy_n_chars, num_to_read );
1235
1236                 yy_current_buffer->yy_n_chars = yy_n_chars;
1237                 }
1238
1239         if ( yy_n_chars == 0 )
1240                 {
1241                 if ( number_to_move == YY_MORE_ADJ )
1242                         {
1243                         ret_val = EOB_ACT_END_OF_FILE;
1244                         yyrestart( yyin );
1245                         }
1246
1247                 else
1248                         {
1249                         ret_val = EOB_ACT_LAST_MATCH;
1250                         yy_current_buffer->yy_buffer_status =
1251                                 YY_BUFFER_EOF_PENDING;
1252                         }
1253                 }
1254
1255         else
1256                 ret_val = EOB_ACT_CONTINUE_SCAN;
1257
1258         yy_n_chars += number_to_move;
1259         yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1260         yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1261
1262         yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1263
1264         return ret_val;
1265         }
1266
1267
1268 /* yy_get_previous_state - get the state just before the EOB char was reached */
1269
1270 static yy_state_type yy_get_previous_state()
1271         {
1272         register yy_state_type yy_current_state;
1273         register char *yy_cp;
1274
1275         yy_current_state = yy_start;
1276
1277         for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1278                 {
1279                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1280                 if ( yy_accept[yy_current_state] )
1281                         {
1282                         yy_last_accepting_state = yy_current_state;
1283                         yy_last_accepting_cpos = yy_cp;
1284                         }
1285                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1286                         {
1287                         yy_current_state = (int) yy_def[yy_current_state];
1288                         if ( yy_current_state >= 123 )
1289                                 yy_c = yy_meta[(unsigned int) yy_c];
1290                         }
1291                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1292                 }
1293
1294         return yy_current_state;
1295         }
1296
1297
1298 /* yy_try_NUL_trans - try to make a transition on the NUL character
1299  *
1300  * synopsis
1301  *      next_state = yy_try_NUL_trans( current_state );
1302  */
1303
1304 #ifdef YY_USE_PROTOS
1305 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1306 #else
1307 static yy_state_type yy_try_NUL_trans( yy_current_state )
1308 yy_state_type yy_current_state;
1309 #endif
1310         {
1311         register int yy_is_jam;
1312         register char *yy_cp = yy_c_buf_p;
1313
1314         register YY_CHAR yy_c = 1;
1315         if ( yy_accept[yy_current_state] )
1316                 {
1317                 yy_last_accepting_state = yy_current_state;
1318                 yy_last_accepting_cpos = yy_cp;
1319                 }
1320         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1321                 {
1322                 yy_current_state = (int) yy_def[yy_current_state];
1323                 if ( yy_current_state >= 123 )
1324                         yy_c = yy_meta[(unsigned int) yy_c];
1325                 }
1326         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1327         yy_is_jam = (yy_current_state == 122);
1328
1329         return yy_is_jam ? 0 : yy_current_state;
1330         }
1331
1332
1333 #ifndef YY_NO_UNPUT
1334 #ifdef YY_USE_PROTOS
1335 static void yyunput( int c, register char *yy_bp )
1336 #else
1337 static void yyunput( c, yy_bp )
1338 int c;
1339 register char *yy_bp;
1340 #endif
1341         {
1342         register char *yy_cp = yy_c_buf_p;
1343
1344         /* undo effects of setting up yytext */
1345         *yy_cp = yy_hold_char;
1346
1347         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1348                 { /* need to shift things up to make room */
1349                 /* +2 for EOB chars. */
1350                 register int number_to_move = yy_n_chars + 2;
1351                 register char *dest = &yy_current_buffer->yy_ch_buf[
1352                                         yy_current_buffer->yy_buf_size + 2];
1353                 register char *source =
1354                                 &yy_current_buffer->yy_ch_buf[number_to_move];
1355
1356                 while ( source > yy_current_buffer->yy_ch_buf )
1357                         *--dest = *--source;
1358
1359                 yy_cp += (int) (dest - source);
1360                 yy_bp += (int) (dest - source);
1361                 yy_current_buffer->yy_n_chars =
1362                         yy_n_chars = yy_current_buffer->yy_buf_size;
1363
1364                 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1365                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1366                 }
1367
1368         *--yy_cp = (char) c;
1369
1370
1371         yytext_ptr = yy_bp;
1372         yy_hold_char = *yy_cp;
1373         yy_c_buf_p = yy_cp;
1374         }
1375 #endif  /* ifndef YY_NO_UNPUT */
1376
1377
1378 #ifdef __cplusplus
1379 static int yyinput()
1380 #else
1381 static int input()
1382 #endif
1383         {
1384         int c;
1385
1386         *yy_c_buf_p = yy_hold_char;
1387
1388         if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1389                 {
1390                 /* yy_c_buf_p now points to the character we want to return.
1391                  * If this occurs *before* the EOB characters, then it's a
1392                  * valid NUL; if not, then we've hit the end of the buffer.
1393                  */
1394                 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1395                         /* This was really a NUL. */
1396                         *yy_c_buf_p = '\0';
1397
1398                 else
1399                         { /* need more input */
1400                         int offset = yy_c_buf_p - yytext_ptr;
1401                         ++yy_c_buf_p;
1402
1403                         switch ( yy_get_next_buffer() )
1404                                 {
1405                                 case EOB_ACT_LAST_MATCH:
1406                                         /* This happens because yy_g_n_b()
1407                                          * sees that we've accumulated a
1408                                          * token and flags that we need to
1409                                          * try matching the token before
1410                                          * proceeding.  But for input(),
1411                                          * there's no matching to consider.
1412                                          * So convert the EOB_ACT_LAST_MATCH
1413                                          * to EOB_ACT_END_OF_FILE.
1414                                          */
1415
1416                                         /* Reset buffer status. */
1417                                         yyrestart( yyin );
1418
1419                                         /* fall through */
1420
1421                                 case EOB_ACT_END_OF_FILE:
1422                                         {
1423                                         if ( yywrap() )
1424                                                 return EOF;
1425
1426                                         if ( ! yy_did_buffer_switch_on_eof )
1427                                                 YY_NEW_FILE;
1428 #ifdef __cplusplus
1429                                         return yyinput();
1430 #else
1431                                         return input();
1432 #endif
1433                                         }
1434
1435                                 case EOB_ACT_CONTINUE_SCAN:
1436                                         yy_c_buf_p = yytext_ptr + offset;
1437                                         break;
1438                                 }
1439                         }
1440                 }
1441
1442         c = *(unsigned char *) yy_c_buf_p;      /* cast for 8-bit char's */
1443         *yy_c_buf_p = '\0';     /* preserve yytext */
1444         yy_hold_char = *++yy_c_buf_p;
1445
1446
1447         return c;
1448         }
1449
1450
1451 #ifdef YY_USE_PROTOS
1452 void yyrestart( FILE *input_file )
1453 #else
1454 void yyrestart( input_file )
1455 FILE *input_file;
1456 #endif
1457         {
1458         if ( ! yy_current_buffer )
1459                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1460
1461         yy_init_buffer( yy_current_buffer, input_file );
1462         yy_load_buffer_state();
1463         }
1464
1465
1466 #ifdef YY_USE_PROTOS
1467 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1468 #else
1469 void yy_switch_to_buffer( new_buffer )
1470 YY_BUFFER_STATE new_buffer;
1471 #endif
1472         {
1473         if ( yy_current_buffer == new_buffer )
1474                 return;
1475
1476         if ( yy_current_buffer )
1477                 {
1478                 /* Flush out information for old buffer. */
1479                 *yy_c_buf_p = yy_hold_char;
1480                 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1481                 yy_current_buffer->yy_n_chars = yy_n_chars;
1482                 }
1483
1484         yy_current_buffer = new_buffer;
1485         yy_load_buffer_state();
1486
1487         /* We don't actually know whether we did this switch during
1488          * EOF (yywrap()) processing, but the only time this flag
1489          * is looked at is after yywrap() is called, so it's safe
1490          * to go ahead and always set it.
1491          */
1492         yy_did_buffer_switch_on_eof = 1;
1493         }
1494
1495
1496 #ifdef YY_USE_PROTOS
1497 void yy_load_buffer_state( void )
1498 #else
1499 void yy_load_buffer_state()
1500 #endif
1501         {
1502         yy_n_chars = yy_current_buffer->yy_n_chars;
1503         yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1504         yyin = yy_current_buffer->yy_input_file;
1505         yy_hold_char = *yy_c_buf_p;
1506         }
1507
1508
1509 #ifdef YY_USE_PROTOS
1510 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1511 #else
1512 YY_BUFFER_STATE yy_create_buffer( file, size )
1513 FILE *file;
1514 int size;
1515 #endif
1516         {
1517         YY_BUFFER_STATE b;
1518
1519         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1520         if ( ! b )
1521                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1522
1523         b->yy_buf_size = size;
1524
1525         /* yy_ch_buf has to be 2 characters longer than the size given because
1526          * we need to put in 2 end-of-buffer characters.
1527          */
1528         b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1529         if ( ! b->yy_ch_buf )
1530                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1531
1532         b->yy_is_our_buffer = 1;
1533
1534         yy_init_buffer( b, file );
1535
1536         return b;
1537         }
1538
1539
1540 #ifdef YY_USE_PROTOS
1541 void yy_delete_buffer( YY_BUFFER_STATE b )
1542 #else
1543 void yy_delete_buffer( b )
1544 YY_BUFFER_STATE b;
1545 #endif
1546         {
1547         if ( ! b )
1548                 return;
1549
1550         if ( b == yy_current_buffer )
1551                 yy_current_buffer = (YY_BUFFER_STATE) 0;
1552
1553         if ( b->yy_is_our_buffer )
1554                 yy_flex_free( (void *) b->yy_ch_buf );
1555
1556         yy_flex_free( (void *) b );
1557         }
1558
1559
1560 #ifndef _WIN32
1561 #include <unistd.h>
1562 #else
1563 #ifndef YY_ALWAYS_INTERACTIVE
1564 #ifndef YY_NEVER_INTERACTIVE
1565 extern int isatty YY_PROTO(( int ));
1566 #endif
1567 #endif
1568 #endif
1569
1570 #ifdef YY_USE_PROTOS
1571 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1572 #else
1573 void yy_init_buffer( b, file )
1574 YY_BUFFER_STATE b;
1575 FILE *file;
1576 #endif
1577
1578
1579         {
1580         yy_flush_buffer( b );
1581
1582         b->yy_input_file = file;
1583         b->yy_fill_buffer = 1;
1584
1585 #if YY_ALWAYS_INTERACTIVE
1586         b->yy_is_interactive = 1;
1587 #else
1588 #if YY_NEVER_INTERACTIVE
1589         b->yy_is_interactive = 0;
1590 #else
1591         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1592 #endif
1593 #endif
1594         }
1595
1596
1597 #ifdef YY_USE_PROTOS
1598 void yy_flush_buffer( YY_BUFFER_STATE b )
1599 #else
1600 void yy_flush_buffer( b )
1601 YY_BUFFER_STATE b;
1602 #endif
1603
1604         {
1605         if ( ! b )
1606                 return;
1607
1608         b->yy_n_chars = 0;
1609
1610         /* We always need two end-of-buffer characters.  The first causes
1611          * a transition to the end-of-buffer state.  The second causes
1612          * a jam in that state.
1613          */
1614         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1615         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1616
1617         b->yy_buf_pos = &b->yy_ch_buf[0];
1618
1619         b->yy_at_bol = 1;
1620         b->yy_buffer_status = YY_BUFFER_NEW;
1621
1622         if ( b == yy_current_buffer )
1623                 yy_load_buffer_state();
1624         }
1625
1626
1627 #ifndef YY_NO_SCAN_BUFFER
1628 #ifdef YY_USE_PROTOS
1629 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1630 #else
1631 YY_BUFFER_STATE yy_scan_buffer( base, size )
1632 char *base;
1633 yy_size_t size;
1634 #endif
1635         {
1636         YY_BUFFER_STATE b;
1637
1638         if ( size < 2 ||
1639              base[size-2] != YY_END_OF_BUFFER_CHAR ||
1640              base[size-1] != YY_END_OF_BUFFER_CHAR )
1641                 /* They forgot to leave room for the EOB's. */
1642                 return 0;
1643
1644         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1645         if ( ! b )
1646                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1647
1648         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1649         b->yy_buf_pos = b->yy_ch_buf = base;
1650         b->yy_is_our_buffer = 0;
1651         b->yy_input_file = 0;
1652         b->yy_n_chars = b->yy_buf_size;
1653         b->yy_is_interactive = 0;
1654         b->yy_at_bol = 1;
1655         b->yy_fill_buffer = 0;
1656         b->yy_buffer_status = YY_BUFFER_NEW;
1657
1658         yy_switch_to_buffer( b );
1659
1660         return b;
1661         }
1662 #endif
1663
1664
1665 #ifndef YY_NO_SCAN_STRING
1666 #ifdef YY_USE_PROTOS
1667 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1668 #else
1669 YY_BUFFER_STATE yy_scan_string( yy_str )
1670 yyconst char *yy_str;
1671 #endif
1672         {
1673         int len;
1674         for ( len = 0; yy_str[len]; ++len )
1675                 ;
1676
1677         return yy_scan_bytes( yy_str, len );
1678         }
1679 #endif
1680
1681
1682 #ifndef YY_NO_SCAN_BYTES
1683 #ifdef YY_USE_PROTOS
1684 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1685 #else
1686 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1687 yyconst char *bytes;
1688 int len;
1689 #endif
1690         {
1691         YY_BUFFER_STATE b;
1692         char *buf;
1693         yy_size_t n;
1694         int i;
1695
1696         /* Get memory for full buffer, including space for trailing EOB's. */
1697         n = len + 2;
1698         buf = (char *) yy_flex_alloc( n );
1699         if ( ! buf )
1700                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1701
1702         for ( i = 0; i < len; ++i )
1703                 buf[i] = bytes[i];
1704
1705         buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1706
1707         b = yy_scan_buffer( buf, n );
1708         if ( ! b )
1709                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1710
1711         /* It's okay to grow etc. this buffer, and we should throw it
1712          * away when we're done.
1713          */
1714         b->yy_is_our_buffer = 1;
1715
1716         return b;
1717         }
1718 #endif
1719
1720
1721 #ifndef YY_NO_PUSH_STATE
1722 #ifdef YY_USE_PROTOS
1723 static void yy_push_state( int new_state )
1724 #else
1725 static void yy_push_state( new_state )
1726 int new_state;
1727 #endif
1728         {
1729         if ( yy_start_stack_ptr >= yy_start_stack_depth )
1730                 {
1731                 yy_size_t new_size;
1732
1733                 yy_start_stack_depth += YY_START_STACK_INCR;
1734                 new_size = yy_start_stack_depth * sizeof( int );
1735
1736                 if ( ! yy_start_stack )
1737                         yy_start_stack = (int *) yy_flex_alloc( new_size );
1738
1739                 else
1740                         yy_start_stack = (int *) yy_flex_realloc(
1741                                         (void *) yy_start_stack, new_size );
1742
1743                 if ( ! yy_start_stack )
1744                         YY_FATAL_ERROR(
1745                         "out of memory expanding start-condition stack" );
1746                 }
1747
1748         yy_start_stack[yy_start_stack_ptr++] = YY_START;
1749
1750         BEGIN(new_state);
1751         }
1752 #endif
1753
1754
1755 #ifndef YY_NO_POP_STATE
1756 static void yy_pop_state()
1757         {
1758         if ( --yy_start_stack_ptr < 0 )
1759                 YY_FATAL_ERROR( "start-condition stack underflow" );
1760
1761         BEGIN(yy_start_stack[yy_start_stack_ptr]);
1762         }
1763 #endif
1764
1765
1766 #ifndef YY_NO_TOP_STATE
1767 static int yy_top_state()
1768         {
1769         return yy_start_stack[yy_start_stack_ptr - 1];
1770         }
1771 #endif
1772
1773 #ifndef YY_EXIT_FAILURE
1774 #define YY_EXIT_FAILURE 2
1775 #endif
1776
1777 #ifdef YY_USE_PROTOS
1778 static void yy_fatal_error( yyconst char msg[] )
1779 #else
1780 static void yy_fatal_error( msg )
1781 char msg[];
1782 #endif
1783         {
1784         (void) fprintf( stderr, "%s\n", msg );
1785         exit( YY_EXIT_FAILURE );
1786         }
1787
1788
1789
1790 /* Redefine yyless() so it works in section 3 code. */
1791
1792 #undef yyless
1793 #define yyless(n) \
1794         do \
1795                 { \
1796                 /* Undo effects of setting up yytext. */ \
1797                 yytext[yyleng] = yy_hold_char; \
1798                 yy_c_buf_p = yytext + n; \
1799                 yy_hold_char = *yy_c_buf_p; \
1800                 *yy_c_buf_p = '\0'; \
1801                 yyleng = n; \
1802                 } \
1803         while ( 0 )
1804
1805
1806 /* Internal utility routines. */
1807
1808 #ifndef yytext_ptr
1809 #ifdef YY_USE_PROTOS
1810 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1811 #else
1812 static void yy_flex_strncpy( s1, s2, n )
1813 char *s1;
1814 yyconst char *s2;
1815 int n;
1816 #endif
1817         {
1818         register int i;
1819         for ( i = 0; i < n; ++i )
1820                 s1[i] = s2[i];
1821         }
1822 #endif
1823
1824 #ifdef YY_NEED_STRLEN
1825 #ifdef YY_USE_PROTOS
1826 static int yy_flex_strlen( yyconst char *s )
1827 #else
1828 static int yy_flex_strlen( s )
1829 yyconst char *s;
1830 #endif
1831         {
1832         register int n;
1833         for ( n = 0; s[n]; ++n )
1834                 ;
1835
1836         return n;
1837         }
1838 #endif
1839
1840
1841 #ifdef YY_USE_PROTOS
1842 static void *yy_flex_alloc( yy_size_t size )
1843 #else
1844 static void *yy_flex_alloc( size )
1845 yy_size_t size;
1846 #endif
1847         {
1848         return (void *) malloc( size );
1849         }
1850
1851 #ifdef YY_USE_PROTOS
1852 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1853 #else
1854 static void *yy_flex_realloc( ptr, size )
1855 void *ptr;
1856 yy_size_t size;
1857 #endif
1858         {
1859         /* The cast to (char *) in the following accommodates both
1860          * implementations that use char* generic pointers, and those
1861          * that use void* generic pointers.  It works with the latter
1862          * because both ANSI C and C++ allow castless assignment from
1863          * any pointer type to void*, and deal with argument conversions
1864          * as though doing an assignment.
1865          */
1866         return (void *) realloc( (char *) ptr, size );
1867         }
1868
1869 #ifdef YY_USE_PROTOS
1870 static void yy_flex_free( void *ptr )
1871 #else
1872 static void yy_flex_free( ptr )
1873 void *ptr;
1874 #endif
1875         {
1876         free( ptr );
1877         }
1878
1879 #if YY_MAIN
1880 int main()
1881         {
1882         yylex();
1883         return 0;
1884         }
1885 #endif
1886 #line 259 "meta_lex.l"
1887
1888
1889  /***************************************************************/
1890  /* 6. Auxiliary functions.                                     */
1891  /***************************************************************/
1892
1893 main(int argc, char *argv[])
1894 {                  
1895                    struct stat buf;
1896                    FILE *outrel, *outsort;
1897
1898                    init_symbol_table();
1899                    if (!(outrel = fopen("forward_rel.rdf","a"))) 
1900                      {
1901                       fprintf(stderr, "error in openinf file forward_rel.rdf\n");
1902                       exit(-1);
1903                      }
1904                    if (!(outsort = fopen("forward_sort.rdf","a"))) 
1905                      {
1906                       fprintf(stderr, "error in openinf file forward_rel.rdf\n");
1907                       exit(-1);
1908                      }
1909                    // We process the body
1910                    if (!stat("tmp/body.xml",&buf)) {
1911                       yyin = fopen("tmp/body.xml", "r");
1912                       position = INBODY;
1913                       yylex();
1914                       fclose(yyin);
1915                    }
1916
1917                    // We process the type
1918                    yyin = fopen("tmp/type.xml", "r");
1919                    position = INTYPE;
1920                    first_child = HERE;
1921                    no_open_source = 0;
1922                    spine_depth = 0;
1923                    depth = 0;
1924                    yylex(); 
1925
1926                    printf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n");
1927 printf("<!DOCTYPE rdf:RDF [
1928         <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
1929         <!ENTITY hthns 'http://www.cs.unibo.it/helm/schemas/schema-helmth#'>
1930         <!ENTITY hns 'http://www.cs.unibo.it/helm/schemas/schema-helm#'>
1931
1932    ]>\n");
1933
1934                    printf("<rdf:RDF xml:lang=\"en\" xmlns:rdf=\"&rdfns;\" xmlns:h=\"&hns;\" xmlns:hth=\"&hthns;\">\n");
1935                    printf("\t<h:Object rdf:about=\"");
1936                    printf("%s",argv[1]);
1937                    printf("\">\n");
1938                    print_all(argv[1],outrel,outsort);
1939                    printf("\t</h:Object>\n");
1940                    printf("</rdf:RDF>\n");
1941                    fclose(yyin);
1942                    } 
1943
1944 search(uri,first_child,position,depth)
1945 char               *uri;
1946 int                first_child;
1947 int                position; 
1948 {                  
1949                    if (position == MAINHYP)
1950                       { 
1951                        if (first_child == HERE) 
1952                            found = search_bucket(uri,MAINHYP,depth);
1953                        else 
1954                            found = search_bucket(uri,INHYP,0);
1955                       }
1956                    else if (position == INCONCL)
1957                       { 
1958                        if (first_child == HERE) 
1959                            found = search_bucket(uri,MAINCONCL,depth);
1960                        else
1961                            found = search_bucket(uri,INCONCL,0);
1962                       }
1963                         
1964                    else 
1965                       found = search_bucket(uri,position,depth);
1966                    /* if (found == NOTFOUND)
1967                          fprintf(stderr,"pos = %d, uri = %s\n", position, uri); */
1968
1969 /*                  
1970                       (first_child == HERE) 
1971                       {
1972                        if (position == MAINHYP)
1973                           found = search_bucket(uri,MAINHYP,depth);
1974                        else if (position == INCONCL)
1975                           found = search_bucket(uri,MAINCONCL,0);
1976                        else if (position == INHYP)
1977                           found = search_bucket(uri,INHYP,0);
1978                           if (found == NOTFOUND)
1979                           printf( "pos = %d, uri = %s\n", MAINCONCL, uri); 
1980                        }
1981                    else if ((position == MAINHYP) && (first_child == AFTER))
1982                         found = search_bucket(uri,INHYP,0);
1983                    else found = search_bucket(uri,position,0);
1984                    if (found == NOTFOUND)
1985                          printf( "pos = %d, uri = %s\n", position, uri); 
1986                    } */
1987
1988 int yywrap() {
1989                return 1;
1990              }
1991