Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 467
Viswanadh Kumar Reddy Vuggumud Avatar asked Apr 10 '13 05:04

Viswanadh Kumar Reddy Vuggumud


1 Answers

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.

like image 58
Gunther Avatar answered Nov 14 '22 23:11

Gunther