A most excellent M/MUMPS parsing library; eMcellent-parse takes input M/MUMPS code and transforms it into JSON-based representations of the code. This can be used in translation and/or markup to make the source code more readily interpretable.
To use in Node.js, the package is available via
npm. To use locally, you will only need to install dependencies using
npm install. To test, the default
grunt task will execute all test cases.
To use in the browser, install dependencies with
npm install, and run
grunt build:browser. Browserify will convert the package into a Commonjs format, minify it, and output it to
The library has two entry functions; note that both functions are synchronous.
Parses a single line of M/MUMPS code into the JSON representation.
inputString - A Line of M/MUMPS code.
Parses a routine of M/MUMPS code, returning an array of JSON representations marked up with line numbers.
inputString - An entire routine of M/MUMPS code, with lines separated by line feeds.
Parsed lines will be returned in the below format; parseRoutine returns an array of these objects.
Pull requests are welcome, just be sure to include test cases.