Binary Document Literal

The binary document literal is always of type Document.

BinaryDocumentLiteral:
BinaryDocumentDeclarator [ComplexLiteralInputChars]
BinaryDocumentDeclarator [Expression]
BinaryDocumentDeclarator:
any case for BIN

Binary document literals are used to represent a document located in memory using a hexadecimal text representation of the binary data.

The ComplexLiteralInputChars can include the [ character as long as it has a balanced number of ] characters; one for every [ character found.

If the sequence of characters can be parsed to an Expression of type (byte[]), then the resulting document is a binary document where the expression specifies the content of the document.

If the sequence of characters cannot be parsed properly as described above, then it is considered to be whole binary content of the document represented in hexadecimal form where each hexadecimal character represents one nibble of data.

Example Binary Document Literals:

BIN[cafebabe34f3edca56b8001cdef]
BIN[myArrayOfBytes]