projects
/
lambda.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[lambda.git]
/
code
/
parse.js
diff --git
a/code/parse.js
b/code/parse.js
index
6882d79
..
e3940b4
100644
(file)
--- a/
code/parse.js
+++ b/
code/parse.js
@@
-4,6
+4,9
@@
// http://javascript.crockford.com/tdop/index.html
// Douglas Crockford 2010-06-26
// 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
*/
/*jslint onevar: false
*/
@@
-65,6
+68,7
@@
var make_parse = function () {
}
};
}
};
+ /*
try {
if (console && console.debug) {
function print() {
try {
if (console && console.debug) {
function print() {
@@
-72,6
+76,7
@@
var make_parse = function () {
}
}
} catch (e) {}
}
}
} catch (e) {}
+ */
var symbol = function (id) {
var s = symbol_table[id];
var symbol = function (id) {
var s = symbol_table[id];
@@
-228,9
+233,11
@@
var make_parse = function () {
return t;
} else {
t.first = [];
return t;
} else {
t.first = [];
- while (token.arity === "name") {
- t.first.push(n);
- n = token;
+ while (token.arity === "name" || token.id === "\\") {
+ if (token.id !== "\\") {
+ t.first.push(n);
+ n = token;
+ }
advance();
}
if (token.arity === "literal" && t.first.length === 0) {
advance();
}
if (token.arity === "literal" && t.first.length === 0) {