On 04/06/13 17:21, Bruno Medeiros wrote: > On 02/04/2013 00:18, Brian Schott wrote: >> I've pretty much finished up my work on the std.d.lexer module. I am >> waiting for the review queue to make some progress on the other (three?) >> modules being reviewed before starting a thread on it. >> > > BTW, even in the lexer spec I've found an issue. How does this parse: > 5.blah > According to the spec (maximal munch technique), it should be FLOAT then > IDENTIFIER. But DMD parses it as INTEGER DOT IDENTIFIER. I'm assuming the > lastest is the correct behavior, so you can write stuff like 123.init, but > that should be clarified.
"1..2", "1.ident" and a float literal with '_' after the '.' are the DecimalFloat cases that I immediately ran into when doing a lexer based on the dlang grammar. It's obvious to a human how these should be handled, but code generators aren't that smart... But they are good at catching mistakes like these. Actually, that last case is even more "interesting"; http://dlang.org/lex.html has "1_2_3_4_5_6_._5_6_7_8" as a valid example, which of course it's not ("_5_6_7_8" is a valid identifier), but there is no reason do disallow "1_2_3_4_5_6_.5_6_7_8". > that should be clarified. These are just grammar bugs, that could easily be fixed. Then there are some things that can be less obvious, but shouldn't really be controversial like allowing empty HexString literals. Then there's the enhancement category. Looking through my comments, I think the only deliberate change from dlang.org that I have is in DelimitedString -- there is no reason to forbid q"/abc/def/"; there are no back-compat issues, as it couldn't have existed in legacy D code. artur