Commit 1f85767f authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Added support for strings to lexer.

parent 875cd071
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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,
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ DateRange.prototype = {
   * Return beginning date of range
   * @return {Date}
   */
  beg: function() {
  'beg': function() {
    return this.beginDate;
  },
  
@@ -22,7 +22,7 @@ DateRange.prototype = {
   * Return end date of range
   * @return {Date}
   */
  end: function() {
  "end": function() {
    return this.endDate;
  }
};