Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Comments just generally get underfoot #394

Description

@robrix

Comments in the tree mess up all sorts of things. cf #371, #393, and others. We currently have to either make them into the lowest common denominator and add every scoped variable used anywhere to them, or make queries needlessly specific in what they'll match, which couples them overly tightly to the grammar and in any case doesn't work out so well for adjacency patterns (the ones with .s in them).

Most or all comments are unnecessary to stack graph rules, in that we aren't trying to resolve name lookups in or through them (although maybe we would want to jump to definition from within doctests or documentation comments), so maybe we could filter them out of the tree altogether?

Activity

  1. robrix commented on Feb 9, 2024

    @robrix
    ContributorAuthor

    To be precise, we have at least two problems stemming from the intrusion of comments:

    1. Queries matching multiple children of a given node will match comments as well, requiring antimodular treatment of the comment nodes (e.g. adding lots of scoped variables to them which are asemantic and treat comments as sort of the lowest common denominator since they can occur anywhere).
    2. Queries matching a single child of a given node, e.g. a parenthesized expression's… parenthesized… expression… will match comments as well, often requiring rules to be split into one which will run once for the given parent node, and one which will run for every child node (even though there is, semantically, only the one that matters).

    TL;DR: We're working with a CST, we think of ourselves as working with an AST, bugs and hacks are the result.

  2. CleanCut commented on Sep 9, 2025

    @CleanCut

    The github/stack-graphs repository is no longer being maintained. As per #502, I'm closing all issues and pull requests before archiving the repository.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions