Skip to content

A gulp plugin for generating PEG.js parsers from grammar files.

License

Notifications You must be signed in to change notification settings

jonathanbp/gulp-pegjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-pegjs

Build Status Greenkeeper badge

This gulp plugin will generate a parser based on a pegjs grammar for its input files.

Install

npm install --save-dev gulp-pegjs

Usage

To generate the PEG.js parser you simply need to add these lines to your gulpfile.

var gulp  = require('gulp');
var pegjs = require('gulp-pegjs');

gulp.task('default', function() {
    return gulp.src('src/*.pegjs')
        .pipe(pegjs())
        .pipe(gulp.dest('dist'));
});

You can tweak the generated parser by passing an argument to the function call. The options are described in the PEG.js documentation.

var gulp  = require('gulp');
var pegjs = require('gulp-pegjs');

gulp.task('default', function() {
    return gulp.src('src/*.pegjs')
        .pipe(pegjs({format: "globals", exportVar: "parser"}))
        .pipe(gulp.dest('dist'));
});

About

A gulp plugin for generating PEG.js parsers from grammar files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published