[erlang-questions] erl_scan issues

Vlad Dumitrescu <>
Tue Apr 21 14:15:54 CEST 2015


Hi!

Why should the first whitespace be part of the dot token and not a separate
white_space token? The dot is recognized anyway (and it can also be
followed by a comment, in which case the % character is correctly kept
together with the rest of the comment).

Of course I can handle this case specially, but it feels that it is
unnecessary to have special cases without a meaningful reason. If there is
a reason, I suppose it should be documented in the file, like other
conventions about how the syntax is handled are.

regards,
Vlad


On Tue, Apr 21, 2015 at 2:04 PM, Éric Pailleau <>
wrote:

> Hi.
> I suppose because a dot, as well any further blanks and a newline is the
> normal end of an Erlang term.
> Using scan for another purpose may result in this unespected behaviour.
> Regards
>
>
>
> Le 21 avr. 2015 13:53, Vlad Dumitrescu <> a écrit :
> >
> > Hi!
> >
> > I found some unexpected behaviour for erl_scan and I hope someone can
> shed a light as to if it's supposed to be like that or it's a bug. IMHO the
> latter applies.
> >
> > > erl_scan:string("a. b",{1,1},[return,text]).
> > {ok,[{atom,[{line,1},{column,1},{text,"a"}],a},
> >      {dot,[{line,1},{column,2},{text,". "}]},
> >      {atom,[{line,1},{column,4},{text,"b"}],b}],
> >     {1,5}}
> >
> > In short, the first newline or whitespace after a dot is included in the
> textual representation of the token. Why would anyone have that?
> >
> > regards,
> > Vlad
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150421/c9922142/attachment.html>


More information about the erlang-questions mailing list