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

fix: switch block/expression order #13

Merged
merged 1 commit into from
Feb 15, 2025
Merged

fix: switch block/expression order #13

merged 1 commit into from
Feb 15, 2025

Conversation

hypno2000
Copy link
Contributor

I noticed a situation where meta.block.c3 nesting was getting messed up.

For example in in this code:

fn void! loadShader() {
    g_vertexShader = createShaderModule(&VERTEX_CODE)!;
    g_fragmentShader = createShaderModule(&FRAGMENT_CODE)!;
    g_vertexShaderStageInfo[0] = {
        .sType = vk::STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
        .stage = vk::ShaderStageFlags { .vertex },
        .module_ = g_vertexShader,
        .pName = "main",
    };
    g_vertexShaderStageInfo[1] = {
        .sType = vk::STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
        .stage = vk::ShaderStageFlags { .fragment },
        .module_ = g_fragmentShader,
        .pName = "main",
    };
}

Inside the function i got this:

punctuation.section.block.begin.c3
meta.block.c3
meta.function.c3
source.c3

Inside next initializer list block i got that:

meta.block.c3
meta.block.c3
meta.function.c3
source.c3

This is correct so far. But then inside { .vertex } it did not increase the nesting of meta.block.c3 anymore and after that point the blocks were not all blocks were closed.

The problem turned out to be that inside statement it matched a block before expression so it took that as a block instead of initializer_list which is an expression.

@lerno lerno merged commit 6e52182 into c3lang:main Feb 15, 2025
@lerno
Copy link
Contributor

lerno commented Feb 15, 2025

Thank you!

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