Loading lib/jsduck/lexer.rb +2 −2 Original line number Diff line number Diff line Loading @@ -97,12 +97,12 @@ module JsDuck elsif @input.check(/'/) @tokens << { :type => :string, :value => eval(@input.scan(/'([^'\\]|\\.)*'/)) :value => @input.scan(/'([^'\\]|\\.)*'/).sub(/^'(.*)'$/, "\\1") } elsif @input.check(/"/) @tokens << { :type => :string, :value => eval(@input.scan(/"([^"\\]|\\.)*"/)) :value => @input.scan(/"([^"\\]|\\.)*"/).sub(/^"(.*)"$/, "\\1") } elsif @input.check(/\//) # Several things begin with dash: Loading spec/lexer_spec.rb +2 −2 Original line number Diff line number Diff line Loading @@ -83,11 +83,11 @@ describe JsDuck::Lexer do end it "when escaped double-quote inside double-quoted string" do lex(@d+@b+@d+@d + ' "blah"').should == [[:string, @d], [:string, "blah"]] lex(@d+@b+@d+@d + ' "blah"').should == [[:string, @b+@d], [:string, "blah"]] end it "when escaped single-quote inside single-quoted string" do lex(@s+@b+@s+@s + ' "blah"').should == [[:string, @s], [:string, "blah"]] lex(@s+@b+@s+@s + ' "blah"').should == [[:string, @b+@s], [:string, "blah"]] end end Loading Loading
lib/jsduck/lexer.rb +2 −2 Original line number Diff line number Diff line Loading @@ -97,12 +97,12 @@ module JsDuck elsif @input.check(/'/) @tokens << { :type => :string, :value => eval(@input.scan(/'([^'\\]|\\.)*'/)) :value => @input.scan(/'([^'\\]|\\.)*'/).sub(/^'(.*)'$/, "\\1") } elsif @input.check(/"/) @tokens << { :type => :string, :value => eval(@input.scan(/"([^"\\]|\\.)*"/)) :value => @input.scan(/"([^"\\]|\\.)*"/).sub(/^"(.*)"$/, "\\1") } elsif @input.check(/\//) # Several things begin with dash: Loading
spec/lexer_spec.rb +2 −2 Original line number Diff line number Diff line Loading @@ -83,11 +83,11 @@ describe JsDuck::Lexer do end it "when escaped double-quote inside double-quoted string" do lex(@d+@b+@d+@d + ' "blah"').should == [[:string, @d], [:string, "blah"]] lex(@d+@b+@d+@d + ' "blah"').should == [[:string, @b+@d], [:string, "blah"]] end it "when escaped single-quote inside single-quoted string" do lex(@s+@b+@s+@s + ' "blah"').should == [[:string, @s], [:string, "blah"]] lex(@s+@b+@s+@s + ' "blah"').should == [[:string, @b+@s], [:string, "blah"]] end end Loading