Skip to content

Get rid of curly_block method #13

Closed

Description

@matklad

We have a curly_block method over here: https://github.com/matklad/libsyntax2/blob/357cd3358167daa38f3ff34d225e1501faff6015/src/parser/event_parser/parser.rs#L179.

This is a high-order function which eats a balanced paren sequence inside of {}, which helps quite a lot with error recovery, because all errors are contained in a block. However, this high order function does not help much, and I suggest just removing it and writing while loops by hand, like in here:

https://github.com/matklad/libsyntax2/blob/357cd3358167daa38f3ff34d225e1501faff6015/src/parser/event_parser/grammar/items.rs#L108-L114

Ideally, the error block should handle { specially (by parsing a balanced sequence), like it is done in Kotlin:
https://github.com/JetBrains/kotlin/blob/4d951de616b20feca92f3e9cc9679b2de9e65195/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java#L438

Activity

  1. added a commit that references this issue on Jan 28, 2018
    3cd2b24
  2. added a commit that references this issue on Jan 28, 2018
    4212d28
  3. added a commit that references this issue on Apr 3, 2022
  4. added a commit that references this issue on Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions