mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
16 lines
359 B
JavaScript
16 lines
359 B
JavaScript
|
import jison from 'jison';
|
||
|
|
||
|
export const transformJison = (src) => {
|
||
|
const parser = new jison.Generator(src, {
|
||
|
moduleType: 'js',
|
||
|
'token-stack': true,
|
||
|
});
|
||
|
const source = parser.generate({ moduleMain: '() => {}' });
|
||
|
const exporter = `
|
||
|
parser.parser = parser;
|
||
|
export { parser };
|
||
|
export default parser;
|
||
|
`;
|
||
|
return `${source} ${exporter}`;
|
||
|
};
|