# HG changeset patch # User Atul Varma # Date 1243715300 25200 # Node ID 559378a3ec26f3641ea04c1c246c996c44d9cbbc # Parent f174153281a9e891da06e20bca3c47f9b42c4775 renamed computeSelf and computeLeft to nullDenotation and leftDenotation. diff -r f174153281a9 -r 559378a3ec26 jsparser.js --- a/jsparser.js Sat May 30 13:23:01 2009 -0700 +++ b/jsparser.js Sat May 30 13:28:20 2009 -0700 @@ -9,11 +9,11 @@ Parsing.Symbol.prototype = { leftBindingPower: 0, - computeSelf: function() { - throw new Error("No computeSelf for " + this.name); + nullDenotation: function() { + throw new Error("No nullDenotation for " + this.name); }, - computeLeft: function() { - throw new Error("No computeLeft for " + this.name); + leftDenotation: function() { + throw new Error("No leftDenotation for " + this.name); }, extend: function(contents) { function Subclass() {} @@ -47,13 +47,13 @@ }; Parsing.BinaryOrUnaryOp.prototype = new Parsing.Symbol( - {computeSelf: function(parser) { + {nullDenotation: function(parser) { var unaryOp = this.extend(Parsing.UnaryOperator.prototype); - return unaryOp.computeSelf(parser); + return unaryOp.nullDenotation(parser); }, - computeLeft: function(parser, left) { + leftDenotation: function(parser, left) { var binaryOp = this.extend(Parsing.BinaryOperator.prototype); - return binaryOp.computeLeft(parser, left); + return binaryOp.leftDenotation(parser, left); } }); @@ -62,7 +62,7 @@ }; Parsing.UnaryOperator.prototype = new Parsing.Symbol( - {computeSelf: function(parser) { + {nullDenotation: function(parser) { this.arity = "unary"; this.operand = parser.token; parser.advance(); @@ -78,7 +78,7 @@ }; Parsing.BinaryOperator.prototype = new Parsing.Symbol( - {computeLeft: function(parser, left) { + {leftDenotation: function(parser, left) { this.arity = "binary"; this.leftOperand = left; this.rightOperand = parser.expression(this.leftBindingPower); @@ -148,11 +148,11 @@ this.expression = function expression(rightBindingPower) { var leftToken = self.token; self.advance(); - var leftValue = leftToken.computeSelf(self); + var leftValue = leftToken.nullDenotation(self); while (rightBindingPower < self.token.leftBindingPower) { leftToken = self.token; self.advance(); - leftValue = leftToken.computeLeft(self, leftValue); + leftValue = leftToken.leftDenotation(self, leftValue); } return leftValue; }; @@ -175,7 +175,7 @@ new Parsing.Symbol({name: 'number', match: /^[0-9]+/, - computeSelf: function() { + nullDenotation: function() { return this; }, toString: function() {