Skip to content

Should empty nodes be allowed? #10

Closed

Description

@matklad

In principle, it is possible to have nodes of length zero: this would be an internal node without children.

However such nodes are annoying to work with. For example, with empty nodes there maybe arbitrary number of nodes at a given offset (as opposed to at most two for non-empty nodes). So it seems a great idea to forbid this node.

That means that care must be taken to parse stuff like use foo::92; without empty nodes: we know that there should be a path segment after ::, but we shouldn't create a node for it unconditionally.

A funny edge case here is an empty file: We'll have to create a file node for it, and it will be empty.

Activity

  1. matklad commented on Dec 29, 2018

    @matklad
    ContributorAuthor

    For the time being, only the file node can be empty, and this works out OK

  2. added a commit that references this issue on Apr 3, 2022
  3. added 2 commits that reference this issue on Nov 7, 2025
  4. added a commit that references this issue on Oct 13, 2026
    41f85c0
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions