xgvargas / gulp-peg

Compile PEG grammars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-peg

Build Status

Gulp plugin for PEG parsers compilation.

Detailed documentation will be writen soon...

Installation

Install plugin

npm install gulp-peg --save-dev

Add peg-compilation task into your gulp-file:

paths =
  build: "build"
  scripts: peg: "src/**/*.peg"

gulp.task "peg:compile", ->
  gulp
    .src( paths.scripts.peg )
    .pipe( peg( {exportVar: ''} ) )
    .on( "error", gutil.log ) 
    .pipe( gulp.dest( paths.build ) )

Finish

Options

Plugin redirects passed options directly to PEG, so read its documentation for details.

exportVar option

This option is inspired by grunt-peg plugin, and defines variable to which the generated parser will be assigned in the output file. Default value is module.exports.

exportVar Behavior
null default Will set variable to module.exports
function(filename){} should return the desired variable name
'' (empty string) convenience value to set variable to 'filenameparser'

About

Compile PEG grammars

License:MIT License


Languages

Language:CoffeeScript 98.5%Language:JavaScript 1.5%