Skip to content

Commit 6d47aa3

Browse files
committed
Ignore underscores in calculator module
1 parent b5b28a0 commit 6d47aa3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/calculator/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ impl Calc {
167167
let mut iter = chars.enumerate().peekable();
168168
while let Some((idx, c)) = iter.next() {
169169
log::trace!("Character in tokenisation is: {c}");
170+
if c == '_' {
171+
continue;
172+
}
173+
170174
if c.is_digit(BASE) || c == '.' {
171175
log::trace!("Character was num: {c}");
172176
number_buf.push(c);
@@ -177,6 +181,9 @@ impl Calc {
177181
log::trace!("Next character ({}) was a num or .", next.1);
178182
number_buf.push(next.1)
179183
}
184+
Some((_, '_')) => {
185+
// do nothing
186+
}
180187
// No number next
181188
_ => {
182189
log::trace!("Got to num next with: {c}");

0 commit comments

Comments
 (0)