move static field from Lexer to hidden namespace

This commit is contained in:
Misko Hevery 2010-08-18 17:34:14 -07:00
parent 5ddd8d9586
commit 9632c99b0a

View file

@ -6,7 +6,7 @@ function Lexer(text, parsStrings){
this.index = 0; this.index = 0;
} }
Lexer.OPERATORS = { OPERATORS = {
'null':function(self){return _null;}, 'null':function(self){return _null;},
'true':function(self){return true;}, 'true':function(self){return true;},
'false':function(self){return false;}, 'false':function(self){return false;},
@ -31,7 +31,7 @@ Lexer.OPERATORS = {
'|':function(self, a,b){return b(self, a);}, '|':function(self, a,b){return b(self, a);},
'!':function(self, a){return !a;} '!':function(self, a){return !a;}
}; };
Lexer.ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'}; ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
Lexer.prototype = { Lexer.prototype = {
peek: function() { peek: function() {
@ -44,7 +44,6 @@ Lexer.prototype = {
parse: function() { parse: function() {
var tokens = this.tokens; var tokens = this.tokens;
var OPERATORS = Lexer.OPERATORS;
var canStartRegExp = true; var canStartRegExp = true;
while (this.index < this.text.length) { while (this.index < this.text.length) {
var ch = this.text.charAt(this.index); var ch = this.text.charAt(this.index);
@ -149,7 +148,7 @@ Lexer.prototype = {
} }
this.index++; this.index++;
} }
var fn = Lexer.OPERATORS[ident]; var fn = OPERATORS[ident];
if (!fn) { if (!fn) {
fn = getterFn(ident); fn = getterFn(ident);
fn.isAssignable = ident; fn.isAssignable = ident;
@ -173,7 +172,7 @@ Lexer.prototype = {
this.index += 4; this.index += 4;
string += String.fromCharCode(parseInt(hex, 16)); string += String.fromCharCode(parseInt(hex, 16));
} else { } else {
var rep = Lexer.ESCAPE[ch]; var rep = ESCAPE[ch];
if (rep) { if (rep) {
string += rep; string += rep;
} else { } else {