code: def get_field_names(ctx):
      
      # this does not include labels and literals, only rule names and token names
      # TODO: check ANTLR parser template for full exclusion list
      fields = [
          field
          for field in type(ctx).__dict__
          if not field.startswith("__")
          and field not in ["accept", "enterRule", "exitRule", "getRuleIndex", "copyFrom"]
      ]
      return fields
docs: Get fields defined in an ANTLR context for a parser rule