Permalink
Browse files

Support E notation for floating point numbers

patch by michalm; reviewed by slebresne for CASSANDRA-4927
  • Loading branch information...
1 parent 8be7e5c commit 07ebbe552a4210907b405428e5babab6c47ea6f5 @pcmanus pcmanus committed Jan 18, 2013
Showing with 8 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +1 −1 doc/cql3/CQL.textile
  3. +6 −1 src/java/org/apache/cassandra/cql3/Cql.g
View
@@ -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)
View
@@ -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).
@@ -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

0 comments on commit 07ebbe5

Please sign in to comment.