get enum specifications
491768
function getEnums(spec_c, bygroup, parent) {
  var spec_js = {};
  var enumGroups = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
    var kind = getAttr(section, 'kind');
    return ((kind == 'enum') || (kind == 'public-type'));
  });
  if (enumGroups) {
    _.each(enumGroups.children, function(enumGroup) {
      var enumGroupName = getText(getChild(enumGroup, 'name'), 'name');
      var enumGroupDescription = getText(getChild(enumGroup, 'detaileddescription'), 'description');
      var enumGroupVals = getChildren(enumGroup, 'enumvalue');
      if (bygroup) {
        spec_js[enumGroupName] = {
          description: enumGroupDescription,
          members: []
        };
      }
      _.each(enumGroupVals, function(e) {
        // TODO: get prefix as option
        var enumName = getText(getChild(e, 'name'), 'name').replace(/^MRAA_/, '');
        var enumDescription = getText(getChild(e, 'detaileddescription'), 'description');
        if (!bygroup) {
          spec_js[enumName] = {
            type: enumGroupName,
            description: enumDescription
          };
        } else {
          spec_js[enumGroupName].members.push(enumName);
        }
      });
    });
  }
  return spec_js;
}
1232282
def _PrintEnums(proto_printer, enum_types):
    """"""
    enum_types = sorted(enum_types, key=operator.attrgetter('name'))
    for enum_type in enum_types:
        proto_printer.PrintEnum(enum_type)
110473
private List<Map<String, Object>> docForEnumArgument(final Class<?> enumClass) {
        final ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass);
        if ( doc == null ) {
            throw new RuntimeException("Tried to get docs for enum " + enumClass + " but got null instead");
        }

        final Set<String> enumConstantFieldNames = enumConstantsNames(enumClass);
        final List<Map<String, Object>> bindings = new ArrayList<Map<String, Object>>();
        for (final FieldDoc fieldDoc : doc.fields(false)) {
            if (enumConstantFieldNames.contains(fieldDoc.name()) ) {
                bindings.add(
                        new HashMap<String, Object>() {
                            static final long serialVersionUID = 0L;
                            {
                                put("name", fieldDoc.name());
                                put("summary", fieldDoc.commentText());
                            }
                        }
                );
            }
        }

        return bindings;
    }
170627
def _getEnumValues(self, data):
        
        enumstr = data.attrib.get('enumValues')
        if not enumstr:
            return None
        if ':' in enumstr:
            return {self._cast(k): v for k, v in [kv.split(':') for kv in enumstr.split('|')]}
        return enumstr.split('|')
856119
def do_enum(self, parent=None, ident=0):
        
        # TC_ENUM classDesc newHandle enumConstantName
        enum = JavaEnum()
        _, classdesc = self._read_and_exec_opcode(
            ident=ident + 1,
            expect=(
                self.TC_CLASSDESC,
                self.TC_PROXYCLASSDESC,
                self.TC_NULL,
                self.TC_REFERENCE,
            ),
        )
        enum.classdesc = classdesc
        self._add_reference(enum, ident)
        _, enumConstantName = self._read_and_exec_opcode(
            ident=ident + 1, expect=(self.TC_STRING, self.TC_REFERENCE)
        )
        enum.constant = enumConstantName
        return enum
736000
def parse_enum_type_definition(lexer: Lexer) -> EnumTypeDefinitionNode:
    """"""
    start = lexer.token
    description = parse_description(lexer)
    expect_keyword(lexer, "enum")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    values = parse_enum_values_definition(lexer)
    return EnumTypeDefinitionNode(
        description=description,
        name=name,
        directives=directives,
        values=values,
        loc=loc(lexer, start),
    )
342179
def cpp_spec():
    """"""
    return {
        INDENTATION    : '\t',
        BEG_BLOCK      : '{',
        END_BLOCK      : '}',
        BEG_LINE       : '',
        END_LINE       : '\n',
        BEG_ACTION     : '',
        END_ACTION     : ';',
        BEG_CONDITION  : 'if(',
        END_CONDITION  : ')',
        LOGICAL_AND    : ' && ',
        LOGICAL_OR     : ' || '
    }
626125
def p_enum(self, p):  # noqa
        ''''''
        p[0] = ast.Enum(
            name=p[2], items=p[4], annotations=p[6], lineno=p.lineno(2)
        )
874458
def enum_value(self):
        """"""
        if not hasattr(self, '_enum_value'):
            assert self.kind == CursorKind.ENUM_CONSTANT_DECL
            # Figure out the underlying type of the enum to know if it
            # is a signed or unsigned quantity.
            underlying_type = self.type
            if underlying_type.kind == TypeKind.ENUM:
                underlying_type = underlying_type.get_declaration().enum_type
            if underlying_type.kind in (TypeKind.CHAR_U,
                                        TypeKind.UCHAR,
                                        TypeKind.CHAR16,
                                        TypeKind.CHAR32,
                                        TypeKind.USHORT,
                                        TypeKind.UINT,
                                        TypeKind.ULONG,
                                        TypeKind.ULONGLONG,
                                        TypeKind.UINT128):
                self._enum_value = \
                  conf.lib.clang_getEnumConstantDeclUnsignedValue(self)
            else:
                self._enum_value = conf.lib.clang_getEnumConstantDeclValue(self)
        return self._enum_value
814220
def model_enums(vk, model):
    
    model['enums'] = {}

    # init enums dict
    enums_type = [x['@name'] for x in vk['registry']['types']['type']
                  if x.get('@category') == 'enum']

    for name in enums_type:
        model['enums'][name] = {}

    # create enums
    enums = [x for x in vk['registry']['enums']
             if x.get('@type') in ('enum', 'bitmask')]

    for enum in enums:
        name = enum['@name']
        t = enum.get('@type')

        # enum may have no enums (because of extension)
        if not enum.get('enum'):
            continue

        if t in ('enum', 'bitmask'):
            # add attr to enum
            for attr in enum['enum']:
                if '@bitpos' in attr:
                    num_val = int(attr['@bitpos'], 0)
                    num_val = 1 << num_val
                    val = '0x%08x' % num_val
                elif '@value' in attr:
                    val = attr['@value']

                model['enums'][name][attr['@name']] = val

        # Add computed value
        def ext_name(name, extension):
            if extension:
                return name + '_' + extension
            return name

        extension = next(iter([x for x in VENDOR_EXTENSIONS
                               if name.lower().endswith(x)]), '').upper()

        standard_name = inflection.underscore(name).upper()
        if extension:
            standard_name = standard_name.split(extension)[0][:-1]

        if t == 'bitmask':
            en = ext_name(standard_name, '_MAX_ENUM')
            model['enums'][name][en] = 0x7FFFFFFF
        else:
            values = [int(x, 0) for x in model['enums'][name].values()]

            begin_attr = ext_name(standard_name, '_BEGIN_RANGE')
            end_attr = ext_name(standard_name, '_END_RANGE')
            size_attr = ext_name(standard_name, '_RANGE_SIZE')
            max_attr = ext_name(standard_name, '_MAX_ENUM')

            model['enums'][name][begin_attr] = min(values)
            model['enums'][name][end_attr] = max(values)
            model['enums'][name][size_attr] = max(values) - min(values) + 1
            model['enums'][name][max_attr] = 0x7FFFFFFF

    # Enum in features
    ext_base = 1000000000
    ext_blocksize = 1000
    # base + (ext - 1) * blocksize + offset
    for feature in vk['registry']['feature']:
        for require in feature['require']:
            if not 'enum' in require:
                continue
            for enum in require['enum']:
                if not '@extnumber' in enum:
                    continue
                n1 = int(enum['@extnumber'])
                n2 = int(enum['@offset'])
                extend = enum['@extends']
                val = ext_base + (n1 - 1) * ext_blocksize + n2
                model['enums'][extend][enum['@name']] = val
251717
protected Map<String, Object> getEnumValues(FacesContext facesContext, Class<?> type, String allSuffix) {

        if (type.isEnum()) {

            boolean cacheEnabled = facesContext.isProjectStage(ProjectStage.Production);
            Map<Class<?>, Map<String, Object>> cache
                    = PrimeApplicationContext.getCurrentInstance(FacesContext.getCurrentInstance()).getEnumCacheMap();

            Map<String, Object> enums;

            if (cacheEnabled && cache.containsKey(type)) {
                enums = cache.get(type);
            }
            else {
                enums = new EnumHashMap<>(type);

                for (Object value : type.getEnumConstants()) {
                    Enum<?> currentEnum = (Enum<?>) value;
                    enums.put(currentEnum.name(), currentEnum);
                }

                if (allSuffix != null) {
                    enums.put(allSuffix, type.getEnumConstants());
                }

                enums.put(DEFAULT_ALL_SUFFIX, type.getEnumConstants());

                enums = Collections.unmodifiableMap(enums);

                if (cacheEnabled) {
                    cache.put(type, enums);
                }
            }

            return enums;
        }
        else {
            throw new FacesException("Class '" + type + "' is not an enum.");
        }
    }
76852
function enums(schema, defaults, options) {
  const e = en(schema, undefined, options)
  const l = list([e], defaults, options)
  return l
}
474396
protected function getEnumValuesFromType($type)
    {
        if ( ! preg_match('#^enum\((?<values>.*)\)$#i', $type, $matches)) {
            return false;
        }

        $enum = [];

        foreach (explode(',', $matches['values']) as $value) {
            $v      = trim( $value, "'" );
            $enum[] = $v;
        }

        return $enum;
    }
363159
private <T extends Enum<T>> Object[] getValidEnumConstants(Class<T> valueClass) {
        T[] constants = valueClass.getEnumConstants();
        if (!VersionedEnum.class.isAssignableFrom(valueClass)) {
            return constants;
        }

        List<T> valid = new ArrayList<T>(constants.length);
        for (T value : constants) {
            VersionedEnum versionedValue = (VersionedEnum) value;
            if (version >= versionedValue.getMinVersion()) {
                valid.add(value);
            }
        }

        return valid.toArray();
    }
70326
def ActionEnum(ctx):
    """"""
    return Enum(
        ctx,
        interact=0,
        stop=1,
        ai_interact=2,
        move=3,
        add_attribute=5,
        give_attribute=6,
        ai_move=10,
        resign=11,
        spec=15,
        waypoint=16,
        stance=18,
        guard=19,
        follow=20,
        patrol=21,
        formation=23,
        save=27,
        ai_waypoint=31,
        chapter=32,
        ai_command=53,
        ai_queue=100,
        research=101,
        build=102,
        game=103,
        wall=105,
        delete=106,
        attackground=107,
        tribute=108,
        repair=110,
        release=111,
        multiqueue=112,
        togglegate=114,
        flare=115,
        order=117,
        queue=119,
        gatherpoint=120,
        sell=122,
        buy=123,
        droprelic=126,
        townbell=127,
        backtowork=128,
        postgame=255,
        default=Pass
    )
607528
def PlayerTypeEnum(ctx):
    """"""
    return Enum(
        ctx,
        absent=0,
        closed=1,
        human=2,
        eliminated=3,
        computer=4,
        cyborg=5,
        spectator=6
    )
598933
def _get_enum(name):
    """"""
    eid = idaapi.get_enum(name)
    if eid == idaapi.BADADDR:
        raise exceptions.EnumNotFound('Enum "{}" does not exist.'.format(name))
    return eid