5 Stream.from begin function
15 match Stream.peek stream with
24 with Stream.Failure ->
27 let rec repeat n f stream =
31 match stream with parser
33 c::repeat (n-1) f stream
35 raise (Stream.Error "invalid format")
37 let repeat_l n f stream =
38 repeat (Int32.to_int n) f stream
46 [< count = ui16; xs = repeat count (pair ui16 str) >] ->
55 | [< _ = tag 9; c = rgb >]->
57 | [< _ = tag 43; name = str; anchor = option (tag 1) >] ->
58 `FrameLabel (name,anchor <> None)
61 | [< _ = tag 56; xs = alist >] ->
63 | [< _ = tag 57; url = str; xs = alist >] ->
64 `ImportAssets (url,xs)
65 | [< _ = tag 58; passwd = str >] ->
66 `EnableDebugger passwd
67 | [< _ = tag 64; _ = ui16; passwd = str >] ->
68 `EnableDebugger2 passwd
69 | [< _ = tag 65; max_rec = ui16; timeout = ui16 >] ->
70 `ScriptLimits (max_rec, timeout)
71 | [< _ = tag 66; depth = ui16; index = ui16 >] ->
72 `SetTabIndex (depth, index)
73 | [< _ = tag 69; (is_metadata, is_as3, use_network) = bits ~f:parser
74 [< _ = ub 3; is_metadata = bit_bool 1; is_as3 = bit_bool 1; _ = ub 2; use_network = bit_bool 1; _ = ub 24 >] ->
75 (is_metadata, is_as3, use_network) >] ->
77 `FileAttributes { is_metadata; is_as3; use_network }
78 | [< _ = tag 71; url = str; _ = ui8; _ = ui8; xs = alist >] ->
79 `ImportAssets2 (url,xs)
80 | [< _ = tag 76; xs = alist >] ->
82 | [< _ = tag 77; s = str >] ->
84 | [< _ = tag 78; id = ui16; (left,right,top,bottom) = rect >] ->
86 `DefineScalingGrid (id, {left;right;top;bottom})
88 scene_count = eui32; xs = repeat_l scene_count (pair eui32 str);
89 frame_count = eui32; ys = repeat_l frame_count (pair eui32 str); >] ->
90 `DefineSceneAndFrameLabelData (xs, ys)
94 failwith "unknown tag"