Logo AND Algorithmique Numérique Distribuée

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