From c6cf129635cc9006663db5d196366ef5481fcaa2 Mon Sep 17 00:00:00 2001 From: David Majda Date: Fri, 9 Nov 2012 16:07:19 +0100 Subject: [PATCH] Git repo npmization: Do not use @VERSION When the Git repository will be a npm package, there will be no preprocessing step and thus no @VERSION substitution. Let's get rid of it. Part of a fix for GH-32. --- Makefile | 7 ------- src/compiler/passes/generate-code.js | 2 +- src/peg.js | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b32503f..164f580 100644 --- a/Makefile +++ b/Makefile @@ -54,19 +54,12 @@ PREPROCESS=perl -e ' \ \ use File::Basename; \ \ - open(my $$f, "$(VERSION_FILE)") or die "Can\x27t open $(VERSION_FILE): $$!"; \ - my $$PEGJS_VERSION = <$$f>; \ - close($$f); \ - chomp($$PEGJS_VERSION); \ - \ sub preprocess { \ my $$file = shift; \ my $$output = ""; \ \ open(my $$f, $$file) or die "Can\x27t open $$file: $$!"; \ while(<$$f>) { \ - s/\@VERSION/$$PEGJS_VERSION/g; \ - \ if (/^\s*\/\/\s*\@include\s*"([^"]*)"\s*$$/) { \ $$output .= preprocess(dirname($$file) . "/" . $$1); \ next; \ diff --git a/src/compiler/passes/generate-code.js b/src/compiler/passes/generate-code.js index 92d3a3c..dad8d37 100644 --- a/src/compiler/passes/generate-code.js +++ b/src/compiler/passes/generate-code.js @@ -268,7 +268,7 @@ PEG.compiler.passes.generateCode = function(ast, options) { grammar: [ '(function(){', ' /*', - ' * Generated by PEG.js @VERSION.', + ' * Generated by PEG.js 0.7.0.', ' *', ' * http://pegjs.majda.cz/', ' */', diff --git a/src/peg.js b/src/peg.js index 0150dca..27610cb 100644 --- a/src/peg.js +++ b/src/peg.js @@ -1,5 +1,5 @@ /* - * PEG.js @VERSION + * PEG.js 0.7.0 * * http://pegjs.majda.cz/ * @@ -12,7 +12,7 @@ var PEG = (function(undefined) { var PEG = { /* PEG.js version (uses semantic versioning). */ - VERSION: "@VERSION", + VERSION: "0.7.0", /* * Generates a parser from a specified grammar and returns it.