On Saturday, 16 June 2018 at 06:43:25 UTC, Meta wrote:
On Saturday, 16 June 2018 at 00:24:42 UTC, DigitalDesigns wrote:
space is ignored! Seems like a bug std . traits . std . string is valid?

Like most C-family languages, D is a freeform language[1]. Funnily enough, I don't think this is explicitly stated in the D spec (at least not that I could find). It's just assumed, because D is an evolution of C, C++, and Java primarily, all of which are freeform languages.

From the Language → Lexical docs:

"The lexical analysis is independent of the syntax parsing and the semantic analysis. The lexical analyzer splits the source text up into tokens. The lexical grammar describes the syntax of those tokens."

"The source text is decoded from its source representation into Unicode Characters. The Characters are further divided into: WhiteSpace, EndOfLine, Comments, SpecialTokenSequences, Tokens, all followed by EndOfFile."

So a source file contains a number of things, some of them tokens. The tokenizer produces a series of tokens from it. The parser deals with those tokens. This doesn't state that whitespace is ignored; instead, it says that the language only pays attention to tokens (and, by implication, not whitespace, or comments, or the end of the file, etc).

Reply via email to