Skip to content

v0.1.4#13

Merged
qraqras merged 5 commits intomainfrom
dev
Mar 20, 2026
Merged

v0.1.4#13
qraqras merged 5 commits intomainfrom
dev

Conversation

@qraqras
Copy link
Copy Markdown
Owner

@qraqras qraqras commented Mar 20, 2026

No description provided.

qraqras added 4 commits March 20, 2026 12:13
…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
@qraqras qraqras self-assigned this Mar 20, 2026
- 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
@qraqras qraqras merged commit 186c243 into main Mar 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant