Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use roman-numerals-rs #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use roman-numerals-rs
AA-Turner committed Mar 3, 2025

Verified

This commit was signed with the committer’s verified signature.
melroy89 Melroy van den Berg
commit 5947c54ce97fd41eb71cf9f0acc1a517e1dd7afc
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ edition = "2021"
members = ["bench"]

[dependencies]
numerals = "0.1"
roman-numerals-rs = "3.1.0"
paste = "1"
strum = { version = "0.26", features = ["derive"] }
unicode-normalization = "0.1"
6 changes: 3 additions & 3 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use std::fmt;
use std::ops::Range;
use std::str::FromStr;

use numerals::roman::Roman;
use roman_numerals_rs::RomanNumeral;
use strum::{AsRefStr, Display, EnumString};

use crate::{chunk::*, Span, Spanned};
@@ -115,8 +115,8 @@ impl Type for i64 {

if let Ok(n) = s.parse::<i64>() {
Ok(n)
} else if let Some(roman) = Roman::parse(s) {
Ok(roman.value() as i64)
} else if let Ok(roman) = s.parse::<RomanNumeral>() {
Ok(roman.as_u16() as i64)
} else if span.is_empty() {
Err(TypeError::new(span, TypeErrorKind::MissingNumber))
} else {