[dox] Fixing the lexical rule for BinaryInteger

Andre Artus andre.artus at gmail.com
Sat Aug 17 17:19:56 PDT 2013


[...]

For fun I made a scanner rule that forces BinaryInteger to 
conform to a power of 2 grouping of nibbles. I think it loses 
it's clarity after 16 bits.

I made the underscore optional between nibbles, but required for 
groups of 2 bytes and above.

Some passing cases from my test inputs.

0b00010001
0b0001_0001
0b00010001_0001_0001
0b00010001_00010001
0b0001_0001_00010001
0b00010001_00010001
0b00010001_00010001_00010001_00010001
0b00010001_00010001_00010001_00010001_00010001_00010001_00010001_00010001
0b00010001_00010001_00010001_00010001_00010001_0001_0001_00010001_00010001_00010001_00010001_00010001_00010001_00010001_00010001_00010001_00010001

It loses some of the value of arbitrary grouping specifically the 
ability to group bits in a bitmask by function.


More information about the Digitalmars-d mailing list