X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=code%2Fparse.js;h=e911aa42e59bc3fd882249d3d677bd25787866fd;hp=6882d79f6d7a170a9dc5b71d74767a7dccd3f334;hb=466e57fc9e1c65c5b8c092ca8be03a4c69031f16;hpb=fee1f7831003a7edee103dd7999b390abc7583c8;ds=sidebyside diff --git a/code/parse.js b/code/parse.js index 6882d79f..e911aa42 100644 --- a/code/parse.js +++ b/code/parse.js @@ -4,6 +4,9 @@ // http://javascript.crockford.com/tdop/index.html // Douglas Crockford 2010-06-26 +// See also http://effbot.org/zone/simple-top-down-parsing.htm + + /*jslint onevar: false */ @@ -65,6 +68,7 @@ var make_parse = function () { } }; + /* try { if (console && console.debug) { function print() { @@ -72,6 +76,7 @@ var make_parse = function () { } } } catch (e) {} + */ var symbol = function (id) { var s = symbol_table[id]; @@ -228,8 +233,8 @@ var make_parse = function () { return t; } else { t.first = []; - while (token.arity === "name") { - t.first.push(n); + while (token.arity === "name" || token.id === "\\") { + if (token.id !== "\\") {t.first.push(n);} n = token; advance(); }