Optimized Lexer_getObj 2x faster
This commit is contained in:
parent
806aa36aa8
commit
37c9765ab4
@ -755,19 +755,19 @@ var Lexer = (function LexerClosure() {
|
|||||||
// command
|
// command
|
||||||
var str = String.fromCharCode(ch);
|
var str = String.fromCharCode(ch);
|
||||||
var knownCommands = this.knownCommands;
|
var knownCommands = this.knownCommands;
|
||||||
var knownCommandFound = knownCommands && (str in knownCommands);
|
var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
|
||||||
while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
|
while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
|
||||||
// stop if known command is found and next character does not make
|
// stop if known command is found and next character does not make
|
||||||
// the str a command
|
// the str a command
|
||||||
var possibleCommand = str + String.fromCharCode(ch);
|
var possibleCommand = str + String.fromCharCode(ch);
|
||||||
if (knownCommandFound && !(possibleCommand in knownCommands)) {
|
if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (str.length === 128) {
|
if (str.length === 128) {
|
||||||
error('Command token too long: ' + str.length);
|
error('Command token too long: ' + str.length);
|
||||||
}
|
}
|
||||||
str = possibleCommand;
|
str = possibleCommand;
|
||||||
knownCommandFound = knownCommands && (str in knownCommands);
|
knownCommandFound = knownCommands && knownCommands[str] !== undefined;
|
||||||
}
|
}
|
||||||
if (str === 'true') {
|
if (str === 'true') {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user