Loading lib/jsduck/type_parser.rb +9 −3 Original line number Diff line number Diff line Loading @@ -55,17 +55,23 @@ module JsDuck # The basic type # # <ident> [ "." <ident> ]* [ "[]" ]* [ "..." ] # <basic-type> ::= <type-name> [ "[]" ]* [ "..." ] # # <type-name> ::= <ident-chain> | "*" # # <ident-chain> ::= <ident> [ "." <ident> ]* # # <ident> ::= [a-zA-Z0-9_]+ # # dot-separated identifiers followed by optional "[]" def base_type type = @input.scan(/[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*/) type = @input.scan(/[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*|\*/) if !type return false elsif @relations[type] @out << @formatter.link(type, nil, type) elsif @relations.ignore?(type) || type == "undefined" elsif @relations.ignore?(type) || type == "undefined" || type == "*" @out << type else @error = :name Loading spec/type_parser_spec.rb +10 −0 Original line number Diff line number Diff line Loading @@ -109,5 +109,15 @@ describe JsDuck::TypeParser do end end # Type expressions supported by closure compiler: # https://developers.google.com/closure/compiler/docs/js-for-compiler#types describe "supporting closure compiler" do it "matches the ALL type" do parse("*").should == true end end end Loading
lib/jsduck/type_parser.rb +9 −3 Original line number Diff line number Diff line Loading @@ -55,17 +55,23 @@ module JsDuck # The basic type # # <ident> [ "." <ident> ]* [ "[]" ]* [ "..." ] # <basic-type> ::= <type-name> [ "[]" ]* [ "..." ] # # <type-name> ::= <ident-chain> | "*" # # <ident-chain> ::= <ident> [ "." <ident> ]* # # <ident> ::= [a-zA-Z0-9_]+ # # dot-separated identifiers followed by optional "[]" def base_type type = @input.scan(/[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*/) type = @input.scan(/[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*|\*/) if !type return false elsif @relations[type] @out << @formatter.link(type, nil, type) elsif @relations.ignore?(type) || type == "undefined" elsif @relations.ignore?(type) || type == "undefined" || type == "*" @out << type else @error = :name Loading
spec/type_parser_spec.rb +10 −0 Original line number Diff line number Diff line Loading @@ -109,5 +109,15 @@ describe JsDuck::TypeParser do end end # Type expressions supported by closure compiler: # https://developers.google.com/closure/compiler/docs/js-for-compiler#types describe "supporting closure compiler" do it "matches the ALL type" do parse("*").should == true end end end