import java.util.*; import java.io.*; import edu.neu.ccs.demeter.dj.*; //****************************************************************************** // Basic definitions //****************************************************************************** Main = . List(S) ~ { + *l S -}. //****************************************************************************** // PART 1: Definitions of structures implementing the components of the input // XML schema specification //****************************************************************************** Schema = "<" [ NSRef ] "schema" List(AttrValue) ">" List(SchemaItem) " NSRef ] "schema>" *EOF*. NSRef = Ident ":". AttrValue = [ lookahead (@2@) NSRef ] Ident "=" String. SchemaItem : lookahead (@4@) Annotation | lookahead (@4@) Attribute | lookahead (@4@) ElementItem | lookahead (@4@) TypeDef | Comment . Annotation = "<" [ NSRef ] "annotation>" List(AnnotationContent) " NSRef ] "annotation>". AnnotationContent : lookahead (@4@) Appinfo | lookahead (@4@) Documentation. Appinfo = "<" [ NSRef ] "appinfo>" List(AttrValue) " NSRef ] "appinfo>". Documentation = "<" [ NSRef ] "documentation" List(AttrValue) RestOfDocumentation. RestOfDocumentation : EmptyDocumentation | NonEmptyDocumentation. EmptyDocumentation = "/>". NonEmptyDocumentation = ">" [ String ] " NSRef ] "documentation>". Attribute = "<" [ NSRef ] "attribute" List(AttrValue) RestOfAttribute. RestOfAttribute : EmptyAttribute | NonEmptyAttribute. EmptyAttribute = "/>". NonEmptyAttribute = ">" [ lookahead (@4@) Annotation ] " NSRef ] "attribute>". Element = "<" [ NSRef ] "element" List(AttrValue) RestOfElement. RestOfElement : EmptyElement | NonEmptyElement. EmptyElement = "/>". NonEmptyElement = ">" [ lookahead (@4@) Annotation ] [ lookahead (@4@) TypeDef ] " NSRef ] "element>". TypeDef : lookahead (@4@) SimpleType | lookahead (@4@) ComplexType. SimpleType = "<" [ NSRef ] "simpleType" List(AttrValue) ">" [ lookahead (@4@) Annotation ] " NSRef ] "simpleType>". ComplexType = "<" [ NSRef ] "complexType" List(AttrValue) ">" [ lookahead (@4@) Annotation ] ComplexTypeContent List(Attribute) " NSRef ] "complexType>". ComplexTypeContent = [ lookahead (@4@) ElementItem ]. ElementItem : lookahead (@4@) Element | lookahead (@4@) SequenceGroup . SequenceGroup = "<" [ NSRef ] "sequence" List(AttrValue) ">" [ lookahead (@4@) Annotation ] List(ElementItem) " NSRef ] "sequence>". Comment = "".