Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function customGenerator(parser) {
let output = `// Custom Walt Grammar Generator
function id(x) { return x[0]; }
module.exports = function() {
${parser.body.join('\n')}
return {
Lexer: ${parser.config.lexer},
ParserRules: ${serializeRules(
parser.rules,
generate.javascript.builtinPostprocessors
)},
ParserStart: ${JSON.stringify(parser.start)}
};
}
`;
return output;
};
function customGenerator(parser) {
let output = `// Custom Walt Grammar Generator
function id(x) { return x[0]; }
export default function grammar() {
${parser.body.join('\n')}
return {
Lexer: ${parser.config.lexer},
ParserRules: ${serializeRules(
parser.rules,
generate.javascript.builtinPostprocessors
)},
ParserStart: ${JSON.stringify(parser.start)}
};
}
`;
return output;
}