Commit graph

123 commits

Author SHA1 Message Date
Stan Lo
03eb777c69 Sync RDoc 6.14.0 2025-05-22 15:04:47 -07:00
Nobuyoshi Nakada
a46fe5c807 [ruby/rdoc] Fix to parse rb_define_global_const
https://github.com/ruby/ruby/pull/12357

458ecbb7f7
2024-12-16 14:55:39 +00:00
Stan Lo
2ecd2fe0ed [ruby/rdoc] Deprecate main and title directives
(https://github.com/ruby/rdoc/pull/1218)

* Deprecate :main: directive

* Deprecate :title: direcive

* Update documentation

* Remove :main: directive's usage

* Update test cases

* Add '.rdoc_options' to suggested alternatives

e2d4ac9dad
2024-12-05 11:36:34 +00:00
Stan Lo
cbc40bb130 Sync rdoc 2024-08-05 08:27:45 +08:00
tomoya ishida
16b0242808 [ruby/rdoc] Add new ruby parser that uses Prism
(https://github.com/ruby/rdoc/pull/1144)

* Add a new ruby parser RDoc::Parser::PrismRuby

* Add a new ruby parser testcase independent from parser's internal implementation

* unknown meta method

* Use MethodSignatureVisitor only to scan params, block_params and calls_super

* Add calls_super test

* Drop ruby 2.6. Prism requires ruby >= 2.7

* Remove duplicated documentation comment from prism_ruby.rb

* Add test for wrong argument passed to metaprogramming method

* Rename visit_call_[DSL_METHOD_NAME] to make it distinguishable from visit_[NODE_TYPE]_node

* Method receiver switch of true/false/nil to a case statement

* Extract common part of add_method(by def keyword) and add meta_comment method

* Reuse consecutive comments array when collecting comments

* Simplify DSL call_node handling

* Refactor extracting method visibility arguments

fde99f1be6
2024-07-31 20:50:00 +00:00
Stan Lo
239d54dfbc [ruby/rdoc] Improve rubocop setup
(https://github.com/ruby/rdoc/pull/1139)

* Rename rake rubocop to rake format_generated_files

* Add rubocop rules to ensure spaces are applied consistently

* Improve rubocop related CI workflows

27932d001c
2024-07-17 20:43:08 +00:00
nicholas a. evans
e165d92d37
[ruby/rdoc] Drop reimplementation of Ripper lex state
(https://github.com/ruby/rdoc/pull/1118)

* Drop reimplementation of Ripper lex state

This code was for ruby 2.4 compatibility, but rdoc dropped support for
ruby 2.4 about three years ago, in f480b970c.  This code was almost half
of the lines of code in rdoc/parser/ripper_state_lex.

* Remove unused Ripper constants and const_defined?

This was mostly copied from the diff in @st0012's PR comment.  The
remaining constants have been updated to get their value directly from
Ripper.

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Use Ripper::EXPR_LABEL directly

Since this is only used from outside RipperStateLex, there's no longer
any benefit to using the indirect reference rather than just going
straight to Ripper.

---------

dd8c216263

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-07-16 07:22:11 +09:00
Yudai Takada
15ceb95d78 [ruby/rdoc] Fix some typos (https://github.com/ruby/rdoc/pull/1129)
* constist ==> consist

* Tidyness ==> Tidiness

* Currentry ==> Currently

* valus ==> values

8412705721
2024-07-01 11:08:37 +09:00
Petrik
2a57e6e6ed [ruby/rdoc] Don't document aliases with trailing :nodoc directive
Attribute readers and writers can be marked as `:nodoc` to keep them
undocumented:

```ruby
attr_reader :name # :nodoc:
```

For aliases this behaviour should be the same:

```ruby
alias_method :old :new # :nodoc:
```

30f14e8271
2024-02-09 01:07:17 +00:00
Nobuyoshi Nakada
7fcc6f04ac [ruby/rdoc] Visibility should begin from public for each scope
Even for singleton class definition such as `class << self` that
shares the same container with the outer scope, its visibility is
separated and set to `public` by default.

baf26363b9
2024-01-07 11:39:46 +00:00
Nobuyoshi Nakada
2325b72cf3 [ruby/rdoc] Singleton method visibility should be isolated
Each singleton method definition of the form `def recv.method` has
visibility separate from the outer scope and is set to `public` by
default.

810913a7ea
2024-01-07 11:39:45 +00:00
Nobuyoshi Nakada
e324953090 [ruby/rdoc] Fix support for rb_file_const and rb_curses_define_const
Constant definitions using these functions have been supported, but
since RDoc::Parser::C#gen_const_table did not consider other than
`rb_define_const` the documents for them have not been found, without
`Document-const` direvtive.

Fixes https://github.com/ruby/rdoc/issues/1067

cdad51a60b
2023-12-25 21:12:49 +09:00
Nobuyoshi Nakada
20f4f00764 [ruby/rdoc] [DOC] nodoc for probably internal methods
f7dd147a8c
2023-12-16 00:26:39 +09:00
Nobuyoshi Nakada
e15d690db1 [ruby/rdoc] [DOC] Add missing documents
e4c90340d0
2023-12-16 00:26:37 +09:00
Nobuyoshi Nakada
e03e872eea [ruby/rdoc] Only word-ending colon separates new definition
When followed by non-space characters, rather it looks like a URL or a
path name on Windows.

72c6560773
2023-12-06 09:35:44 +00:00
Nobuyoshi Nakada
379f06797d [ruby/rdoc] Needs more backslash to match escaping backslashs
1904e9076d
2023-12-06 09:35:43 +00:00
Nobuyoshi Nakada
113f5d7fd7 [ruby/rdoc] Allow any single-word token upto 2 before C method implementation
Previously only unknown word `intern` is allowed between a single-word
token before a C method.  Now any single-word token, such as `inline`
which is used for `ArithmeticSequence` in enumerator.c, is allowed
instead.

3a214c1dd1
2023-12-05 08:48:19 +00:00
Nobuyoshi Nakada
c0baa3783f [ruby/rdoc] Reduce matched substring allocations
aaed688a97
2023-12-05 08:48:18 +00:00
theo-squadracer
a14ba622da [ruby/rdoc] handle symbols declared with %s
ed91c4b784
2023-09-05 00:37:30 +00:00
Vinicius Stock
a4d92475f6 [ruby/rdoc] Auto-correct trailing new lines
4b68c0728a
2023-06-03 01:42:29 +00:00
Nobuyoshi Nakada
85a9fd1902 [ruby/rdoc] Fix polynominal backtracking
Fix https://github.com/ruby/rdoc/pull/995

adfa7db5b9
2023-04-29 16:55:36 +00:00
Étienne Barrié
bc101f0fc1 [ruby/rdoc] Fix RDoc::Parser::Ruby not being documented
The calls to require prevent the class from being documented.

76283fc42e
2023-02-21 19:32:14 +09:00
Nobuyoshi Nakada
1b67c58f41 [ruby/rdoc] Pull up handle_tab_width to RDoc::Parser
To share with the duplicate code in RDoc::Parser::Ruby#initialize.

27829ac119
2022-11-27 16:35:07 +00:00
Nobuyoshi Nakada
131422ceea [ruby/rdoc] Support attributes defined by rb_struct_define
854b370763
2022-06-28 20:17:30 +09:00
Nobuyoshi Nakada
51be2cf6d2 [ruby/rdoc] Parse also InitVM-prefixed functions
Initialization depending on VM is separated.

030d10fccd
2022-06-28 14:51:49 +09:00
Nobuyoshi Nakada
082c2d1b05 [ruby/rdoc] [DOC] Undocument internal constants [ci skip]
6d7bf24bb8
2022-06-07 11:44:58 +09:00
Nobuyoshi Nakada
dbfb3b1917 [ruby/rdoc] Allow boolean arguments to rb_attr and rb_define_attr
Currently only literal `0` and `1` are accepted as `read`/`write`
flags.
This patch allows other boolean arguments, C macros (`FALSE`/`TRUE`),
Ruby `VALUE`s (`Qfalse`/`Qtrue`), and C99 `bool`s (`false`/`true`), as
well.

169dc02e3c
2022-06-07 10:42:10 +09:00
Nobuyoshi Nakada
ebcbca96fb [ruby/rdoc] Fix full name of known class
Properly set the name of `File::Constants`, which is the only name
with a namespace in `RDoc::KNOWN_CLASSES`, and fixes longstanding bug
that `File::Constants` becomes `File::File::Constants`.

When it is generated by `rb_file_const` in dir.c, `name` is set to the
qualified name as same as `full_name`, and generated in the normal way
in file.c later, already set `full_name` is cleared and `name` will be
constructed from the enclosing namespace and the `name`.  It will
results in duplicated namespace, `File::File::Constants`.

3a8d6df562
2022-03-16 15:05:41 +09:00
Nobuyoshi Nakada
ec6d1cf28f [ruby/rdoc] Get rid of ruby-mode.el confusions
63fac51198
2022-02-09 22:22:45 +09:00
Soutaro Matsumoto
cbd54cba03 [ruby/rdoc] Skip parentheses on singleton class declaration
b6c6d4f978
2022-02-09 18:45:05 +09:00
Nobuyoshi Nakada
dec96dd897 [ruby/rdoc] Support all struct definition functions
Currently only `rb_struct_define_without_accessor` is supported by
https://github.com/ruby/rdoc/pull/73.  We should support other
three functions too.

d42288f06c
2022-02-09 18:43:07 +09:00
Mike Dalessio
7aec65add4 [ruby/rdoc] feat: add support for :category: on C functions
45c92005fe
2021-10-16 01:39:36 +09:00
Mike Dalessio
fbd0516afc [ruby/rdoc] fix: comments in C files use the global markup option
Previously, Parser::C comments all defaulted to "rdoc" format, even
when the user had set a different default with the `--markup=<choice>`
option.

4643b08a26
2021-10-16 01:39:06 +09:00
Mike Dalessio
d4894e81c0 [ruby/rdoc] extract Comment creation in Parser::C
This is a prefactor for fixing comment format handling.

a3d366feed
2021-10-16 01:39:05 +09:00
aycabta
caa123b50e [ruby/rdoc] Support ActiveSupport::Concern.included
ref. 168ddaa08a/activerecord/lib/active_record/core.rb (L9-L20)

a2d651dade

Co-authored-by: Fumiaki MATSUSHIMA <mtsmfm@gmail.com>
2021-07-05 11:34:29 +09:00
Nobuyoshi Nakada
19e6d27126 [ruby/rdoc] Support iso-strict format in git-log
2a6c22da63
2021-01-25 18:33:33 +09:00
Nobuyoshi Nakada
7fe22152fc [ruby/rdoc] Support other date formats in git-log
ad8cf37d72
2021-01-25 18:33:31 +09:00
Nobuyoshi Nakada
52ebaf718e [ruby/rdoc] Skip non-date logs by git-log
`RDoc::Parser::ChangeLog` mis-parses ChangeLog generated by
git-log, because of too heuristic `Time.parse`.

For instance, "commit 8187228de0"
results in "8187-08-16", that is, day 228 in the year 8187.

9711e6f6d9
2021-01-24 16:46:27 +09:00
Nobuyoshi Nakada
d5d1c41728 [ruby/rdoc] Sort by CommitDate if available
455715e930
2021-01-24 16:46:25 +09:00
Nobuyoshi Nakada
fa048a0f85 [ruby/rdoc] Add links to the commits
1821628076
2021-01-24 16:46:23 +09:00
Nobuyoshi Nakada
f3f1a666c7 [ruby/rdoc] Shorten commit hashes
5d3e153963
2021-01-24 16:46:21 +09:00
Nobuyoshi Nakada
127f735c1e [ruby/rdoc] Tweak log entry markdown
* add 3 levels to headings
* prefix commit log to labels to make unique IDs

5074c13209
2021-01-24 16:46:19 +09:00
Nobuyoshi Nakada
b88d1e6b44 [ruby/rdoc] Make each commit entries h3
11eefb2ae9
2021-01-24 16:46:17 +09:00
Nobuyoshi Nakada
bb570ce6d8 [ruby/rdoc] Support ChangeLog generated by git log
5e0a123ca1
2021-01-24 16:46:15 +09:00
Nobuyoshi Nakada
288e93bea8
Exclude parenthesized function declarations such as NORETURN
Fixes https://github.com/ruby/ruby/pull/3883
2020-12-11 13:43:18 +09:00
Jeremy Evans
38480ad507 [ruby/rdoc] Fix parsing of rb_define_module_under
Fixes Ruby Bug #15819

94a052d833
2020-07-22 02:34:49 +09:00
Jeremy Evans
7e7981c84f [ruby/rdoc] Treat multiple Ruby methods calling the same C method as aliases
Previously, only calls to rb_define_alias were treated as aliases.
This treats calls to rb_define_method with the same C function as
aliases, with the first function defined being the primary method.

This move the dedup code from the C parser to AnyMethod, and has
AnyMethod look in its aliases to find the call_seq.

Switch the deduplication code to remove lines matching one of the
other aliases, instead of only keeping lines matching the current
alias.  The previous approach could eliminate all call_seq lines
in cases where no line matched.  This was necessary to pass
tests when call_seq does deduplication by default.

The only change to the darkfish template is to not perform
unnecessary work by deduplicating twice.

0ead78616b
2020-05-24 23:47:24 +09:00
aycabta
adc9b3ca7f [ruby/rdoc] Support newline in the middle of constant definition
74d3984324
2019-12-24 07:58:53 +09:00
aycabta
e50e552693 [ruby/rdoc] Treat Proc#call syntax sugar for constant correctly
957d041ae0
2019-12-24 07:58:53 +09:00
aycabta
2d0a1a1869 Fix ghost method line no 2019-11-28 08:19:05 +09:00