Sorry, the diff of this file is not supported yet
+5
-0
@@ -51,2 +51,7 @@ /* | ||
| options: { plugins: [ 'pegjs-coffee-plugin' ] } | ||
| }, | ||
| angular_options: { | ||
| src: 'test/fixtures/a.peg', | ||
| dest: 'tmp/angular_options_standard', | ||
| angular: { module: 'pegjs', factory: 'exampleParser' } | ||
| } | ||
@@ -53,0 +58,0 @@ }, |
+1
-1
| { | ||
| "name": "grunt-peg", | ||
| "description": "A grunt multi task that generates parsers from PEG grammars.", | ||
| "version": "1.2.0", | ||
| "version": "1.3.0", | ||
| "homepage": "https://github.com/dvberkel/grunt-peg", | ||
@@ -6,0 +6,0 @@ "author": { |
+24
-0
@@ -107,2 +107,23 @@ # grunt-peg | ||
| #### Wrap in an Angular Factory | ||
| It is also possible to wrap the generated parser in an Angular | ||
| factory. | ||
| ```js | ||
| grunt.initConfig({ | ||
| peg: { | ||
| options: { trackLineAndColumn: true }, | ||
| example : { | ||
| src: "grammar/example.peg", | ||
| dest: "grammar/example.js", | ||
| angular: { | ||
| module: "pegjs", | ||
| factory: "exampleParser" | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| ``` | ||
| ##### Note on plugins | ||
@@ -150,2 +171,3 @@ | ||
| * 2014-03-20 v1.3.0 Wrap in Angular Factory | ||
| * 2014-01-05 v1.2.0 Support plugins | ||
@@ -162,5 +184,7 @@ * 2014-01-05 v1.1.0 Support PEG 0.8.0 | ||
| * [mstefaniuk][] | ||
| * [bertrandgressier][] | ||
| [welwood08]: https://github.com/welwood08 | ||
| [mstefaniuk]: https://github.com/mstefaniuk | ||
| [bertrandgressier]: https://github.com/bertrandgressier | ||
@@ -167,0 +191,0 @@ [Grunt]: http://gruntjs.com/ |
+7
-1
@@ -66,4 +66,10 @@ /* | ||
| // Save the parser. | ||
| grunt.file.write(f.dest, options.exportVar + ' = ' + parser + ';'); | ||
| if (f.angular != null){ | ||
| var angularModule = "angular.module('"+ f.angular.module+"', []).factory('"+ f.angular.factory+"',function(){ return "; | ||
| grunt.file.write(f.dest, angularModule + parser + '});'); | ||
| }else { | ||
| grunt.file.write(f.dest, options.exportVar + ' = ' + parser + ';'); | ||
| } | ||
| grunt.log.writeln('Parser "' + f.dest + '" generated in ' + time + 'ms.'); | ||
@@ -70,0 +76,0 @@ }); |
+9
-0
@@ -61,3 +61,12 @@ 'use strict'; | ||
| test.done(); | ||
| }, | ||
| angular_options: function(test) { | ||
| test.expect(1); | ||
| var actual = grunt.file.read('tmp/angular_options_standard'); | ||
| var expected = grunt.file.read('test/expected/angular_options'); | ||
| test.equal(actual, expected, 'Unexpected parser generated for angular_options_standard'); | ||
| test.done(); | ||
| } | ||
| }; |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
47379
19.37%16
6.67%194
9.6%193
14.2%