Skip to content

Commit e1ea48a

Browse files
authored
Merge pull request #109 from brauliobz/grammar_float_literals
Add float literal's grammar
2 parents 4b358ac + a7dae14 commit e1ea48a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/tokens.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,22 @@ a single integer literal.
333333

334334
#### Floating-point literals
335335

336+
> **<sup>Lexer</sup>**
337+
> FLOAT_LITERAL :
338+
> &nbsp;&nbsp; &nbsp;&nbsp; DEC_LITERAL `.`
339+
> _(not immediately followed by `.`, `_` or an identifier_)
340+
> &nbsp;&nbsp; | DEC_LITERAL FLOAT_EXPONENT
341+
> &nbsp;&nbsp; | DEC_LITERAL `.` DEC_LITERAL FLOAT_EXPONENT<sup>?</sup>
342+
> &nbsp;&nbsp; | DEC_LITERAL (`.` DEC_LITERAL)<sup>?</sup>
343+
> FLOAT_EXPONENT<sup>?</sup> FLOAT_SUFFIX
344+
>
345+
> FLOAT_EXPONENT :
346+
> &nbsp;&nbsp; (`e`|`E`) (`+`|`-`)?
347+
> (DEC_DIGIT|`_`)<sup>\*</sup> DEC_DIGIT (DEC_DIGIT|`_`)<sup>\*</sup>
348+
>
349+
> FLOAT_SUFFIX :
350+
> &nbsp;&nbsp; `f32` | `f64`
351+
336352
A _floating-point literal_ has one of two forms:
337353

338354
* A _decimal literal_ followed by a period character `U+002E` (`.`). This is

0 commit comments

Comments
 (0)