typo in erl_scan.erl?

Raimo Niskanen raimo@REDACTED
Wed Jan 12 14:41:20 CET 2005


No, it is not a typo.

The first three clauses takes care of 2-char operators with a 
leading "<", the fourth clause takes care of the case when the
currently buffered data ends with "<". Then there might come
other interesting characters after, e.g "=". The function
more/7 is called which reads more characters into the buffer
and tail recursively eventually gets back to scan/6 to match
the third clause for "<=". The leading comment tried to
make a hint in this direction.

The "<" operator is taken care of with all other one-character
operators on line 275..277:

275 %% All single-char punctuation characters and operators (except '.')
276 scan([C|Cs], Stack, Toks, Pos, State, Errors) ->
277     scan(Cs, Stack, [{list_to_atom([C]),Pos}|Toks], Pos, State, Errors);

This means that all otherwise unrecognized single characters is
interpreted as one-character operators.



ulf.wiger@REDACTED (Ulf Wiger AL/EAB) writes:

> The function erl_scan:scan/6 (OTP R10B-2) seems to contain a typo.
> Consider the first argument of the fourth clause below (line 221 in the source).
> 
> Surely it should be "<" ++ Cs ?!!!
> 
> /Uffe
> 
> %% Punctuation characters and operators, first recognise multiples.
> %% Clauses are rouped by first character (a short with the same head has
> %% to come after a longer).
> %%
> %% << <- <=
> scan("<<"++Cs, Stack, Toks, Pos, State, Errors) ->
>     scan(Cs, Stack, [{'<<',Pos}|Toks], Pos, State, Errors);
> scan("<-"++Cs, Stack, Toks, Pos, State, Errors) ->
>     scan(Cs, Stack, [{'<-',Pos}|Toks], Pos, State, Errors);
> scan("<="++Cs, Stack, Toks, Pos, State, Errors) ->
>     scan(Cs, Stack, [{'<=',Pos}|Toks], Pos, State, Errors);
> scan("<"=Cs, Stack, Toks, Pos, State, Errors) ->
>     more(Cs, Stack, Toks, Pos, State, Errors, fun scan/6);

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list