Re: Parsing '\x00' -- appears to be the only thing preventing parsing binary data

Stephen Taylor via Users list for the GNU Bison parser generator <[email protected]> Thu, 1 Apr 2021 11:30:00 -0400
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Thanks John, but the whole point is to try to leverage the internal tables and mechanisms that exist in Bison …. In particular the yytranslate[] table…. And to be able to write rules that use *all* the hex codes which flex -8 is supposed to pass along e.g.

R : ‘\x9f’ ‘\xfe’ | ‘\xff’ | ‘\x00’ ;

As well as succinctly express notions such as “any byte” — without listing every possible 8-bit value and having to check against them to accept a byte.


> On Apr 1, 2021, at 11:05, John P. Hartmann <[email protected]> wrote:
> 
> Write your own scanner in C.
> 
> On 4/1/21 16:28, Stephen Taylor via Users list for the GNU Bison parser generator wrote:
>> Thanks, that seems to get around \x00 -- unfortunately, the same issue then reappears with the values \x80 - \xff … I could special case every single value e.g.
>> \x00 {return ZERO; }
>> \x80 { return X80; }
>> \x81 { return X81; }
>>  :
>> \xff { return XFF; }
>> . | \n  { return *yytext; }
>> But seems a bit clumsy. Any thoughts?
smime.p7s (application/pkcs7-signature, 4.7 KB) - not displayed