add parser util addExtra method

This commit is contained in:
Sebastian McKenzie 2015-09-15 06:19:35 +01:00
parent fbda587964
commit 4996e6bc7f

View File

@ -8,6 +8,15 @@ const pp = Parser.prototype;
// TODO
pp.addExtra = function (node, key, val) {
if (!node) return;
var extra = node.extra = node.extra || {};
extra[key] = val;
};
// TODO
pp.isRelational = function (op) {
return this.match(tt.relational) && this.state.value === op;
};