M parser.js => parser.js +3 -2
@@ 72,8 72,9 @@ export class Parser {
* @param {number} level Number of brackets that are currently open
*/
getBrackets(open, close, level = 0) {
- let start, end
- while (true) {
+ let start
+ let end = this.cursor
+ while (this.hasRemaining()) {
const char = this.slice(1, true)
if (char === open) {
level++
M processor.js => processor.js +4 -1
@@ 175,7 175,7 @@ class Interchange {
const myEffectName = parser.get({split: " "})
const formalEffectName = formalEffects.get(myEffectName)
if (!formalEffectName) {
- throw new Error(`No text effect named ${myEffectName}`)
+ throw new Error(`No text effect named '${myEffectName}'`)
}
openEffects.push({effect: formalEffectName, start: noEffectText.length})
// console.error(`effect ${effect} started. open effects:`, openEffects)
@@ 197,6 197,9 @@ class Interchange {
if (parser.slice(2) === "* ") {
break
}
+ if (!parser.hasRemaining()) {
+ return
+ }
}
let effects