Fix pre scan menu/if flags

This commit is contained in:
Victor 2015-12-23 14:40:06 +02:00
parent 3ed231e773
commit c9c0cdb32e

View File

@ -603,13 +603,14 @@ Parser.prototype.primary = function() {
Parser.prototype.preScan = function() { Parser.prototype.preScan = function() {
// Сканируем все метки, для быстрого перехода командой jump. // Сканируем все метки, для быстрого перехода командой jump.
// А также определяем параметры для оптимизации. // А также определяем параметры для оптимизации.
for (var i = 0; i < this.tokensCount - 2; i++) { for (var i = 0; i < this.tokensCount; i++) {
var current = this.tokens[i].getType(); var current = this.tokens[i].getType();
if (current === TokenType.ENDMENU) { if (current === TokenType.ENDMENU) {
this.hasEndMenu = true; this.hasEndMenu = true;
} else if (current === TokenType.ENDIF) { } else if (current === TokenType.ENDIF) {
this.hasEndIf = true; this.hasEndIf = true;
} else if ( (current === TokenType.LABEL) && } else if ( (current === TokenType.LABEL) &&
((i + 2) < this.tokensCount) &&
(this.tokens[i + 2].getType() === TokenType.COLON) ) { (this.tokens[i + 2].getType() === TokenType.COLON) ) {
// label word : // label word :
var token = this.tokens[i + 1]; var token = this.tokens[i + 1];