Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
" case " + op.POP_CURR_POS + ":", // POP_CURR_POS
" peg$currPos = stack.pop();",
" ip++;",
" break;",
"",
" case " + op.POP_N + ":", // POP_N n
" stack.length -= bc[ip + 1];",
" ip += 2;",
" break;",
"",
" case " + op.NIP + ":", // NIP
" stack.splice(-2, 1);",
" ip++;",
" break;",
"",
" case " + op.APPEND + ":", // APPEND
" stack[stack.length - 2].push(stack.pop());",
" ip++;",
" break;",
"",
" case " + op.WRAP + ":", // WRAP n
" stack.push(stack.splice(stack.length - bc[ip + 1], bc[ip + 1]));",
" ip += 2;",
" break;",
"",
" case " + op.TEXT + ":", // TEXT
" stack.push(input.substring(stack.pop(), peg$currPos));",
" ip++;",
" break;",
"",
" case " + op.IF + ":", // IF t, f
indent10(generateCondition("stack[stack.length - 1]", 0)),
ip++;
break;
case op.POP_N: // POP_N n
stack.pop(bc[ip + 1]);
ip += 2;
break;
case op.NIP: // NIP
value = stack.pop();
stack.pop();
parts.push(stack.push(value));
ip++;
break;
case op.APPEND: // APPEND
value = stack.pop();
parts.push(stack.top() + ".push(" + value + ");");
ip++;
break;
case op.WRAP: // WRAP n
parts.push(
stack.push("[" + stack.pop(bc[ip + 1]).join(", ") + "]")
);
ip += 2;
break;
case op.TEXT: // TEXT
parts.push(
stack.push("input.substring(" + stack.pop() + ", peg$currPos)")
);
function buildAppendLoop(expressionCode) {
return buildLoop(
[op.WHILE_NOT_ERROR],
buildSequence([op.APPEND], expressionCode)
);
}