From a7dae14b6588715047ae76018537824365d2f456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A1ulio=20Bezerra?= Date: Tue, 5 Sep 2017 13:40:58 -0300 Subject: [PATCH] Add float literal's grammar --- src/tokens.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tokens.md b/src/tokens.md index 3163a9de6..22e8f6852 100644 --- a/src/tokens.md +++ b/src/tokens.md @@ -264,6 +264,22 @@ a single integer literal. #### Floating-point literals +> **Lexer** +> FLOAT_LITERAL : +>       DEC_LITERAL `.` +> _(not immediately followed by `.`, `_` or an identifier_) +>    | DEC_LITERAL FLOAT_EXPONENT +>    | DEC_LITERAL `.` DEC_LITERAL FLOAT_EXPONENT? +>    | DEC_LITERAL (`.` DEC_LITERAL)? +> FLOAT_EXPONENT? FLOAT_SUFFIX +> +> FLOAT_EXPONENT : +>    (`e`|`E`) (`+`|`-`)? +> (DEC_DIGIT|`_`)\* DEC_DIGIT (DEC_DIGIT|`_`)\* +> +> FLOAT_SUFFIX : +>    `f32` | `f64` + A _floating-point literal_ has one of two forms: * A _decimal literal_ followed by a period character `U+002E` (`.`). This is