parser: support float expressions

This commit is contained in:
Ryan Chandler 2022-08-09 00:04:14 +01:00
parent ce4e1e1152
commit d898216706
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
2 changed files with 8 additions and 0 deletions

View File

@ -303,6 +303,9 @@ pub enum Expression {
Int {
i: i64
},
Float {
f: f64,
},
Variable {
name: String
},

View File

@ -992,6 +992,11 @@ impl Parser {
self.next();
e
},
TokenKind::Float(f) => {
let f = Expression::Float { f: *f };
self.next();
f
},
TokenKind::Identifier(i) | TokenKind::QualifiedIdentifier(i) | TokenKind::FullyQualifiedIdentifier(i) => {
let e = Expression::Identifier { name: i.to_string() };
self.next();