Fix for A=<<1>>

Raimo Niskanen raimo.niskanen@REDACTED
Mon May 5 09:12:55 CEST 2003

I have just rewritten the scanner for R9C to make it twice as fast, and 
the reentrancy issues you worry about has been solved in that rewrite 

About the '=<<' problem I was just about to fix that when I checked with 
the other guys, and this is the problem.

How should the scanner interpret '=<<<' as in "if A =< <<1,2>>" without 
spaces; that's easy:  '=<' '<<'.

But since sub-binaries are allowed when constructing: how about '=<<<<<' 
as in "if A =< << <<1>>/binary, 2>>", then one can see that the scanning 
of '=<<' depends on if the number of '<' characters following is odd or 
even, so the scanner might have to scan infinitely ahead. A look ahead 
scan of limited small length would be fine, but this is ugly.

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

James Hague wrote:
>>What I observed in erl_scan.erl is that this kind of
>>cheating is already done when matching "<<", ">>", ">=",
>>"->", etc.
> I thought the same thing, and I wouldn't have even tried to special-case
> "=<<" if there already hadn't been support in the same function for
> multi-character tokens like "=<".  But I agree with your concern, and I'm
> curious how those are handled properly by erl_scan.

More information about the erlang-questions mailing list