title: Finite State Machine parsing
body: <p><a href="http://en.wikipedia.org/wiki/File:Fsm_parsing_word_nice.svg" rel="noreferrer">This</a> picture depicts finite state machine parsing "nice" string.</p>
  
  <p>The question is how would it look like in JS code?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Picture from link above:</p>
  
  <p><img src="https://i.stack.imgur.com/gYfEf.png" alt="finite state machine parsing"></p>