jison-semi-passive
Make Jison parser to semi-passive.
The passive parser can be used to parse streaming input.
But because lexer of jison is using JavaScript's builtin regexp functions instead of own NFA/DFA, generated parser can't be 'passive'.
(might there be some solution, may be lexer's error correction or something can help this problem)
But applying some restrictions, they can be passive.
These restrictions, is the reason why this is 'semi' passive.
The restrictions are..
- Tokens can't be scanned passively, that means a token can't be divided into 2 or more parse calls.
You may be able to use Newline character to devide the input. - Never define a token which includes EOF at the end. (Though I've never seen such a definitions)
About original Jison, please refer to http://zaach.github.io/jison/.
Getting Started
Install the module with: npm install kurohara/jison-semi-passive
- Generate parser just like as Jison.
- Pass extra argument for holding parser states, so than you can call parse method continuously.
var fs = ;var jisonmod = ; var syntax = fs;var parser = syntax; var state = iseof: false;parser;parser;parser;/* set iseof to true when the input has really ended. */stateiseof = true;parser;
Documentation
(Coming soon)
Examples
jsperf is the first sample application using jison-semi-passive, please refer that.
(Though jsperf is under construction, barely working as sample of jison-semi-passive)
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
0.1.0 10/19/2015 initial release
License
Copyright (c) 2015 Hiroyoshi Kurohara
Licensed under the MIT license.