Skip to content

Fix colorization of imaginary/rational numbers#1733

Merged
st0012 merged 1 commit into
ruby:masterfrom
Earlopain:colorize-imag-rational
Jun 16, 2026
Merged

Fix colorization of imaginary/rational numbers#1733
st0012 merged 1 commit into
ruby:masterfrom
Earlopain:colorize-imag-rational

Conversation

@Earlopain

Copy link
Copy Markdown
Contributor

In prism there is no singualr RATIONAL/IMAGINARY token. Instead they are more fine-grained.

In prism there is no singualr `RATIONAL`/`IMAGINARY` token.
Instead they are more fine-grained.
Copilot AI review requested due to automatic review settings June 16, 2026 11:51
@Earlopain Earlopain requested a deployment to fork-preview-protection June 16, 2026 11:51 — with GitHub Actions Waiting

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates RDoc::Parser::RubyColorizer to recognize rational/imaginary numeric literal variants (including combined forms) as :value tokens, and adds a regression test to ensure token text and classification are preserved.

Changes:

  • Added coverage in RubyColorizer for integer/float imaginary, rational, and rational-imaginary token types.
  • Added a test validating correct colorization of 2i, 2r, 2ri, and float equivalents.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/rdoc/parser/ruby_colorizer_test.rb Adds a regression test covering rational/imaginary numeric literal tokenization.
lib/rdoc/parser/ruby_colorizer.rb Expands numeric token mapping to include combined rational/imaginary token types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 34 to +43
CONSTANT: :constant,
LABEL: :value,
INTEGER: :value,
INTEGER_IMAGINARY: :value,
INTEGER_RATIONAL: :value,
INTEGER_RATIONAL_IMAGINARY: :value,
FLOAT: :value,
RATIONAL: :value,
IMAGINARY: :value,
FLOAT_IMAGINARY: :value,
FLOAT_RATIONAL: :value,
FLOAT_RATIONAL_IMAGINARY: :value,
Comment on lines 36 to +43
INTEGER: :value,
INTEGER_IMAGINARY: :value,
INTEGER_RATIONAL: :value,
INTEGER_RATIONAL_IMAGINARY: :value,
FLOAT: :value,
RATIONAL: :value,
IMAGINARY: :value,
FLOAT_IMAGINARY: :value,
FLOAT_RATIONAL: :value,
FLOAT_RATIONAL_IMAGINARY: :value,
@st0012 st0012 added the bug label Jun 16, 2026

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@st0012 st0012 merged commit bb8b2d4 into ruby:master Jun 16, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants