Loading lib/jsduck/js_parser.rb +13 −1 Original line number Diff line number Diff line Loading @@ -156,12 +156,14 @@ module JsDuck return chain end # <expression> := <function> | <ext-extend> | <literal> # <expression> := <function> | <ext-extend> | <ext-base-css-prefix> | <literal> def expression if look("function") function elsif ext_look(:ns, ".", "extend") ext_extend elsif ext_look(:ns, ".", "baseCSSPrefix", "+", :string) ext_base_css_prefix else my_literal end Loading Loading @@ -202,6 +204,16 @@ module JsDuck } end # <ext-base-css-prefix> := "Ext" "." "baseCSSPrefix" "+" <string> def ext_base_css_prefix match(:ident, ".", "baseCSSPrefix", "+") return { :type => :literal, :class => "String", :value => '"x-' + match(:string)[:value] + '"', } end # <ext-define> := "Ext" "." ["define" | "ClassManager" "." "create" ] "(" <string> "," <ext-define-cfg> def ext_define match(:ident, "."); Loading spec/aggregator_default_values_spec.rb +14 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,20 @@ describe JsDuck::Aggregator do end end describe "cfg with implicit string value starting with Ext.baseCSSPrefix" do before do @doc = parse(<<-EOS)[0] /** * @cfg foo Something */ foo: Ext.baseCSSPrefix + "foo" EOS end it "replaces Ext.baseCSSPrefix with 'x-'" do @doc[:default].should == '"x-foo"' end end describe "cfg with implicit name followed by code field with another name" do before do @doc = parse(<<-EOS)[0] Loading Loading
lib/jsduck/js_parser.rb +13 −1 Original line number Diff line number Diff line Loading @@ -156,12 +156,14 @@ module JsDuck return chain end # <expression> := <function> | <ext-extend> | <literal> # <expression> := <function> | <ext-extend> | <ext-base-css-prefix> | <literal> def expression if look("function") function elsif ext_look(:ns, ".", "extend") ext_extend elsif ext_look(:ns, ".", "baseCSSPrefix", "+", :string) ext_base_css_prefix else my_literal end Loading Loading @@ -202,6 +204,16 @@ module JsDuck } end # <ext-base-css-prefix> := "Ext" "." "baseCSSPrefix" "+" <string> def ext_base_css_prefix match(:ident, ".", "baseCSSPrefix", "+") return { :type => :literal, :class => "String", :value => '"x-' + match(:string)[:value] + '"', } end # <ext-define> := "Ext" "." ["define" | "ClassManager" "." "create" ] "(" <string> "," <ext-define-cfg> def ext_define match(:ident, "."); Loading
spec/aggregator_default_values_spec.rb +14 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,20 @@ describe JsDuck::Aggregator do end end describe "cfg with implicit string value starting with Ext.baseCSSPrefix" do before do @doc = parse(<<-EOS)[0] /** * @cfg foo Something */ foo: Ext.baseCSSPrefix + "foo" EOS end it "replaces Ext.baseCSSPrefix with 'x-'" do @doc[:default].should == '"x-foo"' end end describe "cfg with implicit name followed by code field with another name" do before do @doc = parse(<<-EOS)[0] Loading