Interesting user mistake
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 4 10:17:26 PDT 2015
On 09/03/2015 01:08 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Sep 03, 2015 at 12:46:29PM -0400, Andrei Alexandrescu via Digitalmars-d wrote:
>> http://stackoverflow.com/questions/32369114/leap-years-not-working-in-date-and-time-program-in-dlang
>>
>> The gist of it is the user wrote =+ instead of +=. I wonder if we
>> should disallow during tokenization the sequence "=", "+", whitespace.
>> Surely it's not a formatting anyone would aim for, but instead a
>> misspelling of +=.
> [...]
>
> Is there a way for the lexer to check for the specific character
> sequence '=', '+', whitespace and not others (e.g. '=', whitespace,
> '+')? IOW, "a =+ b" will be prohibited, but "a = + b" will be allowed.
> If so, I agree with this.
Yah, space is relevant there. That's why the check is easiest done
during tokenization. -- Andrei
More information about the Digitalmars-d
mailing list