You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please use FSM to analyze the docstring, do not use regular expression. #95
I originally thought that you would use lexical analysis and syntactic analysis from the principles of compilation, and analyze docstring through a finite state machine. However, when I took a look at the source code, I found that you were actually using regular expressions. The use of regular expressions will lead to a significant reduction in flexibility.
Creating a fully manual lexer and parser can be a tough task. While adding a library like parsimonious or lark could simplify things a lot, it would also add extra bulk to the package which I think should be avoided. That being said, I'm open to any pull requests if you'd like to explore different approaches.
Thanks for the suggestion and for thinking about how the parser is built. Since this was opened, every style reads docstrings through one shared line lexer (#140), which is where the flexibility mattered most. The pieces inside a line, such as item heads and type marks, are still matched with small regexes. A fully hand-written or grammar-based parser would add a lot of code or a dependency without fixing any bug we know of, so I'm closing this. A case the regexes get wrong is welcome as a new issue.
Activity
rr- commentedon Jul 20, 2025
Creating a fully manual lexer and parser can be a tough task. While adding a library like parsimonious or lark could simplify things a lot, it would also add extra bulk to the package which I think should be avoided. That being said, I'm open to any pull requests if you'd like to explore different approaches.
rr- commentedon Nov 7, 2026
Thanks for the suggestion and for thinking about how the parser is built. Since this was opened, every style reads docstrings through one shared line lexer (#140), which is where the flexibility mattered most. The pieces inside a line, such as item heads and type marks, are still matched with small regexes. A fully hand-written or grammar-based parser would add a lot of code or a dependency without fixing any bug we know of, so I'm closing this. A case the regexes get wrong is welcome as a new issue.