Loading lib/jsduck/type_parser.rb +4 −2 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ module JsDuck # The basic type # # <ident> [ "." <ident> ]* [ "[]" ] [ "..." ] # <ident> [ "." <ident> ]* [ "[]" ]* [ "..." ] # # dot-separated identifiers followed by optional "[]" def base_type Loading @@ -72,7 +72,9 @@ module JsDuck return false end @out << "[]" if @input.scan(/\[\]/) while @input.scan(/\[\]/) @out << "[]" end @out << "..." if @input.scan(/\.\.\./) Loading spec/type_parser_spec.rb +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,14 @@ describe JsDuck::TypeParser do parse("Ext.form.Panel[]").should == true end it "matches 2D array" do parse("String[][]").should == true end it "matches 3D array" do parse("String[][][]").should == true end describe "matches alteration of" do it "simple types" do parse("Number/String").should == true Loading Loading
lib/jsduck/type_parser.rb +4 −2 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ module JsDuck # The basic type # # <ident> [ "." <ident> ]* [ "[]" ] [ "..." ] # <ident> [ "." <ident> ]* [ "[]" ]* [ "..." ] # # dot-separated identifiers followed by optional "[]" def base_type Loading @@ -72,7 +72,9 @@ module JsDuck return false end @out << "[]" if @input.scan(/\[\]/) while @input.scan(/\[\]/) @out << "[]" end @out << "..." if @input.scan(/\.\.\./) Loading
spec/type_parser_spec.rb +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,14 @@ describe JsDuck::TypeParser do parse("Ext.form.Panel[]").should == true end it "matches 2D array" do parse("String[][]").should == true end it "matches 3D array" do parse("String[][][]").should == true end describe "matches alteration of" do it "simple types" do parse("Number/String").should == true Loading