Add the Binary data type and corresponding helper functions to Asterix.
The binary data type is implemented as a bytearray. Its storage format
follows the String type which has 2 bytes for length and then store the
bytes contents.
Binary data will take hex("") or base64("") as the constructor method to
passing a hex string or base64 string into Asterix. For output we use
hex("") format.
The parse-[hex|base64](string) function will parse the corresponding hex
or base64 string to binary type. The print-[hex|base64](binary)
functions will print the binary to hex or base64 STRING format.
The sub-binary(binary, offset, [length]) function works the same as
substring(string, offset, [length])
The find-binary(srcbinary, targetbinary, [start-offset]) will find the
position of the targetbinary in the srcbinary.
Change-Id: I5ecf0cc115c44070fb5c1fc5b0ec12a95d4243a4
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/175
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterix-runtime/src/main/resources/adm.grammar b/asterix-runtime/src/main/resources/adm.grammar
index b9db2e7..b0ca26f 100644
--- a/asterix-runtime/src/main/resources/adm.grammar
+++ b/asterix-runtime/src/main/resources/adm.grammar
@@ -19,6 +19,8 @@
DATETIME_CONS = string(datetime)
DURATION_CONS = string(duration)
STRING_CONS = string(string)
+HEX_CONS = string(hex)
+BASE64_CONS = string(base64)
POINT_CONS = string(point)
POINT3D_CONS = string(point3d)
LINE_CONS = string(line)