Re: Parser bug: if missing ", " in list between records, the first is ignored, and no parser warnings are given.

Vlad Dumitrescu <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAA-EFXsP_1ntPbsQt=Tsia6BiL2usRt3KeXRxSYiJvyvNcwyjw@mail.gmail.com>
Hi Mattias,

This isn't a bug. The expression #rec{a=2}#rec{b=3} is legal, and is the
same thing as (#rec{a=2})#rec{b=3} or #rec{a=2,b=3}. If the keys overlap,
then the last one "wins".

best regards,
Vlad


On Thu, Nov 6, 2014 at 9:21 AM, Mattias Waldau <[email protected]>
wrote:

>  This is the program
>
> -module('missing-comma-not-detected').
>
> -export([data/1]).
>
> -compile(export_all).
>
> -record(shcnode, {
>       nodename :: any(),
>       y_axis :: number(),
>       children :: [any()],
>       article_number :: number(),
>       attribute_condition :: string()}).
>
>
> data(1) ->
>     [
>      #shcnode{nodename = start, y_axis = 0, children = [d1285]},
>      #shcnode{nodename = d1285, y_axis = 295, children = [1939, 1940]}
>      #shcnode{nodename = 1940, y_axis = 525, children = [bm3203],
> article_number = 14432861},
>      #shcnode{nodename = 1939, y_axis = 530, children = [bm3203],
> article_number = 14432860},
>      #shcnode{nodename = bm3203, y_axis = 915, children = []}
>     ].
>
>
> Note the missing "," after  [1939, 1940]}
>
> Only 4 rows are detected
>
> length('missing-comma-not-detected':data(1)).
> 4
>
> ---
>
> If I add the comma, I get
>
> length('missing-comma-not-detected':data(1)).
> 5
>
> ----
>
> I am using Erlang 17.3 on ubuntu.
>
> erlang:system_info(otp_release).
> "17"
>
> 36>  erl -V
> Eshell V6.2  (abort with ^G)
> 1>
>
> ---
>
> Thanks,
>
> Mattias
>
>
>
>
> _______________________________________________
> erlang-bugs mailing list
> [email protected]
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.