From 187f9d6bb039147a6bb3f3234cfb515c56fb2a99 Mon Sep 17 00:00:00 2001 From: David Majda Date: Tue, 3 Dec 2013 21:20:57 +0100 Subject: [PATCH] Remove the |NIP_CURR_POS| bytecode instruction After the previous commit is is not used anywhere. --- lib/compiler/opcodes.js | 1 - lib/compiler/passes/generate-bytecode.js | 6 ------ lib/compiler/passes/generate-javascript.js | 12 ------------ 3 files changed, 19 deletions(-) diff --git a/lib/compiler/opcodes.js b/lib/compiler/opcodes.js index fb3fa71..614925e 100644 --- a/lib/compiler/opcodes.js +++ b/lib/compiler/opcodes.js @@ -7,7 +7,6 @@ module.exports = { POP_CURR_POS: 3, // POP_CURR_POS POP_N: 4, // POP_N n NIP: 5, // NIP - NIP_CURR_POS: 6, // NIP_CURR_POS APPEND: 7, // APPEND WRAP: 8, // WRAP n TEXT: 9, // TEXT diff --git a/lib/compiler/passes/generate-bytecode.js b/lib/compiler/passes/generate-bytecode.js index ddfae84..e00c59a 100644 --- a/lib/compiler/passes/generate-bytecode.js +++ b/lib/compiler/passes/generate-bytecode.js @@ -35,12 +35,6 @@ var utils = require("../../utils"), * stack.pop(); * stack.push(value); * - * [6] NIP_CURR_POS - * - * value = stack.pop(); - * currPos = stack.pop(); - * stack.push(value); - * * [7] APPEND * * value = stack.pop(); diff --git a/lib/compiler/passes/generate-javascript.js b/lib/compiler/passes/generate-javascript.js index 816957e..41ba34e 100644 --- a/lib/compiler/passes/generate-javascript.js +++ b/lib/compiler/passes/generate-javascript.js @@ -197,11 +197,6 @@ module.exports = function(ast, options) { ' ip++;', ' break;', '', - ' case ' + op.NIP_CURR_POS + ':', // NIP_CURR_POS - ' peg$currPos = stack.splice(-2, 1)[0];', - ' ip++;', - ' break;', - '', ' case ' + op.APPEND + ':', // APPEND ' stack[stack.length - 2].push(stack.pop());', ' ip++;', @@ -482,13 +477,6 @@ module.exports = function(ast, options) { ip++; break; - case op.NIP_CURR_POS: // NIP_CURR_POS - value = stack.pop(); - parts.push('peg$currPos = ' + stack.pop() + ';'); - parts.push(stack.push(value)); - ip++; - break; - case op.APPEND: // APPEND value = stack.pop(); parts.push(stack.top() + '.push(' + value + ');');