code: def v_grammar_unique_defs(ctx, stmt):
      
      defs = [('typedef', 'TYPE_ALREADY_DEFINED', stmt.i_typedefs),
              ('grouping', 'GROUPING_ALREADY_DEFINED', stmt.i_groupings)]
      if stmt.parent is None:
          defs.extend(
              [('feature', 'FEATURE_ALREADY_DEFINED', stmt.i_features),
               ('identity', 'IDENTITY_ALREADY_DEFINED', stmt.i_identities),
               ('extension', 'EXTENSION_ALREADY_DEFINED', stmt.i_extensions)])
      for (keyword, errcode, dict) in defs:
          for definition in stmt.search(keyword):
              if definition.arg in dict:
                  other = dict[definition.arg]
                  err_add(ctx.errors, definition.pos,
                          errcode, (definition.arg, other.pos))
              else:
                  dict[definition.arg] = definition
docs: Verify that all typedefs and groupings are unique
      Called for every statement.
      Stores all typedefs in stmt.i_typedef, groupings in stmt.i_grouping