generate.js (12 lines of code) (raw):
/*
* htl-parser 1.0.0
* Copyright (c) 2018
* https://github.com/DeloitteDigitalAPAC/htl-parser/
* Licensed under the BSD 3-Clause license.
*/
'use strict';
const fs = require('fs');
const path = require('path');
const peg = require('pegjs');
const grammar = fs.readFileSync(path.join('src', 'htl.pegjs'), 'utf8');
const parserSource = peg.generate(grammar, {
cache: false,
format: 'commonjs',
optimize: 'speed',
output: 'source'
});
fs.writeFileSync(path.join('dist', 'parser.js'), parserSource);