Skip to content

Instantly share code, notes, and snippets.

View hongzzz's full-sized avatar
:octocat:

hongzzz hongzzz

:octocat:
View GitHub Profile
@lqt0223
lqt0223 / json_parser.js
Created December 27, 2017 09:55
18 JSON parser
// 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) {