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

Error resilient codegen #6

Merged
merged 6 commits into from
Nov 24, 2023
Merged

Error resilient codegen #6

merged 6 commits into from
Nov 24, 2023

Conversation

AZWN
Copy link
Collaborator

@AZWN AZWN commented Nov 23, 2023

Makes the code generation more error-resilient.

Test cases like

#[test]
fn test_repeat() {
    use Alphabet::*;

    compile_regex!(type Machine<Alphabet> = A : B); // note the typo ':'

    assert!(Machine::new().accepts([A]));
    assert!(Machine::new().accepts([B]));
    assert!(!Machine::new().accepts([]));
    assert!(!Machine::new().accepts([B, A]));
    assert!(!Machine::new().accepts([A, B]));
    assert!(!Machine::new().accepts([A, A]));
}

Will now only generate 1 error (on the macro), instead of one on every reference to Machine.

@AZWN AZWN requested a review from jdonszelmann November 23, 2023 14:29
@AZWN AZWN self-assigned this Nov 23, 2023
@jdonszelmann
Copy link
Collaborator

Very cool

@AZWN AZWN merged commit ac8348f into regex Nov 24, 2023
7 of 9 checks passed
@AZWN AZWN deleted the error-resilient-codegen branch November 28, 2023 09:11
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

Successfully merging this pull request may close these issues.

2 participants