26 lines
555 B
JavaScript
Raw Normal View History

2021-09-30 00:07:57 +02:00
const { Generator } = require('jison');
const validate = require('schema-utils');
const schema = {
title: 'Jison Parser options',
type: 'object',
properties: {
'token-stack': {
type: 'boolean',
},
debug: {
type: 'boolean',
},
},
additionalProperties: false,
};
2021-09-30 00:07:57 +02:00
module.exports = function jisonLoader(source) {
const options = this.getOptions();
(validate.validate || validate)(schema, options, {
2021-09-30 00:07:57 +02:00
name: 'Jison Loader',
baseDataPath: 'options',
});
return new Generator(source, options).generate();
};