Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Search for the pcre licence.
[simgrid.git] / src / simdag / dax_dtd.l
1 /* Validating XML processor for src/simdag/dax.dtd.
2  *
3  * This program was generated with the FleXML XML processor generator.
4  * FleXML is Copyright (C) 1999-2005 Kristoffer Rose.  All rights reserved.
5  * FleXML is Copyright (C) 2003-2006 Martin Quinson.  All rights reserved.
6  * (Id: flexml.pl,v 1.62 2007/10/11 10:00:14 mquinson Exp).
7  * 
8  * There are two, intertwined parts to this program, part A and part B.
9  *
10  * Part A
11  * ------
12  * 
13  * Some parts, here collectively called "Part A", are found in the 
14  * FleXML package.  They are Copyright (C) 1999-2005 Kristoffer Rose
15  * and Copyright (C) 2003-2006 Martin Quinson. All rights reserved.
16  *
17  * You can redistribute, use, perform, display and/or modify "Part A"
18  * provided the following two conditions hold:
19  *
20  * 1. The program is distributed WITHOUT ANY WARRANTY from the author of
21  *    FleXML; without even the implied warranty of MERCHANTABILITY or
22  *    FITNESS FOR A PARTICULAR PURPOSE.
23  *
24  * 2. The program distribution conditions do not in any way affect the
25  *    distribution conditions of the FleXML system used to generate this
26  *    file or any version of FleXML derived from that system.
27  *
28  * Notice that these are explicit rights granted to you for files
29  * generated by the FleXML system.  For your rights in connection with
30  * the FleXML system itself please consult the GNU General Public License.
31  * 
32  * Part B
33  * ------
34  * 
35  * The other parts, here collectively called "Part B", and which came 
36  * from the DTD used by FleXML to generate this program, can be 
37  * distributed (or not, as the case may be) under the terms of whoever
38  * wrote them, provided these terms respect and obey the two conditions 
39  * above under the heading "Part A".
40  *
41  * The author of and contributors to FleXML specifically disclaim
42  * any copyright interest in "Part B", unless "Part B" was written 
43  * by the author of or contributors to FleXML.
44  * 
45  */
46
47 %{
48
49 /* Version strings. */
50 const char rcs_dax__flexml_skeleton[] =
51  "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
52 const char rcs_dax__flexml[] =
53  "$" "Id: flexml.pl,v 1.62 2007/10/11 10:00:14 mquinson Exp $";
54
55 /* ANSI headers. */
56 #include <stdlib.h> /* for realloc() -- needed here when using flex 2.5.4 */
57 #include <stdio.h>
58 #include <string.h>
59 #include <assert.h>
60 #include <stdarg.h>
61 #include <ctype.h>
62      
63 #if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
64 # ifndef __STRICT_ANSI__
65 #  include <io.h>
66 #  include <process.h>
67 # endif
68 #else
69 # include <unistd.h>
70 #endif
71      
72 #ifndef FLEXML_INDEXSTACKSIZE
73 #define FLEXML_INDEXSTACKSIZE 1000
74 #endif
75
76 /* Generated definitions. */
77 #define FLEXML_yylineno
78 #ifndef FLEXML_BUFFERSTACKSIZE
79 #define FLEXML_BUFFERSTACKSIZE 1000000
80 #endif
81 #define FLEXML_NEED_BUFFERLIT
82
83 /* XML processor api. */
84 /* FleXML-provided data. */
85 int dax__pcdata_ix;
86 extern char *dax__bufferstack;
87 #define dax__pcdata (dax__bufferstack + dax__pcdata_ix)
88 AT_dax__adag_version AX_dax__adag_version;
89 #define A_dax__adag_version (dax__bufferstack + AX_dax__adag_version)
90 AT_dax__uses_type AX_dax__uses_type;
91 #define A_dax__uses_type (dax__bufferstack + AX_dax__uses_type)
92 AT_dax__uses_optional AX_dax__uses_optional;
93 #define A_dax__uses_optional AX_dax__uses_optional
94 AT_dax__adag_name AX_dax__adag_name;
95 #define A_dax__adag_name (dax__bufferstack + AX_dax__adag_name)
96 AT_dax__child_ref AX_dax__child_ref;
97 #define A_dax__child_ref (dax__bufferstack + AX_dax__child_ref)
98 AT_dax__adag_xmlns AX_dax__adag_xmlns;
99 #define A_dax__adag_xmlns (dax__bufferstack + AX_dax__adag_xmlns)
100 AT_dax__uses_transfer AX_dax__uses_transfer;
101 #define A_dax__uses_transfer AX_dax__uses_transfer
102 AT_dax__job_id AX_dax__job_id;
103 #define A_dax__job_id (dax__bufferstack + AX_dax__job_id)
104 AT_dax__uses_file AX_dax__uses_file;
105 #define A_dax__uses_file (dax__bufferstack + AX_dax__uses_file)
106 AT_dax__parent_ref AX_dax__parent_ref;
107 #define A_dax__parent_ref (dax__bufferstack + AX_dax__parent_ref)
108 AT_dax__adag_count AX_dax__adag_count;
109 #define A_dax__adag_count (dax__bufferstack + AX_dax__adag_count)
110 AT_dax__adag_xmlns_c_xsi AX_dax__adag_xmlns_c_xsi;
111 #define A_dax__adag_xmlns_c_xsi (dax__bufferstack + AX_dax__adag_xmlns_c_xsi)
112 AT_dax__adag_index AX_dax__adag_index;
113 #define A_dax__adag_index (dax__bufferstack + AX_dax__adag_index)
114 AT_dax__uses_size AX_dax__uses_size;
115 #define A_dax__uses_size (dax__bufferstack + AX_dax__uses_size)
116 AT_dax__adag_childCount AX_dax__adag_childCount;
117 #define A_dax__adag_childCount (dax__bufferstack + AX_dax__adag_childCount)
118 AT_dax__uses_link AX_dax__uses_link;
119 #define A_dax__uses_link AX_dax__uses_link
120 AT_dax__job_runtime AX_dax__job_runtime;
121 #define A_dax__job_runtime (dax__bufferstack + AX_dax__job_runtime)
122 AT_dax__job_level AX_dax__job_level;
123 #define A_dax__job_level (dax__bufferstack + AX_dax__job_level)
124 AT_dax__job_namespace AX_dax__job_namespace;
125 #define A_dax__job_namespace (dax__bufferstack + AX_dax__job_namespace)
126 AT_dax__job_name AX_dax__job_name;
127 #define A_dax__job_name (dax__bufferstack + AX_dax__job_name)
128 AT_dax__adag_jobCount AX_dax__adag_jobCount;
129 #define A_dax__adag_jobCount (dax__bufferstack + AX_dax__adag_jobCount)
130 AT_dax__job_version AX_dax__job_version;
131 #define A_dax__job_version (dax__bufferstack + AX_dax__job_version)
132 AT_dax__adag_xsi_c_schemaLocation AX_dax__adag_xsi_c_schemaLocation;
133 #define A_dax__adag_xsi_c_schemaLocation (dax__bufferstack + AX_dax__adag_xsi_c_schemaLocation)
134 AT_dax__uses_register AX_dax__uses_register;
135 #define A_dax__uses_register AX_dax__uses_register
136 AT_dax__adag_fileCount AX_dax__adag_fileCount;
137 #define A_dax__adag_fileCount (dax__bufferstack + AX_dax__adag_fileCount)
138
139 /* XML state. */
140 #ifdef FLEX_DEBUG
141 # define ENTER(state)   debug_enter(state,#state)
142 # define LEAVE          debug_leave()
143 # define SET(state)     debug_set(state,#state)
144   static void debug_enter(int, const char*);
145   static void debug_leave(void);
146   static void debug_set(int, const char*);
147 #else
148 # define ENTER(state)   (yy_push_state(state))
149 # define LEAVE          (yy_pop_state())
150 # define SET(state)     BEGIN(state)
151 #endif
152
153 /* Generic actions. */
154 #define SKIP    /*skip*/
155 #define SUCCEED        CLEANUP; return 0
156
157 #define FAIL    return fail
158 static int fail(const char*, ...);
159
160 enum {flexml_max_err_msg_size = 512};
161 static char flexml_err_msg[flexml_max_err_msg_size];
162 const char * dax__parse_err_msg()
163 {
164     return flexml_err_msg;
165 }
166 static void reset_dax__parse_err_msg()
167 {
168     flexml_err_msg[0] = '\0';
169 }
170
171 /* Cleanup */
172 static void cleanup(void);
173 #define CLEANUP  cleanup()
174
175 /* Text buffer stack handling. */
176 char *dax__bufferstack = NULL;
177 static int blimit = FLEXML_BUFFERSTACKSIZE;
178 static int bnext = 1;
179
180 static int *indexstack = NULL;
181 static int ilimit = FLEXML_INDEXSTACKSIZE;
182 static int inext = 1;
183
184 #define BUFFERSET(P)  (P = bnext)
185 #define BUFFERPUTC(C) (ck_blimit(), dax__bufferstack[bnext++] = (C))
186 #define BUFFERDONE    (BUFFERPUTC('\0'))
187
188 #define BUFFERLITERAL(C, P) dax__bufferliteral(C, &(P), yytext)
189
190 /* after this is called, there are at least 2 slots left in the stack */
191 static int ck_blimit()
192 {
193      if (bnext >= blimit) {
194          blimit += FLEXML_BUFFERSTACKSIZE + 2;
195          {
196              char *temp = (char *) realloc(dax__bufferstack, blimit);
197              assert(temp);
198              dax__bufferstack = temp;
199          }
200      }
201      return 0;
202 }
203
204 /* after this is called, there are at least 2 slots left in the stack */
205 static int ck_ilimit()
206 {
207      if (inext >= ilimit) {
208          ilimit += FLEXML_INDEXSTACKSIZE + 2;
209          {
210              int *temp = (int *) realloc(indexstack, ilimit);
211              assert(temp);
212              indexstack = temp;
213          }
214      }
215      return 0;
216 }
217
218 #ifdef FLEXML_NEED_BUFFERLIT
219 static void dax__bufferliteral(char c, int* pp, const char* text)
220 {
221   const char *s = (c ? strchr(text,c) : text-1), *e = strrchr(text,c);
222   assert(s <= e); BUFFERSET(*pp);
223   while (++s<e) {
224     if (isspace(*s) && c) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
225     else BUFFERPUTC(*s);
226   }
227   BUFFERDONE;
228 }
229 #endif
230
231 static void pushbuffer(int p)
232 {
233     ck_ilimit();
234     indexstack[inext++] = p;
235     indexstack[inext++] = bnext;    
236 }
237
238 static int popbuffer(void)
239 {
240     assert(inext >= 2);
241     bnext = indexstack[--inext];
242     return indexstack[--inext];
243 }
244
245 /* General internal entities are `unput' back onto the input stream... */
246 #define ENTITYTEXT(T) \
247   { char *s = (T), *e = s+strlen(s);\
248     while (--e >= s) { unput(*e); }}
249
250
251 %}
252
253 /* Flex standard options. */
254 %option stack
255 %option noyy_top_state
256 %option noinput
257 %option noreject
258 %option noyymore
259 %option noyywrap
260
261 /* Flex user-requested options. */
262 %option yylineno
263 %option nounput
264
265 /* XML character classes (currently restricted to ASCII). */
266
267 /* "Common syntactic structures." */
268 S               [ \t\n\r\f]+
269 s               [ \t\n\r\f]*
270
271 /* "Names and Tokens." */
272 NameChar        [A-Za-z0-9.:_-]
273 Name            [A-Za-z_:]{NameChar}*
274 Names           {Name}({S}{Name})*
275 Nmtoken         ({NameChar})+
276 Nmtokens        {Nmtoken}({S}{Nmtoken})*
277
278 /* Miscellaneous. */
279 VersionNum      [a-zA-Z0-9_.:-]+
280 Eq              {s}"="{s}
281 Literal         \'[^'']*\'|\"[^""]*\"
282
283 /* Parser states (flex `exclusive start conditions'):
284  *
285  * PROLOG       the XML prolog of the document before <?xml...>
286  * DOCTYPE      the XML prolog of the document after <?xml...>
287  * EPILOG       after the root element
288  * INCOMMENT    inside an XML comment <!--....-->
289  * INPI         inside an XML PI <?...?>
290  * VALUE1       inside a '...'-delimited literal
291  * VALUE2       inside a "..."-delimited literal
292  * CDATA        inside a <![CDATA[...] ]> section.
293  * ROOT_<tag>   expect root element <tag>
294  * AL_<tag>     inside the attribute list for <tag>
295  * IN_<tag>     inside a <tag> with element contents (ready for end tag)
296  * IMPOSSIBLE   dummy to permit disabling rules; must be last
297  */
298 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
299 %x ROOT_dax__adag AL_dax__adag S_dax__adag S_dax__adag_1 S_dax__adag_2 S_dax__adag_3 S_dax__adag_4 S_dax__adag_5 E_dax__adag
300 %x AL_dax__job S_dax__job S_dax__job_1 S_dax__job_2 E_dax__job
301 %x AL_dax__uses E_dax__uses
302 %x AL_dax__child S_dax__child S_dax__child_1 S_dax__child_2 E_dax__child
303 %x AL_dax__parent E_dax__parent
304 %x IMPOSSIBLE
305
306 %{
307 /* State names. */
308 const char* *dax__statenames=NULL;
309 %}
310
311 %%
312
313  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
314  SET(PROLOG);
315  reset_dax__parse_err_msg();
316  dax__bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
317  assert(dax__bufferstack);
318  #ifdef FLEX_DEBUG
319  {
320      int i;
321      for (i = 0; i < blimit; i++) {
322          dax__bufferstack[i] = '\377';
323      }
324  }
325  #endif
326  dax__bufferstack[0] = '\0';
327  indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
328  assert(indexstack);
329  indexstack[0] = 0;
330
331   /* FleXML_init */
332   bnext = inext = 1;
333   dax__bufferliteral('\0', &bnext, "http://pegasus.isi.edu/schema/DAX");
334   dax__bufferliteral('\0', &bnext, "http://www.w3.org/2001/XMLSchema-instance");
335   dax__bufferliteral('\0', &bnext, "http://pegasus.isi.edu/schema/DAX http://pegasus.isi.edu/schema/dax-2.1.xsd");
336   dax__bufferliteral('\0', &bnext, "1.0");
337   dax__bufferliteral('\0', &bnext, "0.0");
338   dax__bufferliteral('\0', &bnext, "data");
339   if(!dax__statenames) {dax__statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
340   dax__statenames[PROLOG] = NULL;
341   dax__statenames[DOCTYPE] = NULL;
342   dax__statenames[EPILOG] = NULL;
343   dax__statenames[INCOMMENT] = NULL;
344   dax__statenames[INPI] = NULL;
345   dax__statenames[VALUE1] = NULL;
346   dax__statenames[VALUE2] = NULL;
347   dax__statenames[CDATA] = NULL;
348   dax__statenames[ROOT_dax__adag] = NULL;
349   dax__statenames[AL_dax__adag] = NULL;
350   dax__statenames[S_dax__adag] = "adag";
351   dax__statenames[S_dax__adag_1] = "adag";
352   dax__statenames[S_dax__adag_2] = "adag";
353   dax__statenames[S_dax__adag_3] = "adag";
354   dax__statenames[S_dax__adag_4] = "adag";
355   dax__statenames[S_dax__adag_5] = "adag";
356   dax__statenames[E_dax__adag] = "adag";
357   dax__statenames[AL_dax__job] = NULL;
358   dax__statenames[S_dax__job] = "job";
359   dax__statenames[S_dax__job_1] = "job";
360   dax__statenames[S_dax__job_2] = "job";
361   dax__statenames[E_dax__job] = "job";
362   dax__statenames[AL_dax__uses] = NULL;
363   dax__statenames[E_dax__uses] = "uses";
364   dax__statenames[AL_dax__child] = NULL;
365   dax__statenames[S_dax__child] = "child";
366   dax__statenames[S_dax__child_1] = "child";
367   dax__statenames[S_dax__child_2] = "child";
368   dax__statenames[E_dax__child] = "child";
369   dax__statenames[AL_dax__parent] = NULL;
370   dax__statenames[E_dax__parent] = "parent";
371   }
372
373  /* COMMENTS and PIs: handled uniformly for efficiency. */
374
375 <ROOT_dax__adag,AL_dax__adag,S_dax__adag,S_dax__adag_1,S_dax__adag_2,S_dax__adag_3,S_dax__adag_4,S_dax__adag_5,E_dax__adag,AL_dax__job,S_dax__job,S_dax__job_1,S_dax__job_2,E_dax__job,AL_dax__uses,E_dax__uses,AL_dax__child,S_dax__child,S_dax__child_1,S_dax__child_2,E_dax__child,AL_dax__parent,E_dax__parent,PROLOG,DOCTYPE,EPILOG>{
376  "<!--" ENTER(INCOMMENT);
377  "<?" ENTER(INPI);
378 }
379 <INCOMMENT>{
380  "-->"          LEAVE;
381  "--"           |
382  .              |
383  \n             SKIP;
384  <<EOF>>        FAIL("EOF in comment.");
385 }
386 <INPI>{
387  "?>"           LEAVE;
388  .              |
389  \n             SKIP;
390  <<EOF>>        FAIL("EOF in PI (processing instruction).");
391 }
392
393  /* SPACES: skipped uniformly */
394
395 <ROOT_dax__adag,AL_dax__adag,S_dax__adag,S_dax__adag_1,S_dax__adag_2,S_dax__adag_3,S_dax__adag_4,S_dax__adag_5,E_dax__adag,AL_dax__job,S_dax__job,S_dax__job_1,S_dax__job_2,E_dax__job,AL_dax__uses,E_dax__uses,AL_dax__child,S_dax__child,S_dax__child_1,S_dax__child_2,E_dax__child,AL_dax__parent,E_dax__parent,PROLOG,DOCTYPE,EPILOG>{S} SKIP;
396
397  /* PROLOG: determine root element and process it. */
398
399 <PROLOG>{
400  "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?({S}encoding{Eq}(\'[^']*\'|\"[^"]*\"))?"?>" SET(ROOT_dax__adag); 
401  "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
402 }
403
404 <PROLOG,DOCTYPE>{
405  "<!DOCTYPE"{S}"adag"{S}SYSTEM{S}("'dax.dtd'"|"\"dax.dtd\""){s}">" SET(ROOT_dax__adag);
406  "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
407  .              FAIL("Unexpected character `%c' in prolog.", yytext[0]);
408  <<EOF>>        FAIL("EOF in prolog.");
409 }
410
411  /* RULES DERIVED FROM DTD. */
412
413  /* <!-- Small DTD for DAX files. -->  */
414
415 <S_dax__child_1,S_dax__job,S_dax__adag_3,S_dax__child_2,S_dax__adag_5,S_dax__job_1,E_dax__job,E_dax__adag,S_dax__child,S_dax__adag_4,S_dax__job_2,S_dax__adag,S_dax__adag_2,S_dax__adag_1,E_dax__child>"<adag"{s} FAIL("Starting tag <adag> is not allowed here.");
416
417 <ROOT_dax__adag>"<adag"{s} {
418   AX_dax__adag_xmlns = 1;
419   AX_dax__adag_xmlns_c_xsi = 35;
420   AX_dax__adag_xsi_c_schemaLocation = 77;
421   AX_dax__adag_version = 153;
422   AX_dax__adag_count = 0;
423   AX_dax__adag_index = 0;
424   AX_dax__adag_name = 0;
425   AX_dax__adag_jobCount = 0;
426   AX_dax__adag_fileCount = 0;
427   AX_dax__adag_childCount = 0;
428   ENTER(AL_dax__adag); pushbuffer(0);
429   }
430
431 <AL_dax__adag>{
432  "xmlns"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_xmlns);
433  "xmlns"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_xmlns);
434
435  "xmlns:xsi"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_xmlns_c_xsi);
436  "xmlns:xsi"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_xmlns_c_xsi);
437
438  "xsi:schemaLocation"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_xsi_c_schemaLocation);
439  "xsi:schemaLocation"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_xsi_c_schemaLocation);
440
441  "version"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_version);
442  "version"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_version);
443
444  "count"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_count);
445  "count"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_count);
446
447  "index"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_index);
448  "index"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_index);
449
450  "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_name);
451  "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_name);
452
453  "jobCount"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_jobCount);
454  "jobCount"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_jobCount);
455
456  "fileCount"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_fileCount);
457  "fileCount"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_fileCount);
458
459  "childCount"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__adag_childCount);
460  "childCount"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__adag_childCount);
461
462  ">" {
463   LEAVE; STag_dax__adag();dax__pcdata_ix = 0; ENTER(S_dax__adag);
464  }
465  "/>" {
466   LEAVE; STag_dax__adag(); dax__pcdata_ix = 0; ETag_dax__adag(); popbuffer(); /* attribute */
467   switch (YY_START) {
468    case ROOT_dax__adag: SET(EPILOG); break;
469   }
470  }
471  .       FAIL("Unexpected character `%c' in attribute list of adag element.", yytext[0]);
472  {Name} FAIL("Bad attribute `%s' in `adag' element start tag.",yytext);
473  <<EOF>> FAIL("EOF in attribute list of `adag' element.");
474 }
475
476 <S_dax__adag_1,S_dax__adag_5,E_dax__adag,S_dax__adag_3,S_dax__adag>{
477  "</adag"{s}">" {
478   LEAVE;
479   ETag_dax__adag();
480   popbuffer(); /* attribute */
481   switch (YY_START) {
482    case ROOT_dax__adag: SET(EPILOG); break;
483   }
484  }
485  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</adag>' expected.",yytext);
486  .       FAIL("Unexpected character `%c': `</adag>' expected.",yytext[0]);
487  <<EOF>> FAIL("Premature EOF: `</adag>' expected.");
488 }
489
490 <S_dax__child_1,S_dax__job,S_dax__child_2,ROOT_dax__job,S_dax__adag_5,S_dax__job_1,E_dax__job,E_dax__adag,S_dax__child,S_dax__adag_4,S_dax__job_2,E_dax__child,S_dax__adag_1>"<job"{s} FAIL("Starting tag <job> is not allowed here.");
491
492 <S_dax__adag_2,S_dax__adag_3,S_dax__adag>"<job"{s} {
493   AX_dax__job_id = 0;
494   AX_dax__job_namespace = 0;
495   AX_dax__job_name = 0;
496   AX_dax__job_version = 157;
497   AX_dax__job_runtime = 0;
498   AX_dax__job_level = 0;
499   ENTER(AL_dax__job); pushbuffer(0);
500   }
501
502 <AL_dax__job>{
503  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__job_id);
504  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__job_id);
505
506  "namespace"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__job_namespace);
507  "namespace"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__job_namespace);
508
509  "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__job_name);
510  "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__job_name);
511
512  "version"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__job_version);
513  "version"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__job_version);
514
515  "runtime"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__job_runtime);
516  "runtime"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__job_runtime);
517
518  "level"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__job_level);
519  "level"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__job_level);
520
521  ">" {
522   if (!AX_dax__job_id) FAIL("Required attribute `id' not set for `job' element.");
523   if (!AX_dax__job_name) FAIL("Required attribute `name' not set for `job' element.");
524   if (!AX_dax__job_runtime) FAIL("Required attribute `runtime' not set for `job' element.");
525   LEAVE; STag_dax__job();dax__pcdata_ix = 0; ENTER(S_dax__job);
526  }
527  "/>" {
528   if (!AX_dax__job_id) FAIL("Required attribute `id' not set for `job' element.");
529   if (!AX_dax__job_name) FAIL("Required attribute `name' not set for `job' element.");
530   if (!AX_dax__job_runtime) FAIL("Required attribute `runtime' not set for `job' element.");
531   LEAVE; STag_dax__job(); dax__pcdata_ix = 0; ETag_dax__job(); popbuffer(); /* attribute */
532   switch (YY_START) {
533    case S_dax__adag_2: case S_dax__adag_3: case S_dax__adag: SET(S_dax__adag_3); break;
534   }
535  }
536  .       FAIL("Unexpected character `%c' in attribute list of job element.", yytext[0]);
537  {Name} FAIL("Bad attribute `%s' in `job' element start tag.",yytext);
538  <<EOF>> FAIL("EOF in attribute list of `job' element.");
539 }
540
541 <S_dax__job,E_dax__job,S_dax__job_2>{
542  "</job"{s}">" {
543   LEAVE;
544   ETag_dax__job();
545   popbuffer(); /* attribute */
546   switch (YY_START) {
547    case S_dax__adag_2: case S_dax__adag_3: case S_dax__adag: SET(S_dax__adag_3); break;
548   }
549  }
550  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</job>' expected.",yytext);
551  .       FAIL("Unexpected character `%c': `</job>' expected.",yytext[0]);
552  <<EOF>> FAIL("Premature EOF: `</job>' expected.");
553 }
554
555  /* <!-- ignored -->
556   * <!-- ignored -->  */
557
558 <S_dax__child_1,S_dax__adag_3,S_dax__child_2,S_dax__adag_5,E_dax__job,E_dax__adag,S_dax__child,S_dax__adag_4,ROOT_dax__uses,S_dax__adag,S_dax__adag_2,E_dax__child,S_dax__adag_1>"<uses"{s} FAIL("Starting tag <uses> is not allowed here.");
559
560 <S_dax__job,S_dax__job_2,S_dax__job_1>"<uses"{s} {
561   AX_dax__uses_file = 0;
562   AX_dax__uses_link = AU_dax__uses_link;
563   AX_dax__uses_register = A_dax__uses_register_true;
564   AX_dax__uses_transfer = A_dax__uses_transfer_true;
565   AX_dax__uses_optional = A_dax__uses_optional_false;
566   AX_dax__uses_type = 161;
567   AX_dax__uses_size = 0;
568   ENTER(AL_dax__uses); pushbuffer(0);
569   }
570
571 <AL_dax__uses>{
572  "file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__uses_file);
573  "file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__uses_file);
574
575  "link"{Eq}"'input'" |
576  "link"{Eq}"\"input\"" A_dax__uses_link = A_dax__uses_link_input;
577  "link"{Eq}"'output'" |
578  "link"{Eq}"\"output\"" A_dax__uses_link = A_dax__uses_link_output;
579
580  "register"{Eq}"'false'" |
581  "register"{Eq}"\"false\"" A_dax__uses_register = A_dax__uses_register_false;
582  "register"{Eq}"'true'" |
583  "register"{Eq}"\"true\"" A_dax__uses_register = A_dax__uses_register_true;
584
585  "transfer"{Eq}"'false'" |
586  "transfer"{Eq}"\"false\"" A_dax__uses_transfer = A_dax__uses_transfer_false;
587  "transfer"{Eq}"'true'" |
588  "transfer"{Eq}"\"true\"" A_dax__uses_transfer = A_dax__uses_transfer_true;
589
590  "optional"{Eq}"'false'" |
591  "optional"{Eq}"\"false\"" A_dax__uses_optional = A_dax__uses_optional_false;
592  "optional"{Eq}"'true'" |
593  "optional"{Eq}"\"true\"" A_dax__uses_optional = A_dax__uses_optional_true;
594
595  "type"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__uses_type);
596  "type"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__uses_type);
597
598  "size"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__uses_size);
599  "size"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__uses_size);
600
601  ">" {
602   if (!AX_dax__uses_file) FAIL("Required attribute `file' not set for `uses' element.");
603   if (!AX_dax__uses_size) FAIL("Required attribute `size' not set for `uses' element.");
604   LEAVE; STag_dax__uses();dax__pcdata_ix = 0; ENTER(E_dax__uses);
605  }
606  "/>" {
607   if (!AX_dax__uses_file) FAIL("Required attribute `file' not set for `uses' element.");
608   if (!AX_dax__uses_size) FAIL("Required attribute `size' not set for `uses' element.");
609   LEAVE; STag_dax__uses(); dax__pcdata_ix = 0; ETag_dax__uses(); popbuffer(); /* attribute */
610   switch (YY_START) {
611    case S_dax__job: case S_dax__job_2: case S_dax__job_1: SET(S_dax__job_2); break;
612   }
613  }
614  .       FAIL("Unexpected character `%c' in attribute list of uses element.", yytext[0]);
615  {Name} FAIL("Bad attribute `%s' in `uses' element start tag.",yytext);
616  <<EOF>> FAIL("EOF in attribute list of `uses' element.");
617 }
618
619 <E_dax__uses>{
620  "</uses"{s}">" {
621   LEAVE;
622   ETag_dax__uses();
623   popbuffer(); /* attribute */
624   switch (YY_START) {
625    case S_dax__job: case S_dax__job_2: case S_dax__job_1: SET(S_dax__job_2); break;
626   }
627  }
628  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</uses>' expected.",yytext);
629  .       FAIL("Unexpected character `%c': `</uses>' expected.",yytext[0]);
630  <<EOF>> FAIL("Premature EOF: `</uses>' expected.");
631 }
632
633 <S_dax__child_1,S_dax__job,S_dax__child_2,S_dax__job_1,E_dax__job,E_dax__adag,S_dax__child,S_dax__job_2,S_dax__adag_2,E_dax__child,ROOT_dax__child>"<child"{s} FAIL("Starting tag <child> is not allowed here.");
634
635 <S_dax__adag_1,S_dax__adag_4,S_dax__adag_5,S_dax__adag_3,S_dax__adag>"<child"{s} {
636   AX_dax__child_ref = 0;
637   ENTER(AL_dax__child); pushbuffer(0);
638   }
639
640 <AL_dax__child>{
641  "ref"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__child_ref);
642  "ref"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__child_ref);
643
644  ">" {
645   if (!AX_dax__child_ref) FAIL("Required attribute `ref' not set for `child' element.");
646   LEAVE; STag_dax__child();dax__pcdata_ix = 0; ENTER(S_dax__child);
647  }
648  "/>" {
649   if (!AX_dax__child_ref) FAIL("Required attribute `ref' not set for `child' element.");
650   LEAVE; STag_dax__child(); dax__pcdata_ix = 0; ETag_dax__child(); popbuffer(); /* attribute */
651   switch (YY_START) {
652    case S_dax__adag_1: case S_dax__adag_4: case S_dax__adag_5: case S_dax__adag_3: case S_dax__adag: SET(S_dax__adag_5); break;
653   }
654  }
655  .       FAIL("Unexpected character `%c' in attribute list of child element.", yytext[0]);
656  {Name} FAIL("Bad attribute `%s' in `child' element start tag.",yytext);
657  <<EOF>> FAIL("EOF in attribute list of `child' element.");
658 }
659
660 <S_dax__child_2,E_dax__child,S_dax__child>{
661  "</child"{s}">" {
662   LEAVE;
663   ETag_dax__child();
664   popbuffer(); /* attribute */
665   switch (YY_START) {
666    case S_dax__adag_1: case S_dax__adag_4: case S_dax__adag_5: case S_dax__adag_3: case S_dax__adag: SET(S_dax__adag_5); break;
667   }
668  }
669  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</child>' expected.",yytext);
670  .       FAIL("Unexpected character `%c': `</child>' expected.",yytext[0]);
671  <<EOF>> FAIL("Premature EOF: `</child>' expected.");
672 }
673
674 <S_dax__job,S_dax__adag_3,S_dax__adag_5,S_dax__job_1,E_dax__job,E_dax__adag,S_dax__adag_4,ROOT_dax__parent,S_dax__job_2,S_dax__adag,S_dax__adag_2,E_dax__child,S_dax__adag_1>"<parent"{s} FAIL("Starting tag <parent> is not allowed here.");
675
676 <S_dax__child_2,S_dax__child,S_dax__child_1>"<parent"{s} {
677   AX_dax__parent_ref = 0;
678   ENTER(AL_dax__parent); pushbuffer(0);
679   }
680
681 <AL_dax__parent>{
682  "ref"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_dax__parent_ref);
683  "ref"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_dax__parent_ref);
684
685  ">" {
686   if (!AX_dax__parent_ref) FAIL("Required attribute `ref' not set for `parent' element.");
687   LEAVE; STag_dax__parent();dax__pcdata_ix = 0; ENTER(E_dax__parent);
688  }
689  "/>" {
690   if (!AX_dax__parent_ref) FAIL("Required attribute `ref' not set for `parent' element.");
691   LEAVE; STag_dax__parent(); dax__pcdata_ix = 0; ETag_dax__parent(); popbuffer(); /* attribute */
692   switch (YY_START) {
693    case S_dax__child_2: case S_dax__child: case S_dax__child_1: SET(S_dax__child_2); break;
694   }
695  }
696  .       FAIL("Unexpected character `%c' in attribute list of parent element.", yytext[0]);
697  {Name} FAIL("Bad attribute `%s' in `parent' element start tag.",yytext);
698  <<EOF>> FAIL("EOF in attribute list of `parent' element.");
699 }
700
701 <E_dax__parent>{
702  "</parent"{s}">" {
703   LEAVE;
704   ETag_dax__parent();
705   popbuffer(); /* attribute */
706   switch (YY_START) {
707    case S_dax__child_2: case S_dax__child: case S_dax__child_1: SET(S_dax__child_2); break;
708   }
709  }
710  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</parent>' expected.",yytext);
711  .       FAIL("Unexpected character `%c': `</parent>' expected.",yytext[0]);
712  <<EOF>> FAIL("Premature EOF: `</parent>' expected.");
713 }
714
715  /* EPILOG: after the root element. */
716
717 <EPILOG>{
718  . {SET(PROLOG); yyless(0); CLEANUP; return -1;}
719  <<EOF>>        SUCCEED;
720 }
721
722  /* CHARACTER DATA. */
723
724 <IMPOSSIBLE,VALUE1,VALUE2>{
725  /* Non-defined standard entities... */
726 "&amp;"  BUFFERPUTC('&');
727 "&lt;"   BUFFERPUTC('<');
728 "&gt;"   BUFFERPUTC('>');
729 "&apos;" BUFFERPUTC('\'');
730 "&quot;" BUFFERPUTC('"');
731
732  /* Character entities. */
733  "&#"[[:digit:]]+";"    BUFFERPUTC((unsigned char)atoi(yytext+2));
734  "&#x"[[:xdigit:]]+";"  BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
735 }
736
737 <IMPOSSIBLE,VALUE1,VALUE2,CDATA>{
738  "\n"           |
739  "\r"           |
740  "\r\n"         |
741  "\n\r"         BUFFERPUTC('\n');
742 }
743
744 <IMPOSSIBLE>{
745  "<![CDATA["    ENTER(CDATA);
746  "]""]>"                FAIL("Unexpected `]""]>' in character data.");
747 }
748
749 <VALUE1>{
750  \'             BUFFERDONE; LEAVE;
751  <<EOF>>        FAIL("EOF in literal (\"'\" expected).");
752 }
753
754 <VALUE2>{
755  \"             BUFFERDONE; LEAVE;
756  <<EOF>>        FAIL("EOF in literal (`\"' expected).");
757 }
758
759 <IMPOSSIBLE,VALUE1,VALUE2>{
760  [^<&]          BUFFERPUTC(yytext[0]);
761  [<&]           FAIL("Spurious `%c' in character data.",yytext[0]);
762 }
763
764 <CDATA>{
765  "]""]>"                LEAVE;
766  /* "]""]"              BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]); */
767  .              BUFFERPUTC(yytext[0]);
768  <<EOF>>        FAIL("EOF in CDATA section.");
769 }
770
771  /* Impossible rules to avoid warnings from flex(1). */
772  /* Ideally, this should be replaced by code in flexml.pl that
773     generates just the states not covered by other rules. */
774 <*>{
775  .|[\n] FAIL("Syntax error on character `%c'.", yytext[0]);
776 }
777
778 %%
779
780 /* Element context stack lookup. */
781 int dax__element_context(int i)
782 {
783   return (0<i && i<yy_start_stack_depth
784           ? yy_start_stack[yy_start_stack_ptr - i]
785           : 0);
786 }
787
788 #ifdef FLEX_DEBUG
789 void print_yy_stack(char* fmt, ...)
790 {
791   int i = 0; va_list ap; va_start(ap, fmt);
792   vfprintf(stderr, fmt, ap);
793   if (dax__statenames) {
794       for (i=1; i<yy_start_stack_ptr; i++) {
795           fprintf(stderr, "%s/", dax__statenames[yy_start_stack[i] ]);
796       }
797       fprintf(stderr,"%s\n", dax__statenames[YY_START]);
798   }
799   va_end(ap);
800 }
801
802 void print_dax__bufferstack()
803 {
804     int i;
805     fputs("Buffer: ", stderr);
806     for (i = 0; i < blimit; i++) {
807        if ( dax__bufferstack[i] == '\377' ) break;
808          putc(dax__bufferstack[i], stderr);
809     }
810     putc('\n', stderr);
811 }
812
813 static void debug_enter(int state, const char* statename) {
814   yy_push_state(state);
815   if (yy_flex_debug) {
816        print_yy_stack("--ENTER(%s) : ",statename);
817        print_dax__bufferstack();
818   }
819 }
820
821 static void debug_leave(void) {
822     if (yy_flex_debug) {
823         print_yy_stack("--LEAVE : ");
824         print_dax__bufferstack();
825     }
826   yy_pop_state();
827 }
828
829 static void debug_set(int state, const char* statename) {
830   BEGIN(state);
831   if (yy_flex_debug) print_yy_stack("--SET(%s) : ",statename);
832 }
833 #endif
834
835
836 static void cleanup(void)
837 {
838     if (dax__statenames) {
839         free(dax__statenames);
840         dax__statenames = NULL;
841     }
842     free(dax__bufferstack);
843     dax__bufferstack = NULL;
844
845     free(indexstack);
846     indexstack = NULL;
847 }
848
849
850 static int fail(const char* fmt, ...)
851 {
852     int chars_left, used;
853     va_list ap; va_start(ap, fmt);
854 #ifdef FLEXML_yylineno
855     used = sprintf(flexml_err_msg,
856                    "Invalid XML (XML input line %d, state %d): ",
857                    yylineno, YY_START);
858 #else
859     used = sprintf(flexml_err_msg,
860                    "Invalid XML (state %d): ",
861                    YY_START);
862 #endif
863     chars_left = flexml_max_err_msg_size - used - 1;
864     vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
865     va_end(ap);
866
867 #ifndef FLEXML_quiet_parser
868     /* print directly to sdterr */
869     fprintf(stderr, "%s\n", flexml_err_msg);
870     flexml_err_msg[0] = '\0';
871 #endif
872
873     cleanup();
874
875     return 1;
876 }