Fix for A=<<1>>

James Hague james@REDACTED
Fri May 2 05:31:56 CEST 2003


That the start of  "A=<<1>>" is incorrectly tokenized into A, =<, < 
has always bothered me, so here's a patch for erl_scan.erl that fixes 
it.  Special casing this in the scanner is a bit grotty, but it's 
better than having a special case in the documentation.

I'm posting this here instead of erlang-patches to see if anyone can 
come up with a reason why this is a bad idea (besides being an odd 
special case).

(Apologies for the manual patch, BTW.)

James


After:

%% Punctuation characters and operators, first recognise multiples.

insert:

%% The first clause looks for "=<<" and splits it into "=","<<" so
%% matches like "=<<1>>" aren't tokenized as "=<","<".
scan1([$=,$<,$<|Cs], Toks, Pos) ->
    scan1(Cs, [{'<<',Pos},{'=',Pos}|Toks], Pos);




More information about the erlang-questions mailing list