Commits

Anonymous committed a699a7a

allow (NAME bitstring) in meddle of bitconstruct

Comments (0)

Files changed (2)

     ; bitpacket at tail
     ((_ mode stream handler (NAME bitpacket))
       (bitstring-packet-expand mode stream handler NAME))
+    ; allow in bitconstruct dont type length
+    ((_ "write" stream handler (NAME bitstring) rest ...)
+      (bitstring-pattern-expand "write" stream NAME
+        (bitstring-pattern "write" stream handler rest ...)))
     ; greedy bitstring
     ((_ mode stream handler (NAME bitstring))
       (bitstring-pattern-expand mode stream NAME
 
 (current-test-epsilon .1)
 
+(test-begin "construct bitstring syntax")
+(define foo "\x01")
+(test (bitconstruct (1)(2)) (bitconstruct (foo bitstring) (2)))
+(test (bitconstruct (1)) (bitconstruct (foo bitstring)))
+(test-end)
+
 (test-begin "integer attributes")
 (define bstr (bitstring-of-any "\xff"))
 (test -127 (bitmatch bstr ((x signed) -> x)))