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

Fixed infinite loop when /** until file end

parent ac0b7080
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ module JsDuck
        elsif @input.check(/\/\*\*/) then
          @tokens << {
            :type => :doc_comment,
            :value => @input.scan_until(/\*\//)
            :value => @input.scan_until(/\*\/|\Z/)
          }
        elsif @input.check(/"/) then
          @tokens << {
+2 −1
Original line number Diff line number Diff line
@@ -50,9 +50,10 @@ class TestLexer < Test::Unit::TestCase
    assert_tokens("a /* foo */ b", [[:ident, "a"], [:ident, "b"]])
  end

  def test_comments_until_file_end
  def test_tokens_until_file_end
    assert_tokens("// ", [])
    assert_tokens("/* ", [])
    assert_tokens("/** ", [[:doc_comment, "/** "]])
  end

  def test_doc_comment