0.1.6 • Published 8 years ago

grunt-antlr4 v0.1.6

Weekly downloads
16
License
-
Repository
github
Last release
8 years ago

grunt-antlr4

Grunt task for antlr4.

Getting Started

This plugin requires Grunt ~0.4.5 and Java Runtime Environment

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-antlr4 --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-antlr4');

The "antlr4" task

Overview

In your project's Gruntfile, add a section named antlr4 to the data object passed into grunt.initConfig().

grunt.initConfig({
  antlr4: {
    your_target: {
      grammar: 'Path to your .g4 file',
      options: {
          // Target-specific options go here.
      },
    },
  },
});

Options

A hash of antlr command line options.

Please refer to https://github.com/antlr/antlr4/blob/master/doc/tool-options.md

'-' symbol at the start of the option name must be ommited

Top level options are those which are not flags and grammar-level options. Format: -{optionName} {optionValue}

Flags are options which don't have a value. Format: -{flagName}

Grammar-level options are JVM arguments formatted as: -D{optionName}={optionValue}

options.flags

Type: Array

An array of flag names

options.grammar

Type: Object

A hash of grammar-level options

Usage Examples

grunt.initConfig({
    antlr4: {
        test: {
            grammar: 'JSON.g4', //path to your grammar definition
            options: {
                o: 'dist', //output directory
                grammarLevel: {
                    language: 'JavaScript' //generated code language
                },
                flags: [
                    'visitor' //enable visitor generation
                ]
            }
        }
    }
});
0.1.6

8 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago