parse-statements

JSON →
library 1.0.12 ·javascript
verified May 27, 2026

Versatile parser for extracting non-overlapping statements from source code in any programming language. Current stable version is 1.0.12 (released October 2022), with no updates since. It enables definition of statement patterns as sequences of token strings, which are internally compiled to regular expressions with gmu flags. Comments can be defined separately and can appear between tokens. The parser supports custom callbacks for parse success, errors, and comments. Callbacks can return a custom end index for each statement, allowing manual extension or truncation. It ships TypeScript type definitions and has zero dependencies. Compared to full AST parsers, this is lightweight and language-agnostic, but requires manual token pattern definition and does not produce an abstract syntax tree.

total hits 22
actors 8 distinct systems
last hit 2d ago AhrefsBot
ByteDance
5
MetaBot
3
GPTBot
2
Script
1
ClaudeBot
1
Search engines
1
Humans
1

top countries 🇺🇸 United States · 🇸🇬 Singapore · 🇫🇷 France · 🇬🇧 United Kingdom · 🇨🇦 Canada