diff --git a/lib/jsduck/lexer.rb b/lib/jsduck/lexer.rb
index <HASH>..<HASH> 100644
--- a/lib/jsduck/lexer.rb
+++ b/lib/jsduck/lexer.rb
@@ -72,9 +72,11 @@ module JsDuck
       while !@input.eos? do
         skip_white_and_comments
         if @input.check(/[0-9]+/)
+          nr = @input.scan(/[0-9]+(\.[0-9]*)?/)
           @tokens << {
             :type => :number,
-            :value => eval(@input.scan(/[0-9]+(\.[0-9]*)?/))
+            # When number ends with ".", append "0" so Ruby eval will work
+            :value => eval(/\.$/ =~ nr ? nr+"0" : nr)
           }
         elsif @input.check(/\w+/)
           value = @input.scan(/\w+/)
diff --git a/spec/lexer_spec.rb b/spec/lexer_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lexer_spec.rb
+++ b/spec/lexer_spec.rb
@@ -91,6 +91,10 @@ describe JsDuck::Lexer do
     end
   end
 
+  it "evaluates floating-point numbers with no digits after dot" do
+    lex("alert(5.)")[2].should == [:number, 5.0]
+  end
+
   it "ignores one-line comments" do
     lex("a // foo\n b").should == [[:ident, "a"], [:ident, "b"]]
   end
Fix parsing of floats that end with dot.