summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2024-03-12[ruby/prism] Fix an AST and token incompatibility for ↵Koichi ITO
`Prism::Translation::Parser` Fixes https://github.com/ruby/prism/pull/2515. This PR fixes an AST and token incompatibility between Parser gem and `Prism::Translation::Parser` for string literal with line breaks. https://github.com/ruby/prism/commit/c58466e5bf
2024-03-11[ruby/prism] Support offsetKevin Newton
https://github.com/ruby/prism/commit/665f533373
2024-03-11[ruby/rdoc] Allow rich definition list labels for MarkdownHartley McGuire
Previously, any sort of "rich" markup for a definition list's label would cause the Markdown parser to not recognize a definition list: ```ruby md = <<~md `one` : This is a definition md doc = RDoc::Markdown.parse(md) doc # => [doc: [para: "<code>one</code>\n: This is a definition"]] ``` This commit tweaks the grammar for Markdown definition lists so that labels can include "rich" markup such as bold (`**`), code (```), etc: ```ruby md = <<~md `one` : This is a definition md doc = RDoc::Markdown.parse(md) doc # => [doc: [list: NOTE [item: ["<code>one</code>"]; [para: "This is a definition"]]]] ``` The [PHP Markdown Extra][1] Spec does not seem to specify whether or not this should be allowed, but it is allowed in the RDoc format: ```ruby rdoc = <<~rdoc +code+:: This is a definition rdoc doc = RDoc::Markup.parse(rdoc) doc # => [doc: [list: NOTE [item: ["+code+"]; [para: "This is a definition"]]]] ``` so accepting this change increases the parity of the two formats. [1]: https://michelf.ca/projects/php-markdown/extra/#def-list https://github.com/ruby/rdoc/commit/8f943bbba4
2024-03-10Clean intermediate files and debug info for each targetNobuyoshi Nakada
By replacing `ALLOBJS` suffix with intermediate file suffixes instead of roughly removing by wildcards. Made `cleanlibs` append `.dSYM` suffix for each word in `TARGET_SO`, not the end of the entire list.
2024-03-09[ruby/rdoc] Fix ToRdoc generating incorrect {label,name}-listsHartley McGuire
Previously, trying to round-trip label-list and name-lists with the ToRdoc converter was not possible: ```ruby doc = <<~RDOC foo :: bar :: hi RDOC markup = RDoc::Markup.parse(doc) markup # => [doc: [list: NOTE [item: ["foo ", "bar"]; [para: "hi"]]]] rt = RDoc::Markup::ToRdoc.new.convert(markup) rt # => "foo\nbar:\n hi\n\n" rt_markup = RDoc::Markup.parse(rt) rt_markup # => [doc: [para: "foo ", "bar:"], [verb: "hi\n"]] ``` This commit addresses the issue by fixing ToRdoc to generate output that can be properly reparsed by RDoc. ToRdoc tests additionally needed to be updated for the new output. The old implementation of `accept_list_item_start` was copied to ToBs because those tests did not pass with the new changes and I am unfamiliar with the `backspace` format. After: ```ruby doc = <<~RDOC foo :: bar :: hi RDOC markup = RDoc::Markup.parse(doc) markup # => [doc: [list: NOTE [item: ["foo ", "bar"]; [para: "hi"]]]] rt = RDoc::Markup::ToRdoc.new.convert(markup) rt # => "foo::\nbar::\n hi\n\n" rt_markup = RDoc::Markup.parse(rt) rt_markup # => [doc: [list: NOTE [item: ["foo", "bar"]; [para: "hi"], blankline]]] ``` https://github.com/ruby/rdoc/commit/c6c51aa900
2024-03-08[ruby/prism] Fix a token incompatibility for `Prism::Translation::Parser`Koichi ITO
Fixes https://github.com/ruby/prism/pull/2512. This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for `HEREDOC_END` with a newline. https://github.com/ruby/prism/commit/b67d1e0c6f
2024-03-08Fix an error for `Prism::Translation::Parser::Lexer`Koichi ITO
This PR fixes the following error for `Prism::Translation::Parser::Lexer` on the main branch: ```console $ cat example.rb 'a' # aあ " #{x} " $ bundle exec rubocop Parser::Source::Range: end_pos must not be less than begin_pos /Users/koic/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/parser-3.3.0.5/lib/parser/source/range.rb:39:in `initialize' /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:299:in `new' /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:299:in `block in to_a' /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:297:in `map' /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:297:in `to_a' /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:263:in `build_tokens' /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:92:in `tokenize' ``` This change was made in https://github.com/ruby/prism/pull/2557, and it seems there was an inconsistency in Range due to forgetting to apply `offset_cache` to `start_offset`.
2024-03-08[ruby/rdoc] Fix ToMarkdown missing newlines for label-listsHartley McGuire
Previously, using ToMarkdown on a label-list would generate output that could not be reparsed by the RDoc::Markdown parser: ``` md = <<~MD apple : a red fruit banana : a yellow fruit MD doc = RDoc::Markdown.parse(md) doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] new_md = doc.accept(RDoc::Markup::ToMarkdown.new) new_md # => "apple\n: a red fruit\nbanana\n: a yellow fruit\n\n" new_doc = RDoc::Markdown.parse(new_md) new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit\nbanana\n: a yellow fruit"]]]] ``` The issue is that the [PHP Markdown Extra spec][1] requires a newline after each definition list item, but ToMarkdown was not putting newlines between label-list items. This commit fixes the issue by properly appending a newline after each label-list item so that the output of ToMarkdown can be reparsed by RDoc::Markdown: ``` md = <<~MD apple : a red fruit banana : a yellow fruit MD doc = RDoc::Markdown.parse(mdoc) doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] new_md = doc.accept(RDoc::Markup::ToMarkdown.new) new_md # => "apple\n: a red fruit\n\nbanana\n: a yellow fruit\n\n" new_doc = RDoc::Markdown.parse(new_md) new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] ``` [1]: https://michelf.ca/projects/php-markdown/extra/#def-list https://github.com/ruby/rdoc/commit/c65266437c
2024-03-08[ruby/irb] rdoc version lock is requiredalpaca-tc
(https://github.com/ruby/irb/pull/897) Some features of irb do not work properly when using the old rdoc. I have compared several major versions and found that it works as intended from 4.0.0. This problem occurs when there is a Gemfile.lock is installed with the old rdoc. I don't know why this Gemfile.lock installs an older rdoc than the ruby bundled rdoc, but specifying the version in the gemspec will at least prevent the problem. NOTE: ruby/irb#704 problem does not occur with this change. The following is test code. ``` ### Usage: ruby __FILE__.rb # # input RDoc and Tab # >> RDoc<Tab> # ### Expect: Display document of RDoc ### Actual: <internal:marshal>:34:in `load': instance of RDoc::Constant needs to have method `marshal_load' (TypeError) require "bundler/inline" gemfile(true) do source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'irb' # gem 'rdoc', '~> 4.0.0' gem 'rdoc', '~> 3.12.0' end require 'rdoc' require 'irb' IRB.start ``` https://github.com/ruby/irb/commit/1a1fbba020
2024-03-07[ruby/prism] Support parsing streamsKevin Newton
https://github.com/ruby/prism/commit/efdc2b7222
2024-03-07[ruby/prism] Fix an AST and token incompatibility for ↵Koichi ITO
`Prism::Translation::Parser` Fixes https://github.com/ruby/prism/pull/2506. This PR fixes an AST and token incompatibility between Parser gem and `Prism::Translation::Parser` for symbols quoted with line breaks. https://github.com/ruby/prism/commit/06ab4df8cd
2024-03-06[ruby/prism] Use the diagnostic types in the parser translation layerKevin Newton
https://github.com/ruby/prism/commit/1a8a0063dc
2024-03-06[ruby/prism] Dispatch on_tlambda and on_tlambegKevin Newton
https://github.com/ruby/prism/commit/1ca58e0121
2024-03-06[ruby/prism] Use the diagnostic types in the ripper translation layerKevin Newton
https://github.com/ruby/prism/commit/a7ab3a41c8
2024-03-06[ruby/prism] Expose types on diagnosticsKevin Newton
https://github.com/ruby/prism/commit/a735c2262f
2024-03-07[ruby/irb] Bump version to v1.12.0Stan Lo
(https://github.com/ruby/irb/pull/895) https://github.com/ruby/irb/commit/a79e84a692
2024-03-06[ruby/prism] Fix parsing errors for `:!@` and `:~@` in SorbetUfuk Kayserilioglu
https://github.com/ruby/prism/commit/dc070b44bc
2024-03-06[ruby/prism] Small changes to make type-checking passUfuk Kayserilioglu
https://github.com/ruby/prism/commit/5b2970e75b
2024-03-06[ruby/prism] Move polyfill to separate file to type-check it independently.Ufuk Kayserilioglu
https://github.com/ruby/prism/commit/2a583b041b
2024-03-06[ruby/prism] Fix some type-checking errors by using different method callsUfuk Kayserilioglu
For example, use `.fetch` or `.dig` instead of `[]`, and use `===` instead of `is_a?` for checking types of objects. https://github.com/ruby/prism/commit/548b54915f
2024-03-06[ruby/prism] Update ripper documentationKevin Newton
https://github.com/ruby/prism/commit/34ba70c4f9
2024-03-06[ruby/prism] Fix implicit local variables in hashesKevin Newton
https://github.com/ruby/prism/commit/05e0c6792c
2024-03-06Move FL_SINGLETON to FL_USER1Jean Boussier
This frees FL_USER0 on both T_MODULE and T_CLASS. Note: prior to this, FL_SINGLETON was never set on T_MODULE, so checking for `FL_SINGLETON` without first checking that `FL_TYPE` was `T_CLASS` was valid. That's no longer the case.
2024-03-06[ruby/prism] Fix up linting in ripper translationKevin Newton
https://github.com/ruby/prism/commit/5cf5f15ee7
2024-03-06[ruby/prism] Only run ripper tests on 3.3+Kevin Newton
https://github.com/ruby/prism/commit/f8b973e8cd
2024-03-06[ruby/prism] Emit bounds for heredocs and words_sep in ripper translationKevin Newton
https://github.com/ruby/prism/commit/e23eae8266
2024-03-06[ruby/prism] Better factoring for heredocs in ripper translationKevin Newton
https://github.com/ruby/prism/commit/5030917eb0
2024-03-06[ruby/prism] More closely mirror on_heredoc_dedent API for ripper translationKevin Newton
https://github.com/ruby/prism/commit/97a031e1d3
2024-03-06[ruby/prism] Stop relying on ripper entirely in ripper translationKevin Newton
https://github.com/ruby/prism/commit/7f7840d318
2024-03-06[ruby/prism] More closely match the ripper API for ripper translationKevin Newton
https://github.com/ruby/prism/commit/716ee0e91a
2024-03-06[ruby/prism] Simplify ripper tests in ripper translationKevin Newton
https://github.com/ruby/prism/commit/a66d066162
2024-03-06[ruby/prism] Stop looking at generated tree in ripper translationKevin Newton
https://github.com/ruby/prism/commit/3f59d07388
2024-03-06[ruby/prism] Better handle splats in MRHS in rescues in ripper translationKevin Newton
https://github.com/ruby/prism/commit/36a0b2e45a
2024-03-06[ruby/prism] Handle single splat in rescue in ripper translationKevin Newton
https://github.com/ruby/prism/commit/76cf29e68d
2024-03-06[ruby/prism] Support elsif in ripper translationKevin Newton
https://github.com/ruby/prism/commit/0c008fcf34
2024-03-06[ruby/prism] Correctly detect void stmts in classes and modules in ripper ↵Kevin Newton
translation https://github.com/ruby/prism/commit/1729e8aec0
2024-03-06[ruby/prism] Handle empty programs in ripper translationKevin Newton
https://github.com/ruby/prism/commit/b607e3a98d
2024-03-06[ruby/prism] Fix up blocks for index nodes in ripper translationKevin Newton
https://github.com/ruby/prism/commit/a35eadce47
2024-03-06[ruby/prism] Allow rescue modifier after MRHS in ripper translationKevin Newton
https://github.com/ruby/prism/commit/37db4d8c2d
2024-03-06[ruby/prism] Handle empty parentheses in lambda in ripper translationKevin Newton
https://github.com/ruby/prism/commit/e0a836ebc2
2024-03-06[ruby/prism] Handle empty embedded expressions in ripper translationKevin Newton
https://github.com/ruby/prism/commit/99eca8b1d2
2024-03-06[ruby/prism] Implement string concat for ripper translationKevin Newton
https://github.com/ruby/prism/commit/6019342278
2024-03-06[ruby/prism] Share argument logic with calls and keywords in ripper translationKevin Newton
https://github.com/ruby/prism/commit/240bb08c2c
2024-03-06[ruby/prism] Better handle splat in MRHSKevin Newton
https://github.com/ruby/prism/commit/8331874218
2024-03-06[ruby/prism] Handle numbered parameters in ripper translationKevin Newton
https://github.com/ruby/prism/commit/cf21c08c0b
2024-03-06[ruby/prism] Disallow keywords as method names in ripper translationKevin Newton
https://github.com/ruby/prism/commit/dc74428e2e
2024-03-06[ruby/prism] Split up multi target visits for methods in ripper translationKevin Newton
https://github.com/ruby/prism/commit/4e7733491f
2024-03-06[ruby/prism] Better split between fcall and command for ripper translationKevin Newton
https://github.com/ruby/prism/commit/972fe60aea
2024-03-06[ruby/prism] Handle trailing commas in method calls for ripper translationKevin Newton
https://github.com/ruby/prism/commit/fe10b5f49f
2024-03-06[ruby/prism] Better handle hash pattern in ripper translationKevin Newton
https://github.com/ruby/prism/commit/4639803277