From c7521fb8681b7fe9d1143dce6bb07211fde9fa20 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sat, 19 Apr 2014 17:09:33 +0200 Subject: [PATCH] Mark |parse| and |SyntaxError| as internal identifiers The |parse| function and the |SyntaxError| exception were meant as internal, so let's mark them as such. --- lib/compiler/passes/generate-javascript.js | 12 ++++++------ lib/parser.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/compiler/passes/generate-javascript.js b/lib/compiler/passes/generate-javascript.js index 52204e1..16087e6 100644 --- a/lib/compiler/passes/generate-javascript.js +++ b/lib/compiler/passes/generate-javascript.js @@ -677,7 +677,7 @@ module.exports = function(ast, options) { ' child.prototype = new ctor();', ' }', '', - ' function SyntaxError(message, expected, found, offset, line, column) {', + ' function peg$SyntaxError(message, expected, found, offset, line, column) {', ' this.message = message;', ' this.expected = expected;', ' this.found = found;', @@ -688,9 +688,9 @@ module.exports = function(ast, options) { ' this.name = "SyntaxError";', ' }', '', - ' peg$subclass(SyntaxError, Error);', + ' peg$subclass(peg$SyntaxError, Error);', '', - ' function parse(input) {', + ' function peg$parse(input) {', ' var options = arguments.length > 1 ? arguments[1] : {},', '', ' peg$FAILED = {},', @@ -927,7 +927,7 @@ module.exports = function(ast, options) { ' cleanupExpected(expected);', ' }', '', - ' return new SyntaxError(', + ' return new peg$SyntaxError(', ' message !== null ? message : buildMessage(expected, found),', ' expected,', ' found,', @@ -974,8 +974,8 @@ module.exports = function(ast, options) { ' }', '', ' return {', - ' SyntaxError: SyntaxError,', - ' parse: parse', + ' SyntaxError: peg$SyntaxError,', + ' parse: peg$parse', ' };', '})()' ].join('\n')); diff --git a/lib/parser.js b/lib/parser.js index f7c2248..d7d8b88 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -11,7 +11,7 @@ module.exports = (function() { child.prototype = new ctor(); } - function SyntaxError(message, expected, found, offset, line, column) { + function peg$SyntaxError(message, expected, found, offset, line, column) { this.message = message; this.expected = expected; this.found = found; @@ -22,9 +22,9 @@ module.exports = (function() { this.name = "SyntaxError"; } - peg$subclass(SyntaxError, Error); + peg$subclass(peg$SyntaxError, Error); - function parse(input) { + function peg$parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, peg$FAILED = {}, @@ -493,7 +493,7 @@ module.exports = (function() { cleanupExpected(expected); } - return new SyntaxError( + return new peg$SyntaxError( message !== null ? message : buildMessage(expected, found), expected, found, @@ -4898,7 +4898,7 @@ module.exports = (function() { } return { - SyntaxError: SyntaxError, - parse: parse + SyntaxError: peg$SyntaxError, + parse: peg$parse }; })();