Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('Generate AST Productions', () => {
// extract the serialized parser.
const serializedGrammar = parserInstance.getSerializedGastProductions()
// create the HTML Text
const htmlText = createSyntaxDiagramsCode(serializedGrammar)
// Write the HTML file to disk
const outPath = resolve(__dirname, '../diagram')
writeFileSync(outPath + '/index.html', htmlText)
})
})
* - npm install in the parent directory (parser) to install dependencies
* - Run this in file in node.js (node gen_diagrams.js)
* - open the "generated_diagrams.html" that will be created in this folder using
* your favorite browser.
*/
const path = require("path");
const fs = require("fs");
const chevrotain = require("chevrotain");
const JavaParser = require("../src/parser");
// extract the serialized grammar.
const parserInstance = new JavaParser([]);
const serializedGrammar = parserInstance.getSerializedGastProductions();
// create the HTML Text
const htmlText = chevrotain.createSyntaxDiagramsCode(serializedGrammar);
// Write the HTML file to disk
const outPath = path.resolve(__dirname, "./");
fs.writeFileSync(outPath + "/../diagrams.html", htmlText);
* - npm install in the parent directory (parser) to install dependencies
* - Run this in file in node.js (node gen_diagrams.js)
* - open the "generated_diagrams.html" that will be created in this folder using
* your favorite browser.
*/
const path = require("path")
const fs = require("fs")
const chevrotain = require("chevrotain")
const grammar = require("./grammar")
// extract the serialized grammar.
const parserInstance = grammar.parserInstance
const serializedGrammar = parserInstance.getSerializedGastProductions()
// create the HTML Text
const htmlText = chevrotain.createSyntaxDiagramsCode(serializedGrammar)
// Write the HTML file to disk
const outPath = path.resolve(__dirname, "./")
fs.writeFileSync(outPath + "/generated_diagrams.html", htmlText)