Commit graph

111 commits

Author SHA1 Message Date
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
Yusuke Endoh
cd41378ef9 lib/rdoc/parser/ruby.rb: Avoid .chars.to_a.last
The code creates a lot of useless objects.
Instead, using a regexp is shorter and faster.
2019-08-16 11:36:47 +09:00
Yusuke Endoh
f71bd7477e RDoc::Parser::C: Integrate do_classes and do_modules by one regexp match
The full scan of the C source code (`@content.scan`) is very slow.
The old code invokes the scan six times in `do_classes` and
`do_modules`.

This change integrates the six scans into one by merging the regexps.
The integrated regexp is a bit hard to maintain, but the speed up is
significant: approx. 30 sec -> 20 sec in Ruby's `make rdoc`.

In addition, this change omits `do_boot_defclass` unless the file name
is `class.c`.  `boot_defclass` is too specific to Ruby's source code, so
RDoc should handle it as a special case.

Before this change:

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       858  (13.6%)         858  (13.6%)     (garbage collection)
       292   (4.6%)         264   (4.2%)     RDoc::Parser::C#do_define_class
       263   (4.2%)         250   (3.9%)     RDoc::Parser::C#do_define_module
       275   (4.3%)         241   (3.8%)     RDoc::Parser::C#do_define_class_under
       248   (3.9%)         237   (3.7%)     RDoc::Parser::C#do_define_module_under
       234   (3.7%)         234   (3.7%)     RDoc::Parser::C#gen_body_table
       219   (3.5%)         219   (3.5%)     Ripper::Lexer#state_obj
       217   (3.4%)         216   (3.4%)     RDoc::Parser::C#do_struct_define_without_accessor
       205   (3.2%)         205   (3.2%)     RDoc::Parser::C#do_boot_defclass
       205   (3.2%)         205   (3.2%)     RDoc::Parser::C#do_singleton_class

The six methods take approx. 22.2%.
`do_define_class` (4.2%) + `do_define_class_under` (3.8%) +
`do_define_module` (3,9$) + `do_define_module_under` (3.7%) +
`do_struct_define_without_accessor` (3.4%) + `do_singleton_class` (3.2%)

After this change, the methods are integrated to `do_classes_and_modules`
which takes only 5.8%.

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       812  (16.7%)         812  (16.7%)     (garbage collection)
       355   (7.3%)         284   (5.8%)     RDoc::Parser::C#do_classes_and_modules
       225   (4.6%)         225   (4.6%)     RDoc::Parser::C#gen_body_table
       429   (8.8%)         210   (4.3%)     RDoc::Parser::RubyTools#get_tk
       208   (4.3%)         208   (4.3%)     RDoc::TokenStream#add_tokens
2019-08-16 06:07:11 +09:00
aycabta
a86d4eef4b [ruby/rdoc] Normalization of comment should check language
RDoc::Text#normalize_comment that is included RDoc::Comment always
remove Ruby style comment indicator "#" and C style comment indicator
"/**/", but should check language and remove only the language's comment
indicator.

ca68ba1e73
2019-07-26 17:20:58 +08:00
Nobuyoshi Nakada
6566919176
ripper_state_lex.rb: chomp CR
* lib/rdoc/parser/ripper_state_lex.rb (RDoc::Parser::RipperStateLex):
  chomp newline, including CR, from here document terminator.

Closes: ruby/rdoc#694
Closes: ruby/rdoc#697
Closes: ruby/rdoc#705
2019-06-07 18:57:58 +09:00
nobu
fa04b87af4 [DOC] fix missing paren [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-28 08:39:24 +00:00
nobu
79aef1272e [DOC] escape descriptions [ci skip]
Escape descriptions not to get parsed as directives.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:49:32 +00:00
nobu
9035e73a14 [DOC] mark function names [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:41:13 +00:00
nobu
8513c20370 [DOC] split a tag for each function name [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:25:32 +00:00
kazu
44aaff6d31 [DOC] Fix close tags [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:10:10 +00:00
nobu
8586f021f8 rdoc/parser/c.rb: ignore dynamically added methods
* lib/rdoc/parser/c.rb (RDoc::Parser::C#deduplicate_call_seq):
  skip dynamically added methods at runtime, because the class
  name is unknown and the defined methods are not accessible from
  that class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-28 01:56:28 +00:00
aycabta
1b43644edc Merge rdoc-6.1.0.beta2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17 06:28:20 +00:00
hsbt
95e213d354 Merge rdoc-6.1.0.beta1.
* https://github.com/ruby/rdoc/compare/v6.0.4...v6.1.0.beta1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 01:30:18 +00:00