D - How to resolve "cch" ambiguity
- Russ Lewis <spamhole-2001-07-16 deming-os.org> Apr 11 2002
- Russ Lewis <spamhole-2001-07-16 deming-os.org> Apr 11 2002
- "Walter" <walter digitalmars.com> Apr 11 2002
- Russ Lewis <spamhole-2001-07-16 deming-os.org> Apr 11 2002
- Russell Borogove <kaleja estarcion.com> Apr 11 2002
- "Pavel Minayev" <evilone omen.ru> Apr 11 2002
- "Walter" <walter digitalmars.com> Apr 11 2002
When lexically parsing D, how do you decide if the string "cch" is an identifer (possible type, function, or variable name) or the hex value 0xcc? -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Apr 11 2002
We might want to debate whether "hex suffix" even makes sense. Frankly, I've found hex suffixes make it really hard to tell (at a glance) that the thing is a number and not an obscure variable name. -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Apr 11 2002
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3CB626D5.A9829740 deming-os.org...When lexically parsing D, how do you decide if the string "cch" is an identifer (possible type, function, or variable name) or the hex value 0xcc?
'cch' is an identifier. '0cch' would be a hex value.
Apr 11 2002
Walter wrote:"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3CB626D5.A9829740 deming-os.org...When lexically parsing D, how do you decide if the string "cch" is an identifer (possible type, function, or variable name) or the hex value 0xcc?
'cch' is an identifier. '0cch' would be a hex value.
But it doesn't have to start with 0, right? I was looking at math2.d line 1299 (still from version 0.25, iirc), and it has the constant 1A2h which I understood to mean 0x1A2 right? -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Apr 11 2002
Russ Lewis wrote:Walter wrote:"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3CB626D5.A9829740 deming-os.org...When lexically parsing D, how do you decide if the string "cch" is an identifer (possible type, function, or variable name) or the hex value 0xcc?
But it doesn't have to start with 0, right? I was looking at math2.d line 1299 (still from version 0.25, iirc), and it has the constant 1A2h which I understood to mean 0x1A2 right?
I think it has to start with a digit for the parser's benefit; the leading zero is only necessary if the hex representation leads with an alpha character. Though what was wrong with good old 0xCC, I don't know. --the other other Russell
Apr 11 2002
"Russell Borogove" <kaleja estarcion.com> wrote in message news:3CB64AC1.8010402 estarcion.com...I think it has to start with a digit for the parser's benefit; the leading zero is only necessary if the hex representation leads with an alpha character.
It seems so. By the way, it is exactly how assemblers with Intel syntax parse hex numbers: 1000h - correct A000h - invalid 0A000h - correct
Apr 11 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:a95mdc$7ak$1 digitaldaemon.com..."Russell Borogove" <kaleja estarcion.com> wrote in message news:3CB64AC1.8010402 estarcion.com...I think it has to start with a digit for the parser's benefit; the leading zero is only necessary if the hex representation leads with an alpha character.
Yes.It seems so. By the way, it is exactly how assemblers with Intel syntax parse hex numbers: 1000h - correct A000h - invalid 0A000h - correct
That's why it's in there <g>.
Apr 11 2002









Russ Lewis <spamhole-2001-07-16 deming-os.org> 