zaach/jison — pull request #253 by hnrysmth (2014-10-11 14:16:57+00:00)
Title: Fix JSON mode in the CLI

This pull request removes an if statement that breaks the CLI's `--json` flag.

Here's how to reproduce the bug with jison 0.4.15:

```
$ curl -s https://raw.githubusercontent.com/zaach/jison/master/examples/calculator.json | ./node_modules/.bin/jison --json

node_modules/jison/lib/cli.js:142
var settings = grammar.options || {};
^
TypeError: Cannot read property 'options' of undefined
at Object.generateParserString (node_modules/jison/lib/cli.js:142:27)
at processGrammar (node_modules/jison/lib/cli.js:74:22)
at node_modules/jison/lib/cli.js:125:25
at Socket. (node_modules/jison/lib/cli.js:119:13)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:910:16
at process._tickCallback (node.js:415:13)
```

That `grammar` variable is undefined on line 142 of cli.js because of this `if (!opts.json)` check, which prevents the prerequisite call to `cli.processGrammars`.