1 /* Validating XML processor for surfxml.dtd.
2 * Generated 2005/01/05 17:50:49.
4 * This program was generated with the FleXML XML processor generator,
5 * (Id: flexml.pl,v 1.35 2005/01/05 06:29:58 legranda Exp).
6 * Copyright © 1999 Kristoffer Rose. All rights reserved.
8 * You can redistribute and/or modify this program provided the following
11 * 1. The program is distributed WITHOUT ANY WARRANTY from the author of
12 * FleXML; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.
15 * 2. The program distribution conditions do not in any way affect the
16 * distribution conditions of the FleXML system used to generate this
17 * file or any version of FleXML derived from that system.
19 * Notice that these are explicit rights granted to you for files
20 * generated by the FleXML system. For your rights in connection with
21 * the FleXML system itself please consult the GNU General Public License.
26 /* Version strings. */
27 const char rcs_flexml_skeleton[] =
28 "$" "Id: skel,v 1.19 2005/01/05 18:49:27 legranda Exp $";
29 const char rcs_flexml[] =
30 "$" "Id: flexml.pl,v 1.35 2005/01/05 06:29:58 legranda Exp $";
40 /* Generated definitions. */
41 #define FLEXML_yylineno
42 #define FLEXML_BUFFERSTACKSIZE 10000000
44 /* XML processor api. */
47 /* FleXML-provided data. */
49 AT_route_impact_on_computation A_route_impact_on_computation;
50 AT_network_link_bandwidth A_network_link_bandwidth;
51 AT_cpu_name A_cpu_name;
52 AT_network_link_state A_network_link_state;
53 AT_argument_value A_argument_value;
54 AT_cpu_availability_file A_cpu_availability_file;
55 AT_process_host A_process_host;
56 AT_route_src A_route_src;
57 AT_network_link_latency_file A_network_link_latency_file;
58 AT_cpu_availability A_cpu_availability;
59 AT_network_link_name A_network_link_name;
60 AT_route_element_name A_route_element_name;
61 AT_cpu_power A_cpu_power;
62 AT_include_file A_include_file;
63 AT_process_function A_process_function;
64 AT_cpu_state A_cpu_state;
65 AT_route_dst A_route_dst;
66 AT_network_link_latency A_network_link_latency;
67 AT_cpu_state_file A_cpu_state_file;
68 AT_network_link_state_file A_network_link_state_file;
69 AT_network_link_bandwidth_file A_network_link_bandwidth_file;
73 # define ENTER(state) debug_enter(state,#state)
74 # define LEAVE debug_leave()
75 # define SET(state) debug_set(state,#state)
76 static void debug_enter(int, const char*);
77 static void debug_leave(void);
78 static void debug_set(int, const char*);
80 # define ENTER(state) (yy_push_state(state))
81 # define LEAVE (yy_pop_state())
82 # define SET(state) BEGIN(state)
85 /* Generic actions. */
87 #define SUCCEED return 0
89 #define FAIL return fail
90 static int fail(const char*, ...);
92 /* Text buffer stack handling. */
93 char bufferstack[FLEXML_BUFFERSTACKSIZE];
94 char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
95 typedef struct BufferLast_s {
96 struct BufferLast_s *old; char* saved; char new[1];
98 BufferLast* last = (BufferLast*)0;
99 char* next = bufferstack;
101 #define BUFFERSET(P) (P = next)
102 #define BUFFERPUTC(C) (assert(next<limit), *(next++) = (C))
103 #define BUFFERDONE (BUFFERPUTC('\0'))
105 #define BUFFERLITERAL(C,P) bufferliteral(C,&(P),yytext)
106 static void bufferliteral(char c, const char** pp, char* text)
108 char *s = strchr(text,c), *e = strrchr(text,c);
109 assert(s <= e); BUFFERSET(*pp);
111 if (isspace(*s)) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
117 #ifdef FLEXML_HasMixed
118 static void pushbuffer(char* p)
120 BufferLast* l = (BufferLast*)next;
121 assert(next < limit);
128 static char* popbuffer(void)
130 BufferLast* l = last;
131 assert(last != (BufferLast*)0);
138 /* General internal entities are `unput' back onto the input stream... */
139 #define ENTITYTEXT(T) \
140 { char *s = (T), *e = s+strlen(s);\
141 while (--e >= s) { unput(*e); }}
144 /* Flex standard options. */
146 %option noyy_top_state
152 /* Flex user-requested options. */
156 /* XML character classes (currently restricted to ASCII). */
158 /* "Common syntactic structures." */
162 /* "Names and Tokens." */
163 NameChar [A-Za-z0-9.:_-]
164 Name [A-Za-z_:]{NameChar}*
165 Names {Name}({S}{Name})*
166 Nmtoken ({NameChar})+
167 Nmtokens {Nmtoken}({S}{Nmtoken})*
170 VersionNum [a-zA-Z0-9_.:-]+
172 Literal \'[^'']*\'|\"[^""]*\"
174 /* Parser states (flex `exclusive start conditions'):
176 * PROLOG the XML prolog of the document before <?xml...>
177 * DOCTYPE the XML prolog of the document after <?xml...>
178 * EPILOG after the root element
179 * INCOMMENT inside an XML comment <!--....-->
180 * INPI inside an XML PI <?...?>
181 * VALUE1 inside a '...'-delimited literal
182 * VALUE2 inside a "..."-delimited literal
183 * CDATA inside a <![CDATA[...]]> section.
184 * ROOT_<tag> expect root element <tag>
185 * AL_<tag> inside the attribute list for <tag>
186 * IN_<tag> inside a <tag> with element contents (ready for end tag)
187 * IMPOSSIBLE dummy to permit disabling rules; must be last
189 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
190 %x ROOT_platform_description AL_platform_description S_platform_description S_platform_description_1 S_platform_description_2 E_platform_description
191 %x ROOT_include AL_include S_include S_include_1 S_include_2 E_include
192 %x ROOT_cpu AL_cpu E_cpu
193 %x ROOT_network_link AL_network_link E_network_link
194 %x ROOT_route AL_route S_route S_route_1 S_route_2 E_route
195 %x ROOT_route_element AL_route_element E_route_element
196 %x ROOT_process AL_process S_process S_process_1 S_process_2 E_process
197 %x ROOT_argument AL_argument E_argument
202 const char* *statenames=NULL;
207 /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
210 if(!statenames) statenames=calloc(IMPOSSIBLE,sizeof(char*));
211 statenames[PROLOG] = NULL;
212 statenames[DOCTYPE] = NULL;
213 statenames[EPILOG] = NULL;
214 statenames[INCOMMENT] = NULL;
215 statenames[INPI] = NULL;
216 statenames[VALUE1] = NULL;
217 statenames[VALUE2] = NULL;
218 statenames[CDATA] = NULL;
219 statenames[ROOT_platform_description] = NULL;
220 statenames[AL_platform_description] = NULL;
221 statenames[S_platform_description] = "platform_description";
222 statenames[S_platform_description_1] = "platform_description";
223 statenames[S_platform_description_2] = "platform_description";
224 statenames[E_platform_description] = "platform_description";
225 statenames[ROOT_include] = NULL;
226 statenames[AL_include] = NULL;
227 statenames[S_include] = "include";
228 statenames[S_include_1] = "include";
229 statenames[S_include_2] = "include";
230 statenames[E_include] = "include";
231 statenames[ROOT_cpu] = NULL;
232 statenames[AL_cpu] = NULL;
233 statenames[E_cpu] = "cpu";
234 statenames[ROOT_network_link] = NULL;
235 statenames[AL_network_link] = NULL;
236 statenames[E_network_link] = "network_link";
237 statenames[ROOT_route] = NULL;
238 statenames[AL_route] = NULL;
239 statenames[S_route] = "route";
240 statenames[S_route_1] = "route";
241 statenames[S_route_2] = "route";
242 statenames[E_route] = "route";
243 statenames[ROOT_route_element] = NULL;
244 statenames[AL_route_element] = NULL;
245 statenames[E_route_element] = "route_element";
246 statenames[ROOT_process] = NULL;
247 statenames[AL_process] = NULL;
248 statenames[S_process] = "process";
249 statenames[S_process_1] = "process";
250 statenames[S_process_2] = "process";
251 statenames[E_process] = "process";
252 statenames[ROOT_argument] = NULL;
253 statenames[AL_argument] = NULL;
254 statenames[E_argument] = "argument";
256 /* COMMENTS and PIs: handled uniformly for efficiency. */
258 <ROOT_platform_description,AL_platform_description,S_platform_description,S_platform_description_1,S_platform_description_2,E_platform_description,ROOT_include,AL_include,S_include,S_include_1,S_include_2,E_include,ROOT_cpu,AL_cpu,E_cpu,ROOT_network_link,AL_network_link,E_network_link,ROOT_route,AL_route,S_route,S_route_1,S_route_2,E_route,ROOT_route_element,AL_route_element,E_route_element,ROOT_process,AL_process,S_process,S_process_1,S_process_2,E_process,ROOT_argument,AL_argument,E_argument,PROLOG,DOCTYPE,EPILOG>{
259 "<!--" ENTER(INCOMMENT);
267 <<EOF>> FAIL("EOF in comment.");
273 <<EOF>> FAIL("EOF in PI (processing instruction).");
276 /* SPACES: skipped uniformly */
278 <ROOT_platform_description,AL_platform_description,S_platform_description,S_platform_description_1,S_platform_description_2,E_platform_description,ROOT_include,AL_include,S_include,S_include_1,S_include_2,E_include,ROOT_cpu,AL_cpu,E_cpu,ROOT_network_link,AL_network_link,E_network_link,ROOT_route,AL_route,S_route,S_route_1,S_route_2,E_route,ROOT_route_element,AL_route_element,E_route_element,ROOT_process,AL_process,S_process,S_process_1,S_process_2,E_process,ROOT_argument,AL_argument,E_argument,PROLOG,DOCTYPE,EPILOG>{S} SKIP;
280 /* PROLOG: determine root element and process it. */
283 "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?"?>" SET(DOCTYPE);
284 "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
288 "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_argument);
289 "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route_element);
290 "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_cpu);
291 "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_include);
292 "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route);
293 "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_platform_description);
294 "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_network_link);
295 "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_process);
296 "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
297 . FAIL("Unexpected character `%c' in prolog.", yytext[0]);
298 <<EOF>> FAIL("EOF in prolog.");
301 /* RULES DERIVED FROM DTD. */
303 /* <!-- Small DTD for SURF based tools. --> */
305 <ROOT_platform_description>"<platform_description"{s} {
306 ENTER(AL_platform_description);
309 <AL_platform_description>{
311 LEAVE; STag_platform_description();pcdata = NULL; ENTER(S_platform_description);
314 LEAVE; STag_platform_description(); pcdata = NULL; ETag_platform_description();
316 case ROOT_platform_description: SET(EPILOG); break;
319 . FAIL("Unexpected character `%c' in attribute list of platform_description element.", yytext[0]);
320 {Name} FAIL("Bad attribute `%s' in `platform_description' element start tag.",yytext);
321 <<EOF>> FAIL("EOF in attribute list of `platform_description' element.");
324 <E_platform_description,S_platform_description_2,S_platform_description>{
325 "</platform_description"{s}">" {
327 ETag_platform_description();
329 case ROOT_platform_description: SET(EPILOG); break;
332 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform_description>' expected.",yytext);
333 . FAIL("Unexpected character `%c': `</platform_description>' expected.",yytext[0]);
334 <<EOF>> FAIL("Premature EOF: `</platform_description>' expected.");
337 <ROOT_include,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<include"{s} {
338 A_include_file = NULL;
343 "file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_include_file);
344 "file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_include_file);
347 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
348 LEAVE; STag_include();pcdata = NULL; ENTER(S_include);
351 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
352 LEAVE; STag_include(); pcdata = NULL; ETag_include();
354 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
355 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
356 case ROOT_include: SET(EPILOG); break;
359 . FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
360 {Name} FAIL("Bad attribute `%s' in `include' element start tag.",yytext);
361 <<EOF>> FAIL("EOF in attribute list of `include' element.");
364 <E_include,S_include,S_include_2>{
369 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
370 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
371 case ROOT_include: SET(EPILOG); break;
374 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
375 . FAIL("Unexpected character `%c': `</include>' expected.",yytext[0]);
376 <<EOF>> FAIL("Premature EOF: `</include>' expected.");
379 <ROOT_cpu,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<cpu"{s} {
382 A_cpu_availability = "1.0";
383 A_cpu_availability_file = NULL;
384 A_cpu_state = A_cpu_state_ON;
385 A_cpu_state_file = NULL;
390 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_name);
391 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_name);
393 "power"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_power);
394 "power"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_power);
396 "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability);
397 "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability);
399 "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability_file);
400 "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability_file);
403 "state"{Eq}"\"ON\"" A_cpu_state = A_cpu_state_ON;
405 "state"{Eq}"\"OFF\"" A_cpu_state = A_cpu_state_OFF;
407 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_state_file);
408 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_state_file);
411 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
412 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
413 LEAVE; STag_cpu();pcdata = NULL; ENTER(E_cpu);
416 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
417 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
418 LEAVE; STag_cpu(); pcdata = NULL; ETag_cpu();
420 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
421 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
422 case ROOT_cpu: SET(EPILOG); break;
425 . FAIL("Unexpected character `%c' in attribute list of cpu element.", yytext[0]);
426 {Name} FAIL("Bad attribute `%s' in `cpu' element start tag.",yytext);
427 <<EOF>> FAIL("EOF in attribute list of `cpu' element.");
435 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
436 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
437 case ROOT_cpu: SET(EPILOG); break;
440 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cpu>' expected.",yytext);
441 . FAIL("Unexpected character `%c': `</cpu>' expected.",yytext[0]);
442 <<EOF>> FAIL("Premature EOF: `</cpu>' expected.");
445 <ROOT_network_link,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<network_link"{s} {
446 A_network_link_name = NULL;
447 A_network_link_bandwidth = NULL;
448 A_network_link_bandwidth_file = NULL;
449 A_network_link_latency = "0.001";
450 A_network_link_latency_file = NULL;
451 A_network_link_state = A_network_link_state_ON;
452 A_network_link_state_file = NULL;
453 ENTER(AL_network_link);
457 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_name);
458 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_name);
460 "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth);
461 "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth);
463 "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth_file);
464 "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth_file);
466 "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency);
467 "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency);
469 "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency_file);
470 "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency_file);
473 "state"{Eq}"\"ON\"" A_network_link_state = A_network_link_state_ON;
475 "state"{Eq}"\"OFF\"" A_network_link_state = A_network_link_state_OFF;
477 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_state_file);
478 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_state_file);
481 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
482 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
483 LEAVE; STag_network_link();pcdata = NULL; ENTER(E_network_link);
486 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
487 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
488 LEAVE; STag_network_link(); pcdata = NULL; ETag_network_link();
490 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
491 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
492 case ROOT_network_link: SET(EPILOG); break;
495 . FAIL("Unexpected character `%c' in attribute list of network_link element.", yytext[0]);
496 {Name} FAIL("Bad attribute `%s' in `network_link' element start tag.",yytext);
497 <<EOF>> FAIL("EOF in attribute list of `network_link' element.");
501 "</network_link"{s}">" {
505 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
506 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
507 case ROOT_network_link: SET(EPILOG); break;
510 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</network_link>' expected.",yytext);
511 . FAIL("Unexpected character `%c': `</network_link>' expected.",yytext[0]);
512 <<EOF>> FAIL("Premature EOF: `</network_link>' expected.");
515 <ROOT_route,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<route"{s} {
518 A_route_impact_on_computation = NULL;
523 "src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_src);
524 "src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_src);
526 "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_dst);
527 "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_dst);
529 "impact_on_computation"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_computation);
530 "impact_on_computation"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_computation);
533 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
534 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
535 LEAVE; STag_route();pcdata = NULL; ENTER(S_route);
538 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
539 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
540 LEAVE; STag_route(); pcdata = NULL; ETag_route();
542 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
543 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
544 case ROOT_route: SET(EPILOG); break;
547 . FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
548 {Name} FAIL("Bad attribute `%s' in `route' element start tag.",yytext);
549 <<EOF>> FAIL("EOF in attribute list of `route' element.");
552 <S_route,S_route_2,E_route>{
557 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
558 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
559 case ROOT_route: SET(EPILOG); break;
562 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
563 . FAIL("Unexpected character `%c': `</route>' expected.",yytext[0]);
564 <<EOF>> FAIL("Premature EOF: `</route>' expected.");
567 <ROOT_route_element,S_route_1,S_route,S_route_2>"<route_element"{s} {
568 A_route_element_name = NULL;
569 ENTER(AL_route_element);
573 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_element_name);
574 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_element_name);
577 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
578 LEAVE; STag_route_element();pcdata = NULL; ENTER(E_route_element);
581 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
582 LEAVE; STag_route_element(); pcdata = NULL; ETag_route_element();
584 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
585 case ROOT_route_element: SET(EPILOG); break;
588 . FAIL("Unexpected character `%c' in attribute list of route_element element.", yytext[0]);
589 {Name} FAIL("Bad attribute `%s' in `route_element' element start tag.",yytext);
590 <<EOF>> FAIL("EOF in attribute list of `route_element' element.");
594 "</route_element"{s}">" {
596 ETag_route_element();
598 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
599 case ROOT_route_element: SET(EPILOG); break;
602 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route_element>' expected.",yytext);
603 . FAIL("Unexpected character `%c': `</route_element>' expected.",yytext[0]);
604 <<EOF>> FAIL("Premature EOF: `</route_element>' expected.");
607 <ROOT_process,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<process"{s} {
608 A_process_host = NULL;
609 A_process_function = NULL;
614 "host"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_host);
615 "host"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_host);
617 "function"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_function);
618 "function"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_function);
621 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
622 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
623 LEAVE; STag_process();pcdata = NULL; ENTER(S_process);
626 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
627 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
628 LEAVE; STag_process(); pcdata = NULL; ETag_process();
630 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
631 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
632 case ROOT_process: SET(EPILOG); break;
635 . FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
636 {Name} FAIL("Bad attribute `%s' in `process' element start tag.",yytext);
637 <<EOF>> FAIL("EOF in attribute list of `process' element.");
640 <S_process,E_process,S_process_2>{
645 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
646 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
647 case ROOT_process: SET(EPILOG); break;
650 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
651 . FAIL("Unexpected character `%c': `</process>' expected.",yytext[0]);
652 <<EOF>> FAIL("Premature EOF: `</process>' expected.");
655 <ROOT_argument,S_process_1,S_process,S_process_2>"<argument"{s} {
656 A_argument_value = NULL;
661 "value"{Eq}\' ENTER(VALUE1); BUFFERSET(A_argument_value);
662 "value"{Eq}\" ENTER(VALUE2); BUFFERSET(A_argument_value);
665 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
666 LEAVE; STag_argument();pcdata = NULL; ENTER(E_argument);
669 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
670 LEAVE; STag_argument(); pcdata = NULL; ETag_argument();
672 case ROOT_argument: SET(EPILOG); break;
673 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
676 . FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
677 {Name} FAIL("Bad attribute `%s' in `argument' element start tag.",yytext);
678 <<EOF>> FAIL("EOF in attribute list of `argument' element.");
686 case ROOT_argument: SET(EPILOG); break;
687 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
690 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
691 . FAIL("Unexpected character `%c': `</argument>' expected.",yytext[0]);
692 <<EOF>> FAIL("Premature EOF: `</argument>' expected.");
695 /* EPILOG: after the root element. */
698 . FAIL("Unexpected character `%c' after document.", yytext[0]);
702 /* CHARACTER DATA. */
704 <IMPOSSIBLE,VALUE1,VALUE2>{
705 /* Non-defined standard entities... */
706 "&" BUFFERPUTC('&');
707 "<" BUFFERPUTC('<');
708 ">" BUFFERPUTC('>');
709 "'" BUFFERPUTC('\'');
710 """ BUFFERPUTC('"');
712 /* Character entities. */
713 "&#"[[:digit:]]+";" BUFFERPUTC((unsigned char)atoi(yytext+2));
714 "&#x"[[:xdigit:]]+";" BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
717 <IMPOSSIBLE,VALUE1,VALUE2,CDATA>{
721 "\n\r" BUFFERPUTC('\n');
725 "<![CDATA[" ENTER(CDATA);
726 "]""]>" FAIL("Unexpected `]""]>' in character data.");
730 \' BUFFERDONE; LEAVE;
731 <<EOF>> FAIL("EOF in literal (\"'\" expected).");
735 \" BUFFERDONE; LEAVE;
736 <<EOF>> FAIL("EOF in literal (`\"' expected).");
739 <IMPOSSIBLE,VALUE1,VALUE2>{
740 [^<&] BUFFERPUTC(yytext[0]);
741 [<&] FAIL("Spurious `%c' in character data.",yytext[0]);
746 "]""]" BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]);
747 . BUFFERPUTC(yytext[0]);
748 <<EOF>> FAIL("EOF in CDATA section.");
751 /* Impossible rules to avoid warnings from flex(1). */
753 <INITIAL,IMPOSSIBLE>{
754 .|[\n] FAIL("The Impossible Happened: INITIAL or IMPOSSIBLE state entered?");
759 /* Element context stack lookup. */
760 int element_context(int i)
762 return (0<i && i<yy_start_stack_depth
763 ? yy_start_stack[yy_start_stack_ptr - i]
768 void print_yy_stack(char* fmt, ...)
770 int i = 0; va_list ap; va_start(ap, fmt);
771 vfprintf(stderr, fmt, ap);
772 for (i=1; i<yy_start_stack_ptr; i++)
773 fprintf(stderr, "%s/", statenames[yy_start_stack[i] ]);
774 fprintf(stderr,"%s\n", statenames[YY_START]);
778 static void debug_enter(int state, const char* statename) {
779 yy_push_state(state);
780 if (yy_flex_debug) print_yy_stack("--ENTER(%s) : ",statename);
783 static void debug_leave(void) {
784 if (yy_flex_debug) print_yy_stack("--LEAVE : ");
788 static void debug_set(int state, const char* statename) {
790 if (yy_flex_debug) print_yy_stack("--SET(%s) : ",statename);
795 static int fail(const char* fmt, ...)
797 va_list ap; va_start(ap, fmt);
798 #ifdef FLEXML_yylineno
799 fprintf(stderr, "Invalid XML (XML input line %d, state %d): ", yylineno, YY_START);
801 fprintf(stderr, "Invalid XML (state %d): ",YY_START);
803 vfprintf(stderr, fmt, ap);
804 fprintf(stderr, "\n");