[erlang-questions] Are newlines significant in Erlang grammar?
Wed Dec 21 00:39:51 CET 2011
On Tue, Dec 20, 2011 at 01:33:18PM -0500, Daniel Dormont wrote:
> Actually that's an interesting point. Is there really no other place in the
> Erlang grammar where whitespace is required? My gut instinct tells me there
> must be a few, because every language has a few right? I mean, if nothing
> else to separate two identifiers? But thinking a little more, I realize
> Erlang doesn't have "identifiers" in the sense most other languages do and
> even then, there's always some sort of punctuation. Is this period business
> the only exception?
Erlang has operators that are alphabetic. X orelse Y really does
need the whitespace. And 1.5 is not the same thing as 1 . 5.
Handling whitespace is a job for the lexer. Just ensure that the '.'
<whitespace> sequence produces an end-of-term token instead of some
dot token and treat other unquoted whitespace as a token terminator.
More information about the erlang-questions