Conversation
…DEFAULT_VALUE Add zero-length (missing) placeholder tokens so callers can uniformly use find_missing(KIND) to detect the presence of a syntactic slot without content, instead of checking surrounding tokens (COLON, OPEN_BRACKET etc.) indirectly. Google parser: - GOOGLE_ARG/EXCEPTION/WARNING/SEE_ALSO_ITEM: emit zero-length DESCRIPTION when COLON is present but no description text follows (e.g. `a (int):`, `a:`). extend_last_node_description now replaces a missing DESCRIPTION range rather than extending it, so continuation lines on the next line work correctly. - GOOGLE_ARG: emit zero-length TYPE inside empty brackets `()` (previous commit). NumPy parser: - NUMPY_PARAMETER: emit zero-length TYPE when colon is present but type text is absent (e.g. `a :`), distinguishing it from `a` (no colon at all). - NUMPY_PARAMETER: emit zero-length DEFAULT_VALUE when DEFAULT_SEPARATOR (= or :) is present but no value follows (e.g. `default =`, `default:`).
- Add SyntaxKind::PLAIN_DOCSTRING as root node for plain docstrings - Add Style::Plain to represent docstrings with no NumPy or Google section markers (includes summary-only and unrecognised styles such as Sphinx) - Implement src/parse/plain/ module: parse_plain(), PlainDocstring typed wrapper, and to_model() - Add unified parse() entry point that auto-detects style and dispatches to the appropriate parser - Optimise detect_style() to a single pass (was two passes) - Simplify detect_style(): return immediately on first Google marker (mixed NumPy+Google docstrings do not exist in practice) - Update Python bindings: Style.PLAIN, SyntaxKind.PLAIN_DOCSTRING, PlainDocstring class, parse_plain() function - Add tests/plain.rs integration tests - Update tests/detect_style.rs
- Add examples/parse_auto.rs: demonstrates parse() auto-detection across Google, NumPy, and Plain styles - Update README.md: add parse_auto to Development section - Update bindings/python/README.md: Style.PLAIN, PlainDocstring, parse_plain() in API reference and new Plain Style section
- Add parse() function that auto-detects style and returns GoogleDocstring | NumPyDocstring | PlainDocstring - Add .style: Style property to all three docstring types so callers can dispatch via match doc.style: without isinstance checks - Update pydocstring.pyi stubs: PlainDocstring class definition, .style on all three docstring types, parse() function signature - Fix test_fallback_to_google → test_fallback_to_plain (Style.PLAIN) - Add TestParsePlain (13 tests) and TestParse (15 tests) to cover parse_plain(), parse(), .style, and to_model() for plain docstrings - Update bindings/python/README.md: Unified Parse section with match-based dispatch example; parse() added to API reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.