Skip to content

Commit e00e89e

Browse files
authored
* YARD docs for Parser::CurrentRuby and Parser::Base#version (#1076)
* * YARD docs for Parser::CurrentRuby * Document the transtion for users seeking Ruby 3.4 support * Allow IDE tools like Solargraph to understand the invocation and results from Parser::Current.parse() to provide auto-completion and type checking * * Add type info for Parser::Base#version
1 parent cc5eb42 commit e00e89e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/parser/base.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ module Parser
1313
# @!attribute [r] static_env
1414
# @return [Parser::StaticEnvironment]
1515
#
16+
# @!attribute [r] version
17+
# @return [Integer]
18+
#
1619
class Base < Racc::Parser
1720
##
1821
# Parses a string of Ruby code and returns the AST. If the source

lib/parser/current.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,13 @@ def warn_syntax_deviation(feature, version)
134134
require_relative 'ruby33'
135135
CurrentRuby = Ruby33
136136
end
137+
# @!parse
138+
# ##
139+
# # @api public
140+
# #
141+
# # Parser for the running version of Ruby. NOTE: Supports only Ruby <= 3.3. To parse Ruby 3.4+, please use the prism gem. You can also use them in conjunction to support multiple versions using a backwards-compatible AST.
142+
# #
143+
# # @see https://ruby.github.io/prism/rb/docs/ruby_api_md.html prism gem documentation
144+
# # @see https://github.com/whitequark/parser/blob/master/doc/PRISM_TRANSLATION.md Guide to using prism and parser together.
145+
# class ::Parser::CurrentRuby < ::Parser::Base; end
137146
end

0 commit comments

Comments
 (0)