Comparing version 0.1.1 to 0.1.2
@@ -7,4 +7,4 @@ /* jslint node: true */ | ||
function jisonify(file) { | ||
if (!file.match(/\.jison$/)) { | ||
function jisonify(fileName) { | ||
if (!fileName.match(/\.jison$/)) { | ||
return through(); | ||
@@ -11,0 +11,0 @@ } |
{ | ||
"name": "jisonify", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Browserify plugin for Jison parsers.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"No tests.\" && exit 1" | ||
"test": "node test/test.js" | ||
}, | ||
@@ -14,3 +14,3 @@ "dependencies": { | ||
"devDependencies": { | ||
"browserify": "2.x.x" | ||
"browserify": "3.x.x" | ||
}, | ||
@@ -17,0 +17,0 @@ "repository": { |
# Jisonify | ||
A [Browserify](https://github.com/substack/node-browserify) v2 transform for [Jison](https://github.com/zaach/jison) parsers. | ||
A [Browserify](https://github.com/substack/node-browserify) transform for [Jison](https://github.com/zaach/jison) parsers. | ||
[![NPM version](https://badge.fury.io/js/jisonify.png)](https://npmjs.org/package/jisonify) | ||
[![Build Status](https://travis-ci.org/schmich/jisonify.png?branch=master)](https://travis-ci.org/schmich/jisonify) | ||
[![Dependency Status](https://gemnasium.com/schmich/jisonify.png)](https://gemnasium.com/schmich/jisonify) | ||
## Installation | ||
@@ -14,3 +18,3 @@ | ||
``` | ||
browserify -t jisonify script.js > bundle.js | ||
browserify -t jisonify main.js > bundle.js | ||
``` | ||
@@ -21,2 +25,3 @@ | ||
```js | ||
// calc.jison | ||
%lex | ||
@@ -34,4 +39,4 @@ %% | ||
%left '+' '-' | ||
%start expressions | ||
%% | ||
@@ -51,9 +56,32 @@ | ||
```js | ||
var parser = require('./parser').parser; | ||
// main.js | ||
var parser = require('./calc.jison').parser; | ||
var result = parser.parse('3 + 2 - 1'); | ||
console.log(result); | ||
// ... | ||
exports = run = function() { | ||
var input = document.getElementById('input'); | ||
var output = document.getElementById('output'); | ||
output.innerText = parser.parse(input.value); | ||
}; | ||
``` | ||
``` | ||
browserify -t jisonify main.js > bundle.js | ||
``` | ||
```html | ||
<!-- calc.html ---> | ||
<html> | ||
<head> | ||
<script src="bundle.js"></script> | ||
</head> | ||
<body> | ||
<form onsubmit="run(); return false;"> | ||
<input type="text" id="input" value="50 + 2 - 10" /> | ||
<input type="submit" /> | ||
Result: <span id="output">–</span> | ||
</form> | ||
</body> | ||
</html> | ||
``` | ||
## License | ||
@@ -60,0 +88,0 @@ |
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
4233
6
1
88