@@ -861,6 +861,23 @@ def parse_constant container, tk, comment, ignore_constants = false
861861 eq_tk = get_tk
862862 end
863863
864+ is_array_or_hash = false
865+ if TkfLBRACK === eq_tk
866+ nest = 1
867+ while bracket_tk = get_tk
868+ case bracket_tk
869+ when TkfLBRACK , TkLBRACK
870+ nest += 1
871+ when TkRBRACK
872+ nest -= 1
873+ break if nest == 0
874+ end
875+ end
876+ skip_tkspace false
877+ eq_tk = get_tk
878+ is_array_or_hash = true
879+ end
880+
864881 unless TkASSIGN === eq_tk then
865882 unget_tk eq_tk
866883 return false
@@ -874,7 +891,7 @@ def parse_constant container, tk, comment, ignore_constants = false
874891 value = ''
875892 con = RDoc ::Constant . new name , value , comment
876893
877- body = parse_constant_body container , con
894+ body = parse_constant_body container , con , is_array_or_hash
878895
879896 return unless body
880897
@@ -883,13 +900,15 @@ def parse_constant container, tk, comment, ignore_constants = false
883900 con . line = line_no
884901 read_documentation_modifiers con , RDoc ::CONSTANT_MODIFIERS
885902
903+ return if is_array_or_hash
904+
886905 @stats . add_constant con
887906 container . add_constant con
888907
889908 true
890909 end
891910
892- def parse_constant_body container , constant # :nodoc:
911+ def parse_constant_body container , constant , is_array_or_hash # :nodoc:
893912 nest = 0
894913 rhs_name = ''
895914
@@ -918,7 +937,7 @@ def parse_constant_body container, constant # :nodoc:
918937 rhs_name << tk . name
919938
920939 if nest <= 0 and TkNL === peek_tk then
921- create_module_alias container , constant , rhs_name
940+ create_module_alias container , constant , rhs_name unless is_array_or_hash
922941 break
923942 end
924943 when TkNL then
0 commit comments