Skip to content

Conversation

@delichik
Copy link

When parsing something like:

foobar1 {
    sub1 arg1
    sub2
    sub_foobar1 sub_foobar1_arg {
        sub3 arg3
        sub4
    }
}

foobar2 {
}

I noticed a strange issue:

  • Calling Next() on sub_foobar1 works fine — I correctly get sub_foobar1_arg.
  • But right after that, calling NextBlock() and then Val() gives me… {.

What I actually expect there is sub3.

Changes:

When nesting > 0, if the next token is {, it means we've entered a new block.
So we move the cursor back and continue with the same logic as when nesting == 0 in old code.

Now NextBlock() correctly steps into the nested block and Val() returns the expected first item (sub3).

delichik and others added 3 commits November 14, 2025 16:17
fix handle multiple levels of nested blocks

Signed-off-by: delichik <[email protected]>
@delichik delichik marked this pull request as ready for review November 14, 2025 08:41
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