solidity-parser-antlr is an unmaintained JavaScript package designed to parse Solidity source code into an Abstract Syntax Tree (AST) using an ANTLR 4 grammar. Its last published version, 0.4.11, was released over seven years ago, rendering it incompatible with modern Solidity language features and breaking changes introduced in versions 0.5.x and newer. While it served as the foundational parser for many tools in the past, its lack of updates means it does not support current Solidity syntax, semantics, or security requirements. Developers needing an active Solidity parser should consider the `@solidity-parser/parser` package, which is a continuously maintained fork of this original repository. This package does ship with TypeScript type definitions, but its utility is severely limited by its outdated Solidity grammar support.
npm install solidity-parser-antlrVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a simple Solidity contract, enabling location and range options, and walking the AST using the visitor pattern to log contract and function definitions. It also includes error handling for parsing failures.
Migrate to an actively maintained Solidity parser such as `@solidity-parser/parser`. This fork directly continues the work and supports newer Solidity versions. Uninstall `solidity-parser-antlr` and install `@solidity-parser/parser` instead. Update import paths from `solidity-parser-antlr` to `@solidity-parser/parser`.
Switch to the actively maintained fork, `@solidity-parser/parser`, which provides ongoing support for the latest Solidity language versions and includes fixes and enhancements.
If encountering issues with minified bundles, try disabling minification for the parser or configuring webpack's `optimization.minimize` to `false` specifically for this module. The long-term fix is to upgrade to `@solidity-parser/parser` and consult its documentation for bundling best practices.
Review your Solidity code's `pragma` directive. If it's above `^0.4.x`, you must upgrade to an actively maintained parser like `@solidity-parser/parser`. If it's indeed `^0.4.x`, check for any subtle syntax that might have been interpreted differently in early Solidity versions.
Ensure `ParserError` is accessed via the default import: `import parser from 'solidity-parser-antlr'; ... if (e instanceof parser.ParserError) { ... }`.No dependency data recorded yet.