// untokenizeQuotes.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Untokenize substrings that have been reduced to tokens,
* as in 'type $0 on keyboard'.
* @memberOf adventurejs.Parser
* @method adventurejs.Parser#untokenizeQuotes
* @param {String} input
* @returns {String|Boolean}
*/
p.untokenizeQuotes = function Parser_untokenizeQuotes(input) {
this.game.log(
"",
"log",
"high",
`[untokenizeQuotes.js] untokenizeQuotes() receive: ${input}`,
"Parser"
);
const this_turn = this.input_history[0];
input = input.replace(/\$\d/g, (match) => {
return this_turn.quote_tokens[match]
? this_turn.quote_tokens[match]
: match;
});
this.game.log(
"",
"log",
"high",
`[untokenizeQuotes.js] untokenizeQuotes() return: ${input}`,
"Parser"
);
return input;
};
})();