<?xml version="1.0" encoding="utf-8"?>

<!--
	description: "Eiffel Ant RelaxNG specification"
	system: "Gobo Eiffel Ant"
	copyright: "Copyright (c) 2002, Sven Ehrke and others"
	license: "Eiffel Forum License v2 (see forum.txt)"
	date: "$Date: 2005/02/27 17:34:55 $"
	revision: "$Revision: 1.24 $"
-->

<grammar xmlns="http://relaxng.org/ns/structure/1.0">
	<start>

<!-- project -->

		<element name="project">
			<attribute name="name"/>
			<optional>
				<attribute name="default"/>
			</optional>

			<ref name="description"/>
			<choice>
				<optional>
					<attribute name="inherit"/>
				</optional>
				<optional>
					<element name="inherit">
						<oneOrMore>
							<element name="parent">
								<attribute name="location"/>
								<zeroOrMore>
									<element name="rename">
										<attribute name="target"/>
										<attribute name="as"/>
									</element>
								</zeroOrMore>
								<zeroOrMore>
									<element name="redefine">
										<attribute name="target"/>
									</element>
								</zeroOrMore>
								<zeroOrMore>
									<element name="select">
										<attribute name="target"/>
									</element>
								</zeroOrMore>
							</element>
						</oneOrMore>
					</element>
				</optional>
			</choice>

			<oneOrMore>
				<ref name="target"/>
			</oneOrMore>
		</element>
	</start>

<!-- target -->

	<define name="target">
		<element name="target">
			<optional>
				<element name="obsolete">
					<text/>
				</element>
			</optional>
			<zeroOrMore>
				<element name="argument">
					<attribute name="name"/>
				</element>
			</zeroOrMore>
			<ref name="description"/>
			<attribute name="name"/>
			<optional>
				<attribute name="once"/>
			</optional>
			<optional>
				<attribute name="depend"/>
			</optional>
			<ref name="dir_if_unless"/>
			<ref name="tasks"/>
		</element>
	</define>

	<define name="tasks">
		<zeroOrMore>
			<choice>
				<ref name="available"/>
				<ref name="copy"/>
				<ref name="echo"/>
				<ref name="delete"/>
				<ref name="exec"/>
				<ref name="exit"/>
				<ref name="geant"/>
				<ref name="gelex"/>
				<ref name="geyacc"/>
				<ref name="gepp"/>
				<ref name="getest"/>
				<ref name="gexace"/>
				<ref name="gexmlsplit"/>
				<ref name="ise"/>
				<ref name="mkdir"/>
				<ref name="move"/>
				<ref name="outofdate"/>
				<ref name="precursor"/>
				<ref name="se"/>
				<ref name="set"/>
				<ref name="setenv"/>
				<ref name="unset"/>
				<ref name="ve"/>
				<ref name="xslt"/>
			</choice>
		</zeroOrMore>
	</define>

<!-- tasks -->

	<define name="available">
		<element name="available">
			<ref name="dir_if_unless"/>
			<attribute name="resource"/>
			<attribute name="variable"/>
			<optional>
				<attribute name="true_value"/>
			</optional>
			<optional>
				<attribute name="false_value"/>
			</optional>
		</element>
	</define>

	<define name="copy">
		<element name="copy">
			<ref name="dir_if_unless"/>
			<choice>
				<group>
					<attribute name="file"/>
					<attribute name="to_file"/>
				</group>
				<group>
					<attribute name="file"/>
					<attribute name="to_directory"/>
				</group>
				<group>
					<attribute name="to_directory"/>
					<ref name="fileset"/>
				</group>
			</choice>
			<optional>
				<attribute name="force">
					<!-- runtime evaluation
					<choice>
						<value>true</value>
						<value>false</value>
					</choice>
					-->
				</attribute>
			</optional>
		</element>
	</define>
	<define name="delete">
		<element name="delete">
			<ref name="dir_if_unless"/>
			<choice>
				<attribute name="file"/>
				<attribute name="directory"/>
				<ref name="fileset"/>
			</choice>
		</element>
	</define>
	<define name="echo">
		<element name="echo">
			<ref name="dir_if_unless"/>
			<choice>
				<text/>
				<attribute name="message"/>
			</choice>
			<optional>
				<attribute name="to_file"/>
				<optional>
					<attribute name="append"/>
				</optional>
			</optional>
		</element>
	</define>
	<define name="exec">
		<element name="exec">
			<ref name="dir_if_unless"/>
			<attribute name="executable"/>
			<optional>
				<attribute name="exit_code_variable"/>
			</optional>
			<optional>
				<attribute name="accept_errors">
					<!-- runtime evaluation
					<choice>
						<value>true</value>
						<value>false</value>
					</choice>
					-->
				</attribute>
			</optional>
			<optional>
				<ref name="fileset"/>
			</optional>
		</element>
	</define>
	<define name="exit">
		<element name="exit">
			<ref name="dir_if_unless"/>
			<optional>
				<attribute name="code"/>
			</optional>
		</element>
	</define>
	<define name="geant">
		<element name="geant">
			<ref name="dir_if_unless"/>
			<optional>
				<choice>
					<attribute name="arguments"/>
					<zeroOrMore>
						<element name="argument">
							<attribute name="name"/>
							<attribute name="value"/>
						</element>
					<zeroOrMore>
				</choice>
			</optional>
			<choice>
				<attribute name="target"/>
				<group>
					<attribute name="file"/>
					<optional>
						<attribute name="reuse_variables">
							<!-- runtime evaluation
							<choice>
								<value>true</value>
								<value>false</value>
							</choice>
							-->
						</attribute>
					</optional>
					<optional>
						<ref name="fileset"/>
					</optional>
				</group>
				<group>
					<attribute name="file"/>
					<attribute name="target"/>
					<optional>
						<attribute name="reuse_variables">
							<!-- runtime evaluation
							<choice>
								<value>true</value>
								<value>false</value>
							</choice>
							-->
						</attribute>
					</optional>
					<optional>
						<ref name="fileset"/>
					</optional>
				</group>
				<ref name="fileset"/>
			</choice>
		</element>
	</define>
	<define name="gelex">
		<element name="gelex">
			<ref name="dir_if_unless"/>
			<attribute name="input"/>
			<optional>
				<attribute name="output"/>
			</optional>
			<optional>
				<attribute name="backup"/>
			</optional>
			<optional>
				<attribute name="size"/>
			</optional>
			<optional>
				<attribute name="ecs"/>
			</optional>
			<choice>
				<optional>
					<attribute name="full"/>
				</optional>
				<optional>
					<attribute name="meta_ecs"/>
				</optional>
			</choice>
			<optional>
				<attribute name="case_insensitive"/>
			</optional>
			<optional>
				<attribute name="no_default"/>
			</optional>
			<optional>
				<attribute name="no_warn"/>
			</optional>
			<optional>
				<attribute name="separate_actions"/>
			</optional>
		</element>
	</define>
	<define name="geyacc">
		<element name="geyacc">
			<ref name="dir_if_unless"/>
			<attribute name="input"/>
			<optional>
				<attribute name="output"/>
			</optional>
			<optional>
				<attribute name="tokens"/>
			</optional>
			<optional>
				<attribute name="separate_actions"/>
			</optional>
			<optional>
				<attribute name="verbose"/>
			</optional>
		</element>
	</define>
	<define name="gepp">
		<element name="gepp">
			<ref name="dir_if_unless"/>
			<interleave>
				<choice>
					<group>
						<attribute name="input"/>
						<attribute name="output"/>
					</group>
					<ref name="fileset"/>
				</choice>
				<zeroOrMore>
					<element name="define">
						<ref name="if_unless"/>
						<attribute name="name"/>
					</element>
				</zeroOrMore>
			</interleave>
			<optional>
				<attribute name="to_directory"/>
			</optional>
			<optional>
				<attribute name="lines"/>
			</optional>
		</element>
	</define>
	<define name="getest">
		<element name="getest">
			<ref name="dir_if_unless"/>
			<attribute name="config"/>
			<optional>
				<attribute name="compile"/>
			</optional>
			<optional>
				<attribute name="class"/>
			</optional>
			<optional>
				<attribute name="feature"/>
			</optional>
			<optional>
				<attribute name="generation"/>
			</optional>
			<optional>
				<attribute name="compilation"/>
			</optional>
			<optional>
				<attribute name="execution"/>
			</optional>
			<optional>
				<attribute name="abort"/>
			</optional>
			<optional>
				<attribute name="verbose"/>
			</optional>
			<zeroOrMore>
				<ref name="define"/>
			</zeroOrMore>
		</element>
	</define>
	<define name="gexace">
		<element name="gexace">
			<ref name="dir_if_unless"/>
			<choice>
				<attribute name="validate"/>
				<attribute name="system">
					<!-- runtime evaluation
					<choice>
						<value>ise</value>
						<value>se</value>
						<value>ve</value>
						<value>xml</value>
					</choice>
					-->
				</attribute>
				<choice>
					<attribute name="cluster">
						<!-- Note: this attribute is obsolete. Use attribute 'library' instead -->
						<!-- runtime evaluation
						<choice>
							<value>ise</value>
							<value>se</value>
							<value>ve</value>
							<value>xml</value>
						</choice>
						-->
					</attribute>
					<attribute name="library">
						<!-- runtime evaluation
						<choice>
							<value>ise</value>
							<value>se</value>
							<value>ve</value>
							<value>xml</value>
						</choice>
						-->
					</attribute>
				</choice>
			</choice>
			<optional>
				<attribute name="verbose"/>
			</optional>
			<optional>
				<attribute name="xace"/>
			</optional>
			<optional>
				<attribute name="output"/>
			</optional>
			<zeroOrMore>
				<ref name="define"/>
			</zeroOrMore>
		</element>
	</define>
	<define name="gexmlsplit">
		<element name="gexmlsplit">
			<ref name="dir_if_unless"/>
			<attribute name="input"/>
		</element>
	</define>
	<define name="ise">
		<element name="ise">
			<ref name="dir_if_unless"/>
			<optional>
				<attribute name="exit_code_variable"/>
			</optional>
			<choice>
				<group>
					<attribute name="system"/>
					<optional>
						<attribute name="ace"/>
					</optional>
					<optional>
						<attribute name="finalize"/>
					</optional>
					<optional>
						<attribute name="finish_freezing"/>
					</optional>
				</group>
				<attribute name="clean"/>
			</choice>
		</element>
	</define>
	<define name="mkdir">
		<element name="mkdir">
			<ref name="dir_if_unless"/>
			<attribute name="directory"/>
		</element>
	</define>
	<define name="move">
		<element name="move">
			<ref name="dir_if_unless"/>
			<choice>
				<group>
					<attribute name="file"/>
					<attribute name="to_file"/>
				</group>
				<group>
					<attribute name="file"/>
					<attribute name="to_directory"/>
				</group>
				<group>
					<attribute name="to_directory"/>
					<ref name="fileset"/>
				</group>
			</choice>
		</element>
	</define>
	<define name="outofdate">
		<element name="outofdate">
			<ref name="dir_if_unless"/>
			<choice>
				<group>
					<attribute name="source"/>
					<attribute name="target"/>
				</group>
				<ref name="fileset"/>
			</choice>
			<attribute name="variable"/>
			<optional>
				<attribute name="true_value"/>
			</optional>
			<optional>
				<attribute name="false_value"/>
			</optional>
		</element>
	</define>
	<define name="precursor">
		<element name="precursor">
			<optional>
				<choice>
					<attribute name="arguments"/>
					<zeroOrMore>
						<element name="argument">
							<attribute name="name"/>
							<attribute name="value"/>
						</element>
					<zeroOrMore>
				</choice>
			</optional>
			<optional>
				<attribute name="parent"/>
			</optional>
			<text/>
		</element>
	</define>
	<define name="se">
		<element name="se">
			<ref name="dir_if_unless"/>
			<optional>
				<attribute name="exit_code_variable"/>
			</optional>
			<choice>
				<attribute name="clean"/>
				<attribute name="ace"/>
				<group>
					<attribute name="root_class"/>
					<attribute name="executable"/>
					<optional>
						<attribute name="creation_procedure"/>
					</optional>
					<optional>
						<attribute name="case_insensitive"/>
					</optional>
					<optional>
						<attribute name="no_style_warning"/>
					</optional>
				</group>
			</choice>
		</element>
	</define>
	<define name="set">
		<element name="set">
			<ref name="dir_if_unless"/>
			<attribute name="name"/>
			<attribute name="value"/>
		</element>
	</define>
	<define name="setenv">
		<element name="setenv">
			<ref name="dir_if_unless"/>
			<attribute name="name"/>
			<attribute name="value"/>
		</element>
	</define>
	<define name="unset">
		<element name="unset">
			<ref name="dir_if_unless"/>
			<attribute name="name"/>
		</element>
	</define>
	<define name="ve">
		<element name="ve">
			<ref name="dir_if_unless"/>
			<optional>
				<attribute name="exit_code_variable"/>
			</optional>
			<choice>
				<attribute name="xace"/>
				<attribute name="esd"/>
				<group>
					<attribute name="clean"/>
					<optional>
						<attribute name="recursive"/>
					</optional>
				</group>
				<group>
					<attribute name="tune"/>
					<optional>
						<attribute name="level">
							<!-- runtime evaluation
							<choice>
								<value>large</value>
								<value>huge</value>
							</choice>
							-->
						</attribute>
					</optional>
				</group>
			</choice>
		</element>
	</define>
	<define name="xslt">
		<element name="xslt">
			<ref name="dir_if_unless"/>
			<attribute name="input"/>
			<attribute name="output"/>
			<attribute name="stylesheet"/>
			<optional>
				<attribute name="processor">
					<!-- runtime evaluation
					<choice>
						<value>xalan_cpp</value>
						<value>xalan_java</value>
						<value>xsltproc</value>
					</choice>
					-->
				</attribute>
			</optional>
			<optional>
				<attribute name="indent"/> <!-- if attribute 'processor' equals 'xalan_java' or 'xalan_cpp'-->
			</optional>
			<optional>
				<attribute name="format"/> <!-- if attribute 'processor' equals 'xalan_java' -->
			</optional>
			<zeroOrMore>
				<element name="parameter">
					<attribute name="name"/>
					<attribute name="value"/>
				</element>
			</zeroOrMore>
			<optional>
				<attribute name="extdirs"/> <!-- if attribute 'processor' equals 'xalan_java' -->
			</optional>
			<optional>
				<attribute name="classpath"/> <!-- if attribute 'processor' equals 'xalan_java' -->
			</optional>
		</element>
	</define>

<!-- elements -->

	<define name="fileset">
		<element name="fileset">
			<ref name="dir_if_unless"/>
			<attribute name="include"/>
			<optional>
				<attribute name="exclude"/>
			</optional>
			<optional>
				<attribute name="force">
					<!-- runtime evaluation
					<choice>
						<value>true</value>
						<value>false</value>
					</choice>
					-->
				</attribute>
			</optional>
			<optional>
				<attribute name="filename_directory"/>
			</optional>
			<optional>
				<attribute name="mapped_filename_directory"/>
			</optional>
			<zeroOrMore>
				<element name="include">
					<attribute name="name"/>
				</element>
			</zeroOrMore>
			<zeroOrMore>
				<element name="exclude">
					<attribute name="name"/>
				</element>
			</zeroOrMore>
			<optional>
				<ref name="map"/>
			</optional>
		</element>
	</define>
	<define name="map">
		<element name="map">
			<attribute name="type">
				<!-- runtime evaluation
				<choice>
					<value>identity</value>
					<value>flat</value>
					<value>merge</value>
					<value>glob</value>
				</choice>
				-->
			</attribute>
			<optional>
				<attribute name="from"/>
				<attribute name="to"/>
			</optional>
			<optional>
				<ref name="map"/>
			</optional>
		</element>
	</define>
	<define name="define">
		<element name="define">
			<ref name="if_unless"/>
			<attribute name="name"/>
			<attribute name="value"/>
		</element>
	</define>

<!-- common -->

	<define name="description">
		<optional>
			<element name="description">
				<text/>
			</element>
		</optional>
	</define>
	<define name="dir_if_unless">
		<optional>
			<attribute name="dir"/>
		</optional>
		<ref name="if_unless"/>
	</define>
	<define name="if_unless">
		<optional>
			<attribute name="if"/>
		</optional>
		<optional>
			<attribute name="unless"/>
		</optional>
	</define>

</grammar>