Commit f40cdf25 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Allow type definitions to contain numbers.

parent f42d36d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ module JsDuck
    #
    # dot-separated identifiers followed by optional "[]"
    def base_type
      type = @input.scan(/[a-zA-Z_]+(\.[a-zA-Z_]+)*/)
      type = @input.scan(/[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*/)

      if !type
        return false
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ describe JsDuck::TypeParser do
      "RegExp",
      "Ext.form.Panel",
      "Ext.Element",
      "Ext.fx2.Anim",
    ])
    JsDuck::TypeParser.new(relations).parse(str)
  end
@@ -22,6 +23,10 @@ describe JsDuck::TypeParser do
    parse("Ext.form.Panel").should == true
  end

  it "matches type name containing number" do
    parse("Ext.fx2.Anim").should == true
  end

  it "matches array of simple types" do
    parse("Number[]").should == true
  end