Javascript Question

JavaScript: The Good Parts White space railroad diagrams confusing

I have started reading "Javascript: The Good Parts" and I'm having trouble figuring out what the first path in the White space railroad diagram is for.

Kindly clarify me.

The railroad diagram from the book.

Answer

As a "railroad diagram", this has some properties in common with a railroad track.

Upon entering the diagram from the left, when arriving at the first switch, there is no option of going left or right. Just like a railroad switch, the diagram switch has two converging tracks, but no way to pass from one of those to the other.

The switch on the right hand side however, with traffic arriving from the left, provides the options of following either of the diverging routes, effectively ending or repeating the syntax rule.

Thus the diagram defines instances of whitespace to be composed of any positive number of spaces, tabs, line ends, or comments.

Comments