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

No-Intro name parsing library that might be useful #7

Closed
chyyran opened this issue Mar 30, 2021 · 6 comments
Closed

No-Intro name parsing library that might be useful #7

chyyran opened this issue Mar 30, 2021 · 6 comments

Comments

@chyyran
Copy link

chyyran commented Mar 30, 2021

Hi there,
I saw your project when I was publishing my crate shiratsu-naming and thought it might have some use for oxyromon.

I use shiratsu-naming to parse NoIntro, GoodTools and TOSEC names when generating DAT file databases. I've recently given it a rewrite and refactored it out into its own library. From my own testing it handles edge cases fairly well, and supports all three naming conventions.

Feel free to ask me any questions, or on the other hand, close this issue if you're not interested.

@alucryd
Copy link
Owner

alucryd commented Mar 31, 2021

Hey, that could be useful indeed, right now I'm using standard regexes to extract what I need, but who knows what I'll have to extract from those names in the future. I'll give your library a go, thanks!

@alucryd
Copy link
Owner

alucryd commented Mar 31, 2021

@chyyran I found a possible bug.

The Sega Genesis dat contains a game from Argentina Truco '96 (Argentina) (Unl). The region is correctly serialized to AR, but deserialization fails with BadRegionCode(TOSEC, 0, 0).

I see Argentina is not listed in the TOSEC documentation, and thus missing from your TOSEC_REGION constant. Would it be possible to include it?

@chyyran
Copy link
Author

chyyran commented Mar 31, 2021

Thanks for catching that, should be fixed as of 0.1.3.

Added this test to confirm

    #[test]
    fn parse_argentina()
    {
        assert_eq!(do_parse("Truco '96 (Argentina) (Unl)"),
        Ok(("",
            vec![NoIntroToken::Title("Truco '96"),
            NoIntroToken::Region(vec!["Argentina"], vec![Region::Argentina]),
            NoIntroToken::Flag(FlagType::Parenthesized, "Unl")]
        )));

        assert_eq!(Ok(String::from("Truco '96 (Argentina) (Unl)")), NoIntroName
            ::try_parse("Truco '96 (Argentina) (Unl)").map(|s| s.to_string()));

        assert_eq!("AR", Region::Argentina.as_ref());
        assert_eq!("AR", Region::to_normalized_region_string(&[Region::Argentina]));
        assert_eq!(Ok(vec![Region::Argentina]), Region::try_from_tosec_region("AR"));
    }

@alucryd
Copy link
Owner

alucryd commented Mar 31, 2021

Awesome, thanks for the quick fix!

@alucryd
Copy link
Owner

alucryd commented Apr 1, 2021

Pushed the integration earlier today 84186bb.

Thanks for sharing your work!

@alucryd alucryd closed this as completed Apr 1, 2021
@chyyran
Copy link
Author

chyyran commented Apr 1, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants