[erlang-patches] Scan "=<<" as something useful

Raimo Niskanen raimo+erlang-patches@REDACTED
Mon Apr 29 10:53:42 CEST 2013


On Sun, Apr 21, 2013 at 10:15:28PM +0200, Anthony Ramine wrote:
> Hello,
> 
> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> b} is rather written as {a,b}. Then there is the occasional Bin=
> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> instead of '=','<<'. This patch teaches erl_scan how to not do that.
> 
> There is no backwards compatibility problem as '=<','<' can't appear
> in valid code.

When I tried to fix this years ago while rewriting the scanner just after
the binary syntax was introduced I got lecutured (I think by Robert)
that it was a bad change because it introduces syntax knowledge
into the scanner.

The scanner is today greedy so it collects as many characters as it
can into a valid token, and "=<" is a valid token.  When it is
followed by "<" that becomes a syntax error in the parser.

I kind of miss this argument this time around...

> 
>         git fetch https://github.com/nox/otp.git disambiguate-equal-binary
> 
>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
> 
> Regards,
> 
> --
> Anthony Ramine
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-patches mailing list