summaryrefslogtreecommitdiff
path: root/grammar
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2019-11-29 18:21:16 -0800
committerAdrian Thurston <thurston@colm.net>2019-11-29 18:21:16 -0800
commit26698c0cf88015653e2503d0ab5e44f63f77e6fe (patch)
tree83ac54dc7f548550e3dc1da7160e67ef7b36dfcf /grammar
parentaa76fc8781d820ec6bf42b92dd7a35f65e2e4612 (diff)
downloadcolm-26698c0cf88015653e2503d0ab5e44f63f77e6fe.tar.gz
rust grammar: partial impl of floats
Diffstat (limited to 'grammar')
-rw-r--r--grammar/rust.lm12
1 files changed, 10 insertions, 2 deletions
diff --git a/grammar/rust.lm b/grammar/rust.lm
index 45e01d73..ad6d25d8 100644
--- a/grammar/rust.lm
+++ b/grammar/rust.lm
@@ -31,9 +31,17 @@ lex
( ( 'u' | 'i' ) [a-z0-9]+ )?
/
+ rl float_exponent
+ / ( [eE] [+\-]? [0-9_]* [0-9] [0-9_]* )? /
+
+ rl float_suffix
+ / ( 'f32' | 'f64' )? /
+
+ # Not implemented: DEC_LITERAL . (not immediately followed by ., _ or an identifier)
token float/
- [0-9]+ '.' [0-9]+
- ( 'f32' | 'f64' )?
+ [0-9]+ float_exponent |
+ [0-9]+ '.' [0-9]+ float_exponent? |
+ [0-9]+ ( '.' [0-9]+ )? float_exponent? float_suffix
/
token raw_string /