code: def get_label_names(ctx):
      
      labels = [
          label
          for label in ctx.__dict__
          if not label.startswith("_")
          and label
          not in [
              "children",
              "exception",
              "invokingState",
              "parentCtx",
              "parser",
              "start",
              "stop",
          ]
      ]
      return labels
docs: Get labels defined in an ANTLR context for a parser rule