Skip to content

Conversation

lekemula
Copy link

@lekemula lekemula commented Sep 13, 2025

Description

Resolves #1627

  • Add LITERALMATCH regex constant to match symbol (:symbol) and string ('string', "string") literals
  • Update TypesExplainer parser to recognize symbol and string literal types
  • Format literal values as "a literal value :symbol" for better readability
  • Add comprehensive test coverage for LITERALMATCH constant and literal type parsing
  • Fixes parsing inconsistency between YARD TypesExplainer and online parser

🤖 Generated with Claude Code

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

- Add LITERALMATCH regex constant to match symbol (:symbol) and string ('string', "string") literals
- Update TypesExplainer parser to recognize symbol and string literal types
- Format literal values as "a literal value :symbol" for better readability
- Add comprehensive test coverage for LITERALMATCH constant and literal type parsing
- Fixes parsing inconsistency between YARD TypesExplainer and online parser

Resolves lsegal#1627

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
METHODMATCH = /(?:(?:#{NAMESPACEMATCH}|[a-z]\w*)\s*(?:#{CSEPQ}|#{NSEPQ})\s*)?#{METHODNAMEMATCH}/

# Regular expression to match symbol and string literals
LITERALMATCH = /:\w+|'[^']*'|"[^"]*"/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this constant make sense here?

@lekemula lekemula force-pushed the parse-string-and-symbol-literals branch 2 times, most recently from 7359886 to 1250332 Compare September 28, 2025 14:44
This could be useful for solargraph gem
@lekemula lekemula force-pushed the parse-string-and-symbol-literals branch from 1250332 to 2d79fb8 Compare September 28, 2025 14:52
@lekemula lekemula changed the title Add support for symbol and string literals in TypesExplainer rubocop-yard: Add support for symbol and string literals in TypesExplainer Sep 28, 2025
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.

Support symbol and string literal values
1 participant