Fixed: [Issue 166] 1. is a valid floating-point number.
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/Issue166_SupportOptionalDecimals_Test.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/Issue166_SupportOptionalDecimals_Test.java
new file mode 100644
index 0000000..09732ef
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/Issue166_SupportOptionalDecimals_Test.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.bugs;
+
+import static com.google.eclipse.protobuf.junit.core.Setups.unitTestSetup;
+import static com.google.eclipse.protobuf.junit.core.XtextRule.createWith;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.protobuf.*;
+
+import org.junit.*;
+
+/**
+ * Tests fix for <a href="http://code.google.com/p/protobuf-dt/issues/detail?id=166">Issue 166</a>.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class Issue166_SupportOptionalDecimals_Test {
+
+ @Rule public XtextRule xtext = createWith(unitTestSetup());
+
+ // syntax = "proto2";
+ //
+ // message Test {
+ // optional double something = 1 [default = 1.];
+ // }
+ @Test public void should_support_optional_decimals() {
+ DefaultValueFieldOption option = xtext.find("default", DefaultValueFieldOption.class);
+ DoubleLink link = (DoubleLink) option.getValue();
+ assertThat(link.getTarget(), equalTo(1.0d));
+ }
+}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
index 42cff33..0a95feb 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
@@ -237,6 +237,7 @@
terminal DOUBLE returns ecore::EDouble:
('-')? (NUMBER)* ('.' (NUMBER)+)? |
+ ('-')? (NUMBER)+ ('.') |
('-')? (NUMBER)+ (('e'|'E')('-')? (NUMBER)+) |
'nan' | 'inf' | '-inf';