Parse jump
This commit is contained in:
parent
4a7f2a8f88
commit
debec57bbd
@ -19,6 +19,12 @@ Parser.prototype.getInstance = function () {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Parser.prototype.jumpLabel = function (label) {
|
||||||
|
if (label in this.labels) {
|
||||||
|
this.position = this.labels[label];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Parser.prototype.next = function () {
|
Parser.prototype.next = function () {
|
||||||
this.lastPosition = this.position;
|
this.lastPosition = this.position;
|
||||||
|
|
||||||
@ -63,7 +69,7 @@ Parser.prototype.statement = function() {
|
|||||||
if (this.match(token, TokenType.SHOW)) return this.show();
|
if (this.match(token, TokenType.SHOW)) return this.show();
|
||||||
if (this.match(token, TokenType.HIDE)) return this.hide();
|
if (this.match(token, TokenType.HIDE)) return this.hide();
|
||||||
|
|
||||||
// if (this.match(token, TokenType.JUMP)) return this.jump();
|
if (this.match(token, TokenType.JUMP)) return this.jump();
|
||||||
// if (this.match(token, TokenType.IF)) return this.ifStatement();
|
// if (this.match(token, TokenType.IF)) return this.ifStatement();
|
||||||
|
|
||||||
/*if (this.lookMatch(1, TokenType.COLON)) {
|
/*if (this.lookMatch(1, TokenType.COLON)) {
|
||||||
@ -317,6 +323,12 @@ Parser.prototype.playAmbience = function() {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Parser.prototype.jump = function() {
|
||||||
|
var labelName = this.consume(TokenType.WORD).getText();
|
||||||
|
this.jumpLabel(labelName);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
Parser.prototype.expression = function() {
|
Parser.prototype.expression = function() {
|
||||||
return this.orTest();
|
return this.orTest();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user