Loading doc.rb +11 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,16 @@ class Lexer :type => :doc_comment, :value => @input.scan_until(/\*\//) } elsif @input.check(/"/) then @tokens << { :type => :string, :value => eval(@input.scan(/"([^\\]|\\.)*"/)) } elsif @input.check(/'/) then @tokens << { :type => :string, :value => eval(@input.scan(/'([^\\]|\\.)*'/)) } elsif @input.check(/./) then @tokens << { :type => :operator, Loading Loading @@ -92,7 +102,7 @@ while !lex.empty? do lex.next # var name = function(){ puts "function " + lex.next elsif lex.look(:keyword, ":", "function") then elsif lex.look(:keyword, ":", "function") || lex.look(:string, ":", "function") then # name: function(){ puts "function " + lex.next end Loading test.js +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ DateRange.prototype = { * Return beginning date of range * @return {Date} */ beg: function() { 'beg': function() { return this.beginDate; }, Loading @@ -22,7 +22,7 @@ DateRange.prototype = { * Return end date of range * @return {Date} */ end: function() { "end": function() { return this.endDate; } }; Loading Loading
doc.rb +11 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,16 @@ class Lexer :type => :doc_comment, :value => @input.scan_until(/\*\//) } elsif @input.check(/"/) then @tokens << { :type => :string, :value => eval(@input.scan(/"([^\\]|\\.)*"/)) } elsif @input.check(/'/) then @tokens << { :type => :string, :value => eval(@input.scan(/'([^\\]|\\.)*'/)) } elsif @input.check(/./) then @tokens << { :type => :operator, Loading Loading @@ -92,7 +102,7 @@ while !lex.empty? do lex.next # var name = function(){ puts "function " + lex.next elsif lex.look(:keyword, ":", "function") then elsif lex.look(:keyword, ":", "function") || lex.look(:string, ":", "function") then # name: function(){ puts "function " + lex.next end Loading
test.js +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ DateRange.prototype = { * Return beginning date of range * @return {Date} */ beg: function() { 'beg': function() { return this.beginDate; }, Loading @@ -22,7 +22,7 @@ DateRange.prototype = { * Return end date of range * @return {Date} */ end: function() { "end": function() { return this.endDate; } }; Loading