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

Implement matchString in C backend #1267

Merged
merged 5 commits into from
Nov 22, 2024
Merged

Conversation

johnynek
Copy link
Owner

No description provided.

@johnynek johnynek changed the title WIP: Implement matchString in C backend Implement matchString in C backend Nov 22, 2024
@johnynek
Copy link
Owner Author

looks like we are generating matching code in the wrong order:

BValue ___bsts_g_Bosatsu_l_Char_l_starts__with__foo(BValue __bsts_b_s0) {
    int __bsts_l_offset70 = 0;
    __bsts_l_offset70 = __bsts_l_offset70 + (3);
    return BSTS_AND(bsts_string_matches_at(__bsts_b_s0,
            __bsts_l_offset70,
            BSTS_NULL_TERM_STATIC_STR("foo")),
        1) ?
        alloc_enum0(1) :
        alloc_enum0(0);
}

note how we update the length of foo before we check if we match. We should update after and only if that is successful

@johnynek
Copy link
Owner Author

oh, I think onExpr in the C code may just be wrong... it is ignoring the fact that the scope can change. That or the usage of it in andCode.

@johnynek johnynek merged commit 09e3e62 into main Nov 22, 2024
8 checks passed
@johnynek johnynek deleted the oscar/20241120_c_match_string branch November 22, 2024 20:29
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.

1 participant