You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2013/01/18 14:39:06 UTC

[3/5] git commit: Support E notation for floating point numbers

Support E notation for floating point numbers

patch by michalm; reviewed by slebresne for CASSANDRA-4927


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/07ebbe55
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/07ebbe55
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/07ebbe55

Branch: refs/heads/trunk
Commit: 07ebbe552a4210907b405428e5babab6c47ea6f5
Parents: 8be7e5c
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 18 14:35:23 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jan 18 14:35:23 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                              |    1 +
 doc/cql3/CQL.textile                     |    2 +-
 src/java/org/apache/cassandra/cql3/Cql.g |    7 ++++++-
 3 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/07ebbe55/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c254bf9..16172ec 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -39,6 +39,7 @@
  * fix streaming progress report for compresed files (CASSANDRA-5130)
  * Coverage analysis for low-CL queries (CASSANDRA-4858)
  * Stop interpreting dates as valid timeUUID value (CASSANDRA-4936)
+ * Adds E notation for floating point numbers (CASSANDRA-4927)
 Merged from 1.1:
  * Simplify CompressedRandomAccessReader to work around JDK FD bug (CASSANDRA-5088)
  * Improve handling a changing target throttle rate mid-compaction (CASSANDRA-5087)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/07ebbe55/doc/cql3/CQL.textile
----------------------------------------------------------------------
diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile
index 93122b9..ac674e3 100644
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@ -49,7 +49,7 @@ h3(#constants). Constants
 
 CQL defines 4 kinds of _implicitly-typed constants_: strings, numbers, uuids and booleans:
 * A string constant is an arbitrary sequence of characters characters enclosed by single-quote(@'@). One can include a single-quote in a string by repeating it, e.g. @'It''s raining today'@. Those are not to be confused with quoted identifiers that use double-quotes.
-* Numeric constants are either integer constant defined by @-?[0-9]+@ or a float constant defined by @-?[0-9]+.[0-9]*@.
+* Numeric constants are either integer constant defined by @'-'?[0-9]+@ or a float constant defined by @'-'?[0-9]+('.'[0-9]*)?([eE][+-]?[0-9+])?@.
 * A "UUID":http://en.wikipedia.org/wiki/Universally_unique_identifier constant is defined by @hex{8}-hex{4}-hex{4}-hex{4}-hex{12}@ where @hex@ is an hexadecimal character, e.g. @[0-9a-fA-F]@ and @{4}@ is the number of such characters.
 * A boolean constant is either @true@ or @false@ up to case-insensitivity (i.e. @True@ is a valid boolean constant).
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/07ebbe55/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g b/src/java/org/apache/cassandra/cql3/Cql.g
index b866bd1..7f587f1 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -1006,6 +1006,10 @@ fragment HEX
     : ('A'..'F' | 'a'..'f' | '0'..'9')
     ;
 
+fragment EXPONENT
+    : E ('+' | '-')? DIGIT+
+    ;
+
 INTEGER
     : '-'? DIGIT+
     ;
@@ -1019,7 +1023,8 @@ QMARK
  * to support multiple (see @lexer::members near the top of the grammar).
  */
 FLOAT
-    : INTEGER '.' DIGIT*
+    : INTEGER EXPONENT
+    | INTEGER '.' DIGIT* EXPONENT?
     ;
 
 IDENT