Logo AND Algorithmique Numérique Distribuée

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