namespace o = "http://www.o-xml.org/lang/" start = Declaration | Literal Declaration = Program | Function | Procedure | Type | Choose | If | While | ForEach | Return | Variable | Set | Log | Eval | Do | Element | Attribute | Text | Comment | ProcessingInstruction | Document | Throw | Catch | Assert | Thread Instruction = Declaration | Literal | text | Import # Import should be removed from instruction set in # future version, should only be allowed in Program content ## a literal is any non o:XML element Literal = element * - o:* { (attribute * { text } | text | Instruction ) * } ## an Annotation is any non o:XML element used to annotate the source Annotation = element * - o:* { (attribute * { text } | text | anyElement ) * } anyElement = element * { (attribute * { text } | text | anyElement)* } Program = element o:program { attribute space { 'ignore' | 'preserve' } ?, attribute comments { 'ignore' | 'preserve' } ?, Param *, Import *, Instruction * } Param = element o:param { attribute name { text }, attribute type { QName } ?, attribute select { Expr } ?, empty } Parent = element o:parent { attribute name { text }, attribute select { Expr } ?, empty } QName = text Expr = text MixedExpr = text URI = text Import = element o:import { attribute href { URI }, empty } Procedure = element o:procedure { attribute name { QName }, Param*, Annotation*, Do } Function = element o:function { attribute name { QName }, attribute type { QName } ?, attribute access { 'public' | 'protected' | 'private' } ?, Param*, Annotation*, Parent*, Do, Annotation* } Type = element o:type { attribute name { QName } & Parent* & Variable* & Function* & Annotation* } Choose = element o:choose { When*, Otherwise? } When = element o:when { attribute test { Expr }, Instruction* } Otherwise = element o:otherwise { Instruction* } If = element o:if { attribute test { Expr }, Instruction* } While = element o:while { attribute test { Expr }, Instruction* } ForEach = element o:for-each { ( ( attribute in { Expr }, attribute delim { Expr } ? ) | ( attribute to { Expr }, attribute from { Expr } ?, attribute step { Expr } ? ) | attribute select { Expr } ), attribute name { QName } ?, Instruction* } Return = element o:return { ( attribute select { Expr }, empty ) | Instruction* } Variable = element o:variable { attribute name { QName }, attribute type { QName } ?, ( attribute select { Expr } | Instruction* ) } Set = element o:set { attribute * - o:* { Expr }* } Log = element o:log { attribute level { 'error' | 'warning' | 'info' | 'debug' }?, ( ( attribute select { Expr }, empty ) | ( attribute msg { MixedExpr }, empty ) | Instruction* ) } Eval = element o:eval { attribute select { Expr }, empty } Do = element o:do { ( attribute select { Expr }, empty ) | Instruction* } Element = element o:element { attribute name { MixedExpr }, attribute namespace { MixedExpr } ?, Instruction* } Attribute = element o:attribute { attribute name { MixedExpr }, attribute namespace { MixedExpr } ?, ( attribute select { Expr } | Instruction* ) } Text = element o:text { text } Comment = element o:comment { text } ProcessingInstruction = element o:processing-instruction { attribute target { MixedExpr }, ( attribute select { Expr } | Instruction* ) } Document = element o:document { Instruction* } Throw = element o:throw { ( attribute select { Expr }, empty ) | Instruction* } Catch = element o:catch { attribute handler { Expr } ?, attribute exceptions { text } ?, Instruction* } Assert = element o:assert { attribute test { Expr }, attribute msg { MixedExpr } ?, Instruction* } Thread = element o:thread { attribute priority { Expr } ?, attribute daemon { "true" | "false" | MixedExpr } ?, Instruction* }