Last active
August 29, 2015 14:14
-
-
Save opaopa6969/eae035b56b4c04001933 to your computer and use it in GitHub Desktop.
BinarySchema.rng
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
<?xml version="1.0" encoding="UTF-8"?> | |
<grammar xmlns="http://relaxng.org/ns/structure/1.0" | |
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" | |
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> | |
<start> | |
<ref name="BinarySchema"/> | |
</start> | |
<define name="BinarySchema"> | |
<element name="BinarySchema"> | |
<attribute name="name"> | |
<data type="token"/> | |
</attribute> | |
<interleave> | |
<ref name="Blocks"/> | |
<optional> | |
<ref name="BlockDefinitions"/> | |
</optional> | |
<optional> | |
<ref name="TypeDefinitions"/> | |
</optional> | |
<optional> | |
<ref name="FunctionDefinitions"/> | |
</optional> | |
</interleave> | |
<optional> | |
<ref name="Annotation"/> | |
</optional> | |
</element> | |
</define> | |
<define name="Blocks"> | |
<element name="Blocks"> | |
<oneOrMore> | |
<ref name="Block"/> | |
</oneOrMore> | |
</element> | |
</define> | |
<define name="Block"> | |
<choice> | |
<ref name="RepeatBlock"/> | |
<element name="Block"> | |
<attribute name="id"> | |
<data type="ID"/> | |
</attribute> | |
<optional> | |
<ref name="StoreSpecifier"/> | |
</optional> | |
<zeroOrMore> | |
<choice> | |
<ref name="Block"/> | |
<choice> | |
<element name="BlockRef"> | |
<attribute name="refId"> | |
<data type="IDREF"/> | |
</attribute> | |
</element> | |
<attribute name="blockRefs"> | |
<data type="IDREFS"/> | |
</attribute> | |
</choice> | |
<ref name="Stores"/> | |
</choice> | |
</zeroOrMore> | |
<optional> | |
<ref name="Annotation"/> | |
</optional> | |
</element> | |
</choice> | |
</define> | |
<define name="BlockDefinitions"> | |
<element name="BlockDefinitions"> | |
<oneOrMore> | |
<ref name="Block"/> | |
</oneOrMore> | |
</element> | |
</define> | |
<define name="TypeDefinitions"> | |
<element name="Types"> | |
<oneOrMore> | |
<ref name="TypeDefinition"/> | |
</oneOrMore> | |
</element> | |
</define> | |
<define name="TypeDefinition"> | |
<element name="Type"> | |
<group> | |
<attribute name="id"> | |
<data type="ID"/> | |
</attribute> | |
<ref name="StoreSpecifier"/> | |
</group> | |
<optional> | |
<ref name="Annotation"/> | |
</optional> | |
<optional> | |
<ref name="immediate"/> | |
</optional> | |
<optional> | |
<attribute name="bindingType"> | |
<choice> | |
<value>boolean</value> | |
<value>byte</value> | |
<value>short</value> | |
<value>char</value> | |
<value>int</value> | |
<value>long</value> | |
<value>float</value> | |
<value>double</value> | |
<value>BigDecimal</value> | |
<value>BitSet</value> | |
<value>String</value> | |
<value>Collection</value> | |
<data type="token"/> | |
</choice> | |
</attribute> | |
</optional> | |
<optional> | |
<element name="contents"> | |
<ref name="Store"/> | |
</element> | |
</optional> | |
</element> | |
</define> | |
<define name="immediate"> | |
<choice> | |
<element name="immediateValue"> | |
<text/> | |
</element> | |
<attribute name="immediateValue"> | |
<data type="token"/> | |
</attribute> | |
<attribute name="of"> | |
<data type="IDREF"/> | |
</attribute> | |
<oneOrMore> | |
<element name="immediateValue"> | |
<choice> | |
<attribute name="ifMatch"> | |
<data type="IDREF"/> | |
</attribute> | |
<attribute name="ifNotMatch"> | |
<data type="IDREF"/> | |
</attribute> | |
<element name="ifMatch"> | |
<ref name="Predicate"/> | |
</element> | |
</choice> | |
<choice> | |
<attribute name="of"> | |
<data type="IDREF"/> | |
</attribute> | |
<text/> | |
</choice> | |
</element> | |
</oneOrMore> | |
</choice> | |
</define> | |
<define name="Stores"> | |
<oneOrMore> | |
<ref name="Store"/> | |
</oneOrMore> | |
</define> | |
<define name="Store"> | |
<choice> | |
<ref name="RepeatStore"/> | |
<element name="Store"> | |
<attribute name="typeRef"> | |
<data type="IDREF"/> | |
</attribute> | |
<optional> | |
<attribute name="id"> | |
<data type="ID"/> | |
</attribute> | |
</optional> | |
<optional> | |
<ref name="Annotation"/> | |
</optional> | |
<optional> | |
<ref name="immediate"/> | |
</optional> | |
</element> | |
</choice> | |
</define> | |
<define name="StoreSpecifier"> | |
<attribute name="storeType"> | |
<choice> | |
<value>fixedBit</value> | |
<value>fixedByte</value> | |
<value>variableBit</value> | |
<value>variableByte</value> | |
</choice> | |
</attribute> | |
<optional> | |
<choice> | |
<attribute name="size"> | |
<data type="int"/> | |
</attribute> | |
<attribute name="sizeOf"> | |
<data type="IDREF"/> | |
</attribute> | |
</choice> | |
</optional> | |
</define> | |
<define name="RepeatStore"> | |
<element name="Repeat"> | |
<choice> | |
<group> | |
<optional> | |
<attribute name="min"> | |
<data type="integer"/> | |
</attribute> | |
</optional> | |
<optional> | |
<attribute name="max"> | |
<data type="integer"/> | |
</attribute> | |
</optional> | |
</group> | |
<attribute name="of"> | |
<data type="IDREF"/> | |
</attribute> | |
</choice> | |
<!--car--> | |
<optional> | |
<element name="first"> | |
<oneOrMore> | |
<ref name="Store"/> | |
</oneOrMore> | |
</element> | |
</optional> | |
<!--cdr--> | |
<oneOrMore> | |
<ref name="Store"/> | |
</oneOrMore> | |
<optional> | |
<element name="last"> | |
<oneOrMore> | |
<ref name="Store"/> | |
</oneOrMore> | |
</element> | |
</optional> | |
</element> | |
</define> | |
<define name="RepeatBlock"> | |
<element name="Repeat"> | |
<choice> | |
<group> | |
<optional> | |
<attribute name="min"> | |
<data type="integer"/> | |
</attribute> | |
</optional> | |
<optional> | |
<attribute name="max"> | |
<data type="integer"/> | |
</attribute> | |
</optional> | |
</group> | |
<attribute name="of"> | |
<data type="IDREF"/> | |
</attribute> | |
</choice> | |
<interleave> | |
<!--car--> | |
<optional> | |
<element name="FirstOfRepeat"> | |
<oneOrMore> | |
<ref name="Block"/> | |
</oneOrMore> | |
</element> | |
</optional> | |
<!--cdr--> | |
<oneOrMore> | |
<ref name="Block"/> | |
</oneOrMore> | |
<optional> | |
<element name="LastOfRepeat"> | |
<oneOrMore> | |
<ref name="Block"/> | |
</oneOrMore> | |
</element> | |
</optional> | |
<optional> | |
<element name="MatchCondition"> | |
<oneOrMore> | |
<ref name="Block"/> | |
</oneOrMore> | |
</element> | |
</optional> | |
</interleave> | |
</element> | |
</define> | |
<define name="Predicate"> | |
<element name="Predicate"> | |
<choice> | |
<optional> | |
<attribute name="functions"> | |
<data type="IDREFS"/> | |
</attribute> | |
</optional> | |
<oneOrMore> | |
<ref name="Predicate"/> | |
</oneOrMore> | |
</choice> | |
<attribute name="operator"> | |
<choice> | |
<value>and</value> | |
<value>or</value> | |
<value>xor</value> | |
<value>nand</value> | |
<value>nor</value> | |
<value>xnor</value> | |
</choice> | |
</attribute> | |
<optional> | |
<ref name="Annotation"/> | |
</optional> | |
</element> | |
</define> | |
<define name="Annotation"> | |
<oneOrMore> | |
<element name="Annotation"> | |
<optional> | |
<attribute name="type"> | |
<data type="token"/> | |
</attribute> | |
</optional> | |
<text/> | |
</element> | |
</oneOrMore> | |
</define> | |
<define name="FunctionDefinitions"> | |
<element name="Functions"> | |
<oneOrMore> | |
<ref name="Function"/> | |
</oneOrMore> | |
</element> | |
</define> | |
<define name="Function"> | |
<element name="Function"> | |
<attribute name="id"> | |
<data type="ID"/> | |
</attribute> | |
<optional> | |
<attribute name="contextRef"> | |
<data type="IDREF"/> | |
</attribute> | |
</optional> | |
<attribute name="returningTypeRef"> | |
<data type="IDREF"/> | |
</attribute> | |
<optional> | |
<ref name="Annotation"/> | |
</optional> | |
</element> | |
</define> | |
</grammar> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment