A lexical change (a breaking change, but trivial to fix)

Alex Rønne Petersen alex at lycus.org
Sat Jul 7 14:41:43 PDT 2012


On 07-07-2012 23:39, Mehrdad wrote:
> This might sound silly, but how about if D stopped allowing 0..2  as a
> range, and instead just said "invalid floating-point number"?
>
> Fixing it en masse would be pretty trivial... just run a regex to replace
>      "\b(\d+)\.\."
> with
>      "\1 .. "
> and you're good to go.
>
> (Or if you want more accuracy, just take the compiler output and feed it
> back with a fix -- that would work too.)
>
> The benefit, though, is that now you can do maximal munch without
> worrying about this edge case... which sure makes it easier to make a
> lexer.
>
> Thoughts?

... why is this even done at the lexical stage? It should be done at the 
parsing stage if anything.

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org




More information about the Digitalmars-d mailing list