Inform the parser of user-defined types.
552965
private void addUserIdentifiers(JobConf job) throws IOException {
    Pattern x = Pattern.compile("^mapred\\.join\\.define\\.(\\w+)$");
    for (Map.Entry<String,String> kv : job) {
      Matcher m = x.matcher(kv.getKey());
      if (m.matches()) {
        try {
          Parser.CNode.addIdentifier(m.group(1),
              job.getClass(m.group(0), null, ComposableRecordReader.class));
        } catch (NoSuchMethodException e) {
          throw (IOException)new IOException(
              "Invalid define for " + m.group(1)).initCause(e);
        }
      }
    }
  }
386433
def parse_type_reference(lexer: Lexer) -> TypeNode:
    """"""
    start = lexer.token
    if expect_optional_token(lexer, TokenKind.BRACKET_L):
        type_ = parse_type_reference(lexer)
        expect_token(lexer, TokenKind.BRACKET_R)
        type_ = ListTypeNode(type=type_, loc=loc(lexer, start))
    else:
        type_ = parse_named_type(lexer)
    if expect_optional_token(lexer, TokenKind.BANG):
        return NonNullTypeNode(type=type_, loc=loc(lexer, start))
    return type_
500940
def choose_type(cls, content_type):
        """"""
        return cls.type_cls.SUBDIR if content_type in cls.subdir_types \
            else cls.type_cls.FILE
106173
def guesser(types=GUESS_TYPES, strict=False):
    """"""
    return TypeGuesser(types=types, strict=strict)
255348
def show_type(self, call_id, payload):
        """"""
        if self.full_types_enabled:
            tpe = payload['fullName']
        else:
            tpe = payload['name']

        self.log.info('Displayed type %s', tpe)
        self.editor.raw_message(tpe)
1353698
def _make_type_comment(args_info, return_type):
    # type: (ArgTypes, InternalType) -> str
    """"""
    if not args_info.pos_args:
        args_string = ''
    else:
        args_string = ', '.join([repr(t) for t in args_info.pos_args])
    if args_info.varargs:
        varargs = '*%s' % repr(args_info.varargs)
        if args_string:
            args_string += ', %s' % varargs
        else:
            args_string = varargs
    return_name = name_from_type(return_type)
    return '(%s) -> %s' % (args_string, return_name)
1220848
def _get_converter_type(identifier):
    """"""
    if isinstance(identifier, str):
        return ConverterType[identifier]
    if isinstance(identifier, ConverterType):
        return identifier
    return ConverterType(identifier)
757894
def determine_type_from_string(string)
      if string =~ TYPE_FORMAT and const_defined?(string, *EXTRA_CONST_ARGS)
        const_get(string, *EXTRA_CONST_ARGS)
      end
    end
646429
def _parse_type(value, type_func):
        
        default = type_func(0)
        if value is None:
            return default
        try:
            return type_func(value)
        except ValueError:
            return default
772999
def parser(*events):
    """"""
    def dec(func):
        for event in events:
            PARSERS[event] = func
        return func
    return dec
1229347
def register_parser(self, type, parser, **meta):
        
        try:
            self.registered_formats[type]['parser'] = parser
        except KeyError:
            self.registered_formats[type] = {'parser': parser}
        if meta:
            self.register_meta(type, **meta)
87194
def parse_interface_type_definition(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    description = parse_description(lexer)
    expect_keyword(lexer, "interface")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    fields = parse_fields_definition(lexer)
    return Node(
        description=description,
        name=name,
        directives=directives,
        fields=fields,
        loc=loc(lexer, start),
    )
1018218
def infer_type(expr, scope):
    """"""
    # Do we know what the member is?
    if isinstance(expr.member, ast.Literal):
        member = expr.member.value
    else:
        return protocol.AnyType

    container_type = infer_type(expr.obj, scope)

    try:
        # We are not using lexical scope here on purpose - we want to see what
        # the type of the member is only on the container_type.
        return structured.reflect(container_type, member) or protocol.AnyType
    except NotImplementedError:
        return protocol.AnyType
758240
def __decl_types(decl):
        """"""
        types = []
        bases = list(decl.__class__.__bases__)
        if 'pygccxml' in decl.__class__.__module__:
            types.append(decl.__class__)
        while bases:
            base = bases.pop()
            if base is declaration.declaration_t:
                continue
            if base is byte_info.byte_info:
                continue
            if base is elaborated_info.elaborated_info:
                continue
            if 'pygccxml' not in base.__module__:
                continue
            types.append(base)
            bases.extend(base.__bases__)
        return types
947560
def enforce_type(self, attr, val):
        """"""
        if not attr in self.types:
            return utfstr(val)
        elif self.types[attr] == 'int':
            return int(float(val))
        elif self.types[attr] == 'float':
            return float(val)
        else:
            return utfstr(val)
719864
def _handle_type(self, other):
        """"""
        if isinstance(other, Int):
            return Int
        elif isinstance(other, Float):
            return Float
        else:
            raise TypeError(
                f"Unsuported operation between `{type(self)}` and `{type(other)}`."
            )
88459
def parse_type(defn, preprocess=True):
    
    if pycparser is None:
        raise ImportError("Please install pycparser in order to parse C definitions")

    defn = 'typedef ' + defn.strip('; \n\t\r') + ' QQQQ;'

    if preprocess:
        defn = do_preprocess(defn)

    node = pycparser.c_parser.CParser().parse(make_preamble()[0] + defn)
    if not isinstance(node, pycparser.c_ast.FileAST) or \
            not isinstance(node.ext[-1], pycparser.c_ast.Typedef):
        raise ValueError("Something went horribly wrong using pycparser")

    decl = node.ext[-1].type
    return _decl_to_type(decl)