Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

BUG in parse? - working with binaries

 [1/3] from: oliva::david::seznam::cz at: 5-Nov-2001 23:54


BUG in parse? - working with binaries ===================================== Hi there, I was trying to parse some binaries (hacking the SWF files to learn the structure) and I've found that there is probably bug in the parse function... Try this example to see it: ;---------------------------------- str1: to-string #{010065D0A3066B19500100} str2: "1234567890" chars: complement charset [] parse str1 [copy val 2 chars (probe val print length? val) to end] parse str2 [copy val 2 chars (probe val print length? val) to end] ;---------------------------------- If I understand it well, the length of 'val should be 2 in both examples, but it is not:-( BTW: working with binaries is not so nice as it could be I think... cheers Oldes

 [2/3] from: brett:codeconscious at: 6-Nov-2001 11:02


Hi If you're going to parse binary you must use /all refinement on parse. If you don't use /all refinement parse will define some whitespace characters which are automatically matched. It has been enlightening to see your example - I hadn't realised the effect on copy before of this. Thanks! Here's a modified example: chars: charset {123} parse {1 2 3 a b c} [copy part-of-input some chars] print mold part-of-input Cheers, Brett.

 [3/3] from: greggirwin:mindspring at: 5-Nov-2001 17:07


Hi Oldes, I think you'll be OK if you use parse/all. --Gregg