File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,9 +34,13 @@ module RDoc::Parser::RubyColorizer
3434 CONSTANT : :constant ,
3535 LABEL : :value ,
3636 INTEGER : :value ,
37+ INTEGER_IMAGINARY : :value ,
38+ INTEGER_RATIONAL : :value ,
39+ INTEGER_RATIONAL_IMAGINARY : :value ,
3740 FLOAT : :value ,
38- RATIONAL : :value ,
39- IMAGINARY : :value ,
41+ FLOAT_IMAGINARY : :value ,
42+ FLOAT_RATIONAL : :value ,
43+ FLOAT_RATIONAL_IMAGINARY : :value ,
4044 COMMENT : :comment ,
4145 EMBDOC_BEGIN : :comment ,
4246 EMBDOC_LINE : :comment ,
Original file line number Diff line number Diff line change @@ -199,4 +199,25 @@ def f
199199 assert_include ( tokens , token ( :string , '}' ) )
200200 assert_include ( tokens , token ( :string , " heredoc\n " ) )
201201 end
202+
203+ def test_rational_imaginary
204+ code = <<~RUBY
205+ 2i
206+ 2r
207+ 2ri
208+
209+ 2.0i
210+ 2.0r
211+ 2.0ri
212+ RUBY
213+ tokens = RDoc ::Parser ::RubyColorizer . colorize ( code )
214+ assert_equal ( code , tokens . map ( &:text ) . join )
215+
216+ assert_include ( tokens , token ( :value , "2i" ) )
217+ assert_include ( tokens , token ( :value , "2r" ) )
218+ assert_include ( tokens , token ( :value , "2ri" ) )
219+ assert_include ( tokens , token ( :value , "2.0i" ) )
220+ assert_include ( tokens , token ( :value , "2.0r" ) )
221+ assert_include ( tokens , token ( :value , "2.0ri" ) )
222+ end
202223end
You can’t perform that action at this time.
0 commit comments