diff --git a/public_html/js/Parser.js b/public_html/js/Parser.js
index 20dcbbb..98de96b 100644
--- a/public_html/js/Parser.js
+++ b/public_html/js/Parser.js
@@ -51,6 +51,26 @@ Parser.prototype.next = function () {
} while (!terminal);
};
+Parser.prototype.prevScene = function() {
+ // Для перехода к предыдущей сцене, следует два раза найти токен SCENE,
+ // т.к. при первом поиске мы найдём лишь текущую.
+ var currentScene = this.find(TokenType.SCENE, -1);
+ var pos = this.findFrom(currentScene, TokenType.SCENE, -1);
+ // Если не нашли - перематываем на начало.
+ if (pos == this.position) this.position = 0;
+ else this.position = pos;
+ this.next();
+};
+
+Parser.prototype.nextScene = function() {
+ this.position = this.find(TokenType.SCENE, 1);
+ this.next();
+};
+
+Parser.prototype.find = function(which, step) {
+ return this.findFrom(this.position, which, step);
+};
+
Parser.prototype.findFrom = function(from, which, step) {
var pos = from;
while (true) {