Consume a sequence of numbers with the given radix, the digits can be decorated with underscores like this: '`1_2_3_4`' == '1234'
(&mut self, number: &mut LexedText, radix: Radix)
| 1160 | /// the digits can be decorated with underscores |
| 1161 | /// like this: '`1_2_3_4`' == '1234' |
| 1162 | fn radix_run(&mut self, number: &mut LexedText, radix: Radix) { |
| 1163 | loop { |
| 1164 | if let Some(c) = self.cursor.eat_if(|c| radix.is_digit(c)) { |
| 1165 | number.push(c); |
| 1166 | } |
| 1167 | // Number that contains `_` separators. Remove them from the parsed text. |
| 1168 | else if self.cursor.first() == '_' && radix.is_digit(self.cursor.second()) { |
| 1169 | // Skip over `_` |
| 1170 | self.cursor.bump(); |
| 1171 | number.skip_char(); |
| 1172 | } else { |
| 1173 | break; |
| 1174 | } |
| 1175 | } |
| 1176 | } |
| 1177 | |
| 1178 | /// Lex a single comment. |
| 1179 | fn lex_comment(&mut self) -> TokenKind { |