Last active
August 29, 2015 14:14
-
-
Save opaopa6969/008f09f16b00d5d66577 to your computer and use it in GitHub Desktop.
BinarySchema.rnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" | |
start = BinarySchema | |
BinarySchema = | |
element BinarySchema { | |
attribute name { xsd:token }, | |
(Blocks | |
& BlockDefinitions? | |
& TypeDefinitions? | |
& FunctionDefinitions?), | |
Annotation? | |
} | |
Blocks = element Blocks { Block+ } | |
Block = | |
RepeatBlock | |
| element Block { | |
attribute id { xsd:ID }, | |
StoreSpecifier?, | |
(Block | |
| (element BlockRef { | |
attribute refId { xsd:IDREF } | |
} | |
| attribute blockRefs { xsd:IDREFS }) | |
| Stores)*, | |
Annotation? | |
} | |
BlockDefinitions = element BlockDefinitions { Block+ } | |
TypeDefinitions = element Types { TypeDefinition+ } | |
TypeDefinition = | |
element Type { | |
(attribute id { xsd:ID }, | |
StoreSpecifier), | |
Annotation?, | |
immediate?, | |
attribute bindingType { | |
"boolean" | |
| "byte" | |
| "short" | |
| "char" | |
| "int" | |
| "long" | |
| "float" | |
| "double" | |
| "BigDecimal" | |
| "BitSet" | |
| "String" | |
| "Collection" | |
| xsd:token | |
}?, | |
element contents { Store }? | |
} | |
immediate = | |
element immediateValue { text } | |
| attribute immediateValue { xsd:token } | |
| attribute of { xsd:IDREF } | |
| element immediateValue { | |
(attribute ifMatch { xsd:IDREF } | |
| attribute ifNotMatch { xsd:IDREF } | |
| element ifMatch { Predicate }), | |
(attribute of { xsd:IDREF } | |
| text) | |
}+ | |
Stores = Store+ | |
Store = | |
RepeatStore | |
| element Store { | |
attribute typeRef { xsd:IDREF }, | |
attribute id { xsd:ID }?, | |
Annotation?, | |
immediate? | |
} | |
StoreSpecifier = | |
attribute storeType { | |
"fixedBit" | "fixedByte" | "variableBit" | "variableByte" | |
}, | |
(attribute size { xsd:int } | |
| attribute sizeOf { xsd:IDREF })? | |
RepeatStore = | |
element Repeat { | |
((attribute min { xsd:integer }?, | |
attribute max { xsd:integer }?) | |
| attribute of { xsd:IDREF }), | |
# car | |
element first { Store+ }?, | |
# cdr | |
Store+, | |
element last { Store+ }? | |
} | |
RepeatBlock = | |
element Repeat { | |
((attribute min { xsd:integer }?, | |
attribute max { xsd:integer }?) | |
| attribute of { xsd:IDREF }), | |
(# car | |
element FirstOfRepeat { Block+ }? | |
& # cdr | |
Block+ | |
& element LastOfRepeat { Block+ }? | |
& element MatchCondition { Block+ }?) | |
} | |
Predicate = | |
element Predicate { | |
(attribute functions { xsd:IDREFS }? | |
| Predicate+), | |
attribute operator { | |
"and" | "or" | "xor" | "nand" | "nor" | "xnor" | |
}, | |
Annotation? | |
} | |
Annotation = | |
element Annotation { | |
attribute type { xsd:token }?, | |
text | |
}+ | |
FunctionDefinitions = element Functions { Function+ } | |
Function = | |
element Function { | |
attribute id { xsd:ID }, | |
attribute contextRef { xsd:IDREF }?, | |
attribute returningTypeRef { xsd:IDREF }, | |
Annotation? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment