Support E notation for floating point numbers

patch by michalm; reviewed by slebresne for CASSANDRA-4927
This commit is contained in:
Sylvain Lebresne 2013-01-18 14:35:23 +01:00
parent 8be7e5c0eb
commit 07ebbe552a
3 changed files with 8 additions and 2 deletions

View File

@ -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 File

@ -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).

View File

@ -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