Skip to content

Commit a7dae14

Browse files
committed
Add float literal's grammar
1 parent d8dfa75 commit a7dae14

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
@@ -264,6 +264,22 @@ a single integer literal.
264264

265265
#### Floating-point literals
266266

267+
> **<sup>Lexer</sup>**
268+
> FLOAT_LITERAL :
269+
> &nbsp;&nbsp; &nbsp;&nbsp; DEC_LITERAL `.`
270+
> _(not immediately followed by `.`, `_` or an identifier_)
271+
> &nbsp;&nbsp; | DEC_LITERAL FLOAT_EXPONENT
272+
> &nbsp;&nbsp; | DEC_LITERAL `.` DEC_LITERAL FLOAT_EXPONENT<sup>?</sup>
273+
> &nbsp;&nbsp; | DEC_LITERAL (`.` DEC_LITERAL)<sup>?</sup>
274+
> FLOAT_EXPONENT<sup>?</sup> FLOAT_SUFFIX
275+
>
276+
> FLOAT_EXPONENT :
277+
> &nbsp;&nbsp; (`e`|`E`) (`+`|`-`)?
278+
> (DEC_DIGIT|`_`)<sup>\*</sup> DEC_DIGIT (DEC_DIGIT|`_`)<sup>\*</sup>
279+
>
280+
> FLOAT_SUFFIX :
281+
> &nbsp;&nbsp; `f32` | `f64`
282+
267283
A _floating-point literal_ has one of two forms:
268284

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

0 commit comments

Comments
 (0)