This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a coding exercise of implementing a parser. Some minor parsing capabilities are not implemented. | |
// The algorithm are mainly from Douglas Crockford's 'https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js' | |
function json_parse(str) { | |
var i = 0 | |
var ch = str[i] | |
// core function that recursively called to move forward scanning pointers and accept tokens | |
function next(c) { | |
if (c) { |