Skip to content

bug: Private constants are not recognized #343

Description

@flexagoon

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-python

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

Normal constants (FOO_BAR) are properly parsed as constants, but private ones (_FOO_BAR) aren't

Steps To Reproduce/Bad Parse Tree

FOO_BAR = 1
_BAZ_QUX = 2

The first line is parsed as a constant, the second - as a variable

You can even see it right here on Github

Expected Behavior/Parse Tree

They should both be constants

Repro

FOO_BAR = 1
_BAZ_QUX = 2

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