1 | #!/usr/bin/env node
|
2 |
|
3 | var parser = require('./folproof-parser.js').parser;
|
4 | var verifier = require('./folproof-verifier.js').Verifier;
|
5 | var fs = require('fs');
|
6 | var path = require('path');
|
7 |
|
8 | var version = require('./package.json').version;
|
9 |
|
10 | var opts = require("nomnom")
|
11 | .script('folproof')
|
12 | .option('file', {
|
13 | flag: true,
|
14 | position: 0,
|
15 | help: '.fol source file'
|
16 | })
|
17 | .parse();
|
18 |
|
19 | exports.main = function() {
|
20 | if (opts.file) {
|
21 | var raw = fs.readFileSync(path.normalize(opts.file), 'utf8');
|
22 | var ast, result;
|
23 | try {
|
24 | ast = parser.parse(raw);
|
25 | result = verifier.verifyFromAST(ast);
|
26 | console.log(result);
|
27 | } catch(ex) {
|
28 |
|
29 | console.log("ERROR", ex.toString());
|
30 | }
|
31 | }
|
32 | };
|
33 |
|
34 | if (require.main === module)
|
35 | exports.main();
|