SGF FF[4] parser in javascript