<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns:pu="http://www.eclipse.org/hyades/schema/ProcessUnit.xsd"
    xmlns:parser="http://www.eclipse.org/hyades/schema/Parser.xsd"
    targetNamespace="http://www.eclipse.org/hyades/schema/Parser.xsd">
    
    <xsd:annotation>
		<xsd:documentation xml:lang="en">
		Copyright (c) 2003 Hyades project.
		All rights reserved.   This program and the accompanying materials
		are made available under the terms of the Common Public License v1.0
		which accompanies this distribution, and is available at
		http://www.eclipse.org/legal/cpl-v10.html
			
		This document describes the format for representation of parser rules
		which can be consumed by the generic parser component.
		*********************************************************************
		Change History:
		31 Oct 2003 - Richard K Duggan initial implementation 
		10 Nov 2003 - Richard K Duggan general fixes for id's
		*********************************************************************
		</xsd:documentation>
	</xsd:annotation>
    <xsd:import
		namespace="http://www.eclipse.org/hyades/schema/ProcessUnit.xsd"
		schemaLocation="ProcessUnit.xsd" />

	<xsd:complexType name="ParserConfigType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
			This is the root element discription.  All the parser
			rules are hierachicaly arranged under this element.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element
				name="RuleElement"
				type="parser:RuleElementType"
				maxOccurs="unbounded"
				minOccurs="0" />
		</xsd:sequence>
		<xsd:attributeGroup ref="pu:ProcessUnitAttributes" />
		<xsd:attribute name="separatorToken" type="xsd:string" use="optional"/>
		<xsd:attribute name="designationToken" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:complexType name="RuleElementType">
		<xsd:annotation>
			<xsd:documentation>
			RuleElementTypes are meta descriptors for any structured types.
			The structured type must have a name and it contains an optional
			set of attributes. Structured types may be nested under other
			structured types. 
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="RuleElement"
				type="parser:RuleElementType"
				minOccurs="0"
				maxOccurs="unbounded"/>
			<xsd:element name="RuleAttribute"
				type="parser:RuleAttributeType"
				minOccurs="0"
				maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string" use="required"/>
		<xsd:attribute name="id" type="xsd:integer" use="optional"/>
		<xsd:attribute name="index" type="xsd:string" use="optional"/>
	</xsd:complexType>
	
	<xsd:element name="RuleElement" type="parser:RuleElementType"/>
	
	<xsd:complexType name="RuleAttributeType">
		<xsd:annotation>
			<xsd:documentation>
			RuleAttributeTypes describe the attributes of a structured type.
			Attributes have a name and a value as well as a set of rules that
			are used to create a value for the attribute.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="SubstitutionRule" 
					minOccurs="1"
					maxOccurs="unbounded">
				<xsd:complexType>
					<xsd:attribute name="positions" type="xsd:string" />
					<xsd:attribute name="match" type="xsd:string" />
					<xsd:attribute name="substitute" type="xsd:string" />
					<xsd:attribute name="useBuiltInFunction" type="xsd:boolean" />
				</xsd:complexType>
			</xsd:element>		
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string" use="required"/>
		<xsd:attribute name="id" type="xsd:integer" use="optional"/>
		<xsd:attribute name="index" type="xsd:string" use="optional"/>
		<xsd:attribute name="usePreviousMatchSubstitutionAsDefault" type="xsd:boolean" />
	</xsd:complexType>

	<xsd:element name="RuleAttribute" type="parser:RuleAttributeType"/>	

</xsd:schema>