PEG.js-based Solidity parser for JavaScript. Current stable version is 0.4.0, released as pre-alpha software. Provides parse() and parseFile() functions to convert Solidity source code into a structured JSON AST, with an optional 'imports' mode to extract imported file paths. Intended for tooling that needs to analyze or transform Solidity code without relying on heavy preprocessors. The AST structure is unstable and incomplete, and the parser may silently skip unsupported Solidity constructs. Not recommended for production use.
npm install solidity-parserVerified import paths — ran on the pinned version, not inferred.
Shows basic parse and parseFile usage with CommonJS require.
Do not rely on specific AST shapes; always test after upgrading.
Consider using @solidity-parser/parser or other alternatives.
Validate parsed output for completeness; use a more robust parser for production.
Upgrade to a parser built on a modern parser generator.
Ensure file exists before calling parseFile.
Inspect the actual returned JSON to understand the structure.
Run 'npm install' in the project directory, or install pegjs globally with 'npm install -g pegjs'.
Simplify or update the Solidity code to match older syntax; consider using a more modern parser like @solidity-parser/parser.
Use const SolidityParser = require('solidity-parser'); instead of import.No dependency data recorded yet.