UNPKG

hdl-js

Version:

Hardware definition language (HDL) and Hardware simulator

26 lines (21 loc) 592 B
/** * The MIT License (MIT) * Copyright (c) 2017-present Dmitry Soshnikov <dmitry.soshnikov@gmail.com> */ 'use strict'; var fs = require('fs'); var hdlParser = require('./generated/hdl-parser'); // By default do not capture locations; callers may override. hdlParser.setOptions({ captureLocations: false }); /** * Extensions to the generated parser. */ Object.assign(hdlParser, { /** * Parses a file with HDL code. */ parseFile: function parseFile(fileName, options) { return this.parse(fs.readFileSync(fileName, 'utf-8'), options); } }); module.exports = hdlParser;