From 057a93fbc7c2e169859171f760fe3c3667c63220 Mon Sep 17 00:00:00 2001 From: David Majda Date: Tue, 3 May 2016 15:59:23 +0200 Subject: [PATCH] Move the "Generated by ..." comment out of wrapping functions The wrapping functions are also generated by PEG.js, so the comment should be above them to mark them as such. This shouldn't cause any problems technically. --- lib/compiler/passes/generate-js.js | 10 +++++----- lib/parser.js | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/compiler/passes/generate-js.js b/lib/compiler/passes/generate-js.js index 96efd01..5dfbb31 100644 --- a/lib/compiler/passes/generate-js.js +++ b/lib/compiler/passes/generate-js.js @@ -1140,10 +1140,8 @@ function generateJS(ast, options) { } function generateWrapper(toplevelCode) { - function generateIntro() { + function generateGeneratedByComment() { return [ - '"use strict";', - '', '/*', ' * Generated by PEG.js 0.9.0.', ' *', @@ -1172,8 +1170,9 @@ function generateJS(ast, options) { var generators = { bare: function() { return [ + generateGeneratedByComment(), '(function() {', - indent2(generateIntro()), + ' "use strict";', '', indent2(toplevelCode), '', @@ -1199,6 +1198,7 @@ function generateJS(ast, options) { params = dependencyVars.join(', '); parts.push([ + generateGeneratedByComment(), '(function(root, factory) {', ' if (typeof define === "function" && define.amd) {', ' define(' + dependencies + ', factory);', @@ -1216,7 +1216,7 @@ function generateJS(ast, options) { parts.push([ ' }', '})(this, function(' + params + ') {', - indent2(generateIntro()), + ' "use strict";', '', indent2(toplevelCode), '', diff --git a/lib/parser.js b/lib/parser.js index ae56fa3..7486f5b 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -1,6 +1,11 @@ /* eslint-env node, amd */ /* eslint no-unused-vars: 0 */ +/* + * Generated by PEG.js 0.9.0. + * + * http://pegjs.org/ + */ (function(root, factory) { if (typeof define === "function" && define.amd) { define([], factory); @@ -10,12 +15,6 @@ })(this, function() { "use strict"; - /* - * Generated by PEG.js 0.9.0. - * - * http://pegjs.org/ - */ - function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype;