Loading jsduck.rb +16 −0 Original line number Diff line number Diff line Loading @@ -154,6 +154,8 @@ module JsDuck while !@input.eos? do if look(/@class\b/) then at_class elsif look(/@extends\b/) then at_extends elsif look(/@function\b/) then at_function elsif look(/@param\b/) then Loading @@ -179,6 +181,20 @@ module JsDuck skip_white end # matches @extends name ... def at_extends match(/@extends/) unless @tags[:class] @tags[:class] = {:doc => ""} end @current_tag = @tags[:class] skip_white if look(/\w/) then @current_tag[:extends] = ident end skip_white end # matches @return {type} ... def at_function match(/@function/) Loading tc_jsduck.rb +13 −0 Original line number Diff line number Diff line Loading @@ -225,5 +225,18 @@ function Foo(){} assert_equal("My class", docs[0][:class][:doc]) end def test_explicit_extends docs = JsDuck.parse(" /** * @class Foo * @extends Bar * My class */ ") assert_equal("Foo", docs[0][:class][:name]) assert_equal("Bar", docs[0][:class][:extends]) assert_equal("My class", docs[0][:class][:doc]) end end Loading
jsduck.rb +16 −0 Original line number Diff line number Diff line Loading @@ -154,6 +154,8 @@ module JsDuck while !@input.eos? do if look(/@class\b/) then at_class elsif look(/@extends\b/) then at_extends elsif look(/@function\b/) then at_function elsif look(/@param\b/) then Loading @@ -179,6 +181,20 @@ module JsDuck skip_white end # matches @extends name ... def at_extends match(/@extends/) unless @tags[:class] @tags[:class] = {:doc => ""} end @current_tag = @tags[:class] skip_white if look(/\w/) then @current_tag[:extends] = ident end skip_white end # matches @return {type} ... def at_function match(/@function/) Loading
tc_jsduck.rb +13 −0 Original line number Diff line number Diff line Loading @@ -225,5 +225,18 @@ function Foo(){} assert_equal("My class", docs[0][:class][:doc]) end def test_explicit_extends docs = JsDuck.parse(" /** * @class Foo * @extends Bar * My class */ ") assert_equal("Foo", docs[0][:class][:name]) assert_equal("Bar", docs[0][:class][:extends]) assert_equal("My class", docs[0][:class][:doc]) end end