Support Hex, Binary, and Octal number literals #20

Merged
mlokis merged 3 commits from :trunk into trunk 2024-09-01 14:19:14 -05:00
Contributor

I don't think I broke anything ❤️

I don't think I broke anything ❤️
koniifer added 2 commits 2024-09-01 12:47:19 -05:00
mlokis requested changes 2024-09-01 12:53:41 -05:00
mlokis left a comment
Collaborator

there are glaring bugs

there are glaring bugs
@ -293,2 +293,4 @@
let kind = match c {
..=b' ' => continue,
b'0' if self.advance_if(b'x') => {
while let Some(b'0'..=b'9') = self.peek() {
Collaborator

this should account for hex digits

this should account for hex digits
mlokis marked this conversation as resolved
@ -295,0 +299,4 @@
T::Number
}
b'0' if self.advance_if(b'b') => {
while let Some(b'0'..=b'9') = self.peek() {
Collaborator

should only accept [01]

should only accept `[01]`
mlokis marked this conversation as resolved
@ -295,0 +305,4 @@
T::Number
}
b'0' if self.advance_if(b'o') => {
while let Some(b'0'..=b'9') = self.peek() {
Collaborator

same here but octal

same here but octal
mlokis marked this conversation as resolved
@ -397,0 +394,4 @@
value: {
let slice = self.lexer.slice(token.range());
let (slice, radix) = match &slice.get(0..2) {
Some("0x") => (slice.trim_start_matches("0x"), 16),
Collaborator

the radixes are wrong

the radixes are wrong
mlokis marked this conversation as resolved
koniifer added 1 commit 2024-09-01 14:08:08 -05:00
mlokis merged commit 4e9d6094bd into trunk 2024-09-01 14:19:14 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: AbleOS/holey-bytes#20
No description provided.