Registers a parser to parse configuration inputs.
324517
def registerParser(self, parser):
        

        if not isinstance(parser, Subparser):
            raise TypeError("%s is not an instance of a subparser." % parser)

        self.parsers.append(parser)
896128
def init_parser(cls, parser):
        """"""
        subparsers = parser.add_subparsers(title='Search domain')

        # Compound subcommand
        parser_compound = subparsers.add_parser(
            'compound', help='Search in compounds')
        parser_compound.set_defaults(which='compound')
        parser_compound.add_argument(
            '--id', '-i', dest='id', metavar='id',
            action=FilePrefixAppendAction, type=text_type, default=[],
            help='Compound ID')
        parser_compound.add_argument(
            '--name', '-n', dest='name', metavar='name',
            action=FilePrefixAppendAction, type=text_type, default=[],
            help='Name of compound')

        # Reaction subcommand
        parser_reaction = subparsers.add_parser(
            'reaction', help='Search in reactions')
        parser_reaction.set_defaults(which='reaction')
        parser_reaction.add_argument(
            '--id', '-i', dest='id', metavar='id',
            action=FilePrefixAppendAction, type=str, default=[],
            help='Reaction ID')
        parser_reaction.add_argument(
            '--compound', '-c', dest='compound', metavar='compound',
            action=FilePrefixAppendAction, type=str, default=[],
            help='Comma-separated list of compound IDs')
424948
protected function registerConfigs()
    {
        $hasNewConfigs = false;

        $yamlConfig = new YamlConfig('', $this->configFiles['config']);
        $parameters = $yamlConfig->read();

        $configs = $this->kernelConfig->getConfigs();

        if (!count($configs)) {
            return;
        }

        foreach ($configs as $config) {
            // Check if the config is already being imported.
            if (VariableUtil::recursiveArraySearch($config, $parameters['imports']) === false) {
                $hasNewConfigs = true;

                // Add the config to the imports
                $parameters['imports'][]['resource'] = $config;
            }
        }

        if (!$hasNewConfigs) {
            return;
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['config']);
        $yamlConfig->write($parameters);
        $yamlConfig->clean();
    }
15800
public Grammar register(@NonNull ParserTokenType type, @NonNull PrefixHandler handler) {
      prefixHandlers.put(type, handler);
      return this;
   }
465872
public final synchronized void initialize(Map<String,String> configuration)
    {
        if(this.initialized)
        {
            throw new FaxException("Request parser already initialized.");
        }
        
        //set flag
        this.initialized=true;
        
        //initialize
        this.initializeImpl(configuration);
    }
173142
protected void configureParser(LSParser parser) {
        for (Map.Entry<String, Object> setting : parseSettings.entrySet()) {
            setParserConfigParameter(parser, setting.getKey(), setting.getValue());
        }
    }
297668
def load_config():
    
    configuration = MyParser()
    configuration.read(_config)

    d = configuration.as_dict()

    if 'jira' not in d:
        raise custom_exceptions.NotConfigured

    # Special handling of the boolean for error reporting
    d['jira']['error_reporting'] = configuration.getboolean('jira', 'error_reporting')

    return d
655434
public static void registerTypeBeanParser(BeanParser beanParser, Type... genericTypes) {
    for (Type genericType : genericTypes) {
      typeBeanParserMap.put(genericType, beanParser);
    }
  }
584538
def register(self):
        """"""
        # Assume utf8 encoding
        utf8 = encodings.search_function('utf8')

        class StreamReader(utf_8.StreamReader):
            """Used by cPython to deal with a spec file"""
            def __init__(sr, stream, *args, **kwargs):
                codecs.StreamReader.__init__(sr, stream, *args, **kwargs)
                data = self.dealwith(sr.stream.readline)
                sr.stream = StringIO(data)

        def decode(text, *args, **kwargs):
            """Used by pypy and pylint to deal with a spec file"""
            return_tuple = kwargs.get("return_tuple", True)

            if six.PY3:
                if hasattr(text, 'tobytes'):
                    text = text.tobytes().decode('utf8')
                else:
                    text = text.decode('utf8')

            buffered = StringIO(text)

            # Determine if we need to have imports for this string
            # It may be a fragment of the file
            has_spec = regexes['encoding_matcher'].search(buffered.readline())
            no_imports = not has_spec
            buffered.seek(0)

            # Translate the text
            if six.PY2:
                utf8 = encodings.search_function('utf8') # Assume utf8 encoding
                reader = utf8.streamreader(buffered)
            else:
                reader = buffered

            data = self.dealwith(reader.readline, no_imports=no_imports)

            # If nothing was changed, then we want to use the original file/line
            # Also have to replace indentation of original line with indentation of new line
            # To take into account nested describes
            if text and not regexes['only_whitespace'].match(text):
                if regexes['whitespace'].sub('', text) == regexes['whitespace'].sub('', data):
                    bad_indentation = regexes['leading_whitespace'].search(text).groups()[0]
                    good_indentation = regexes['leading_whitespace'].search(data).groups()[0]
                    data = '%s%s' % (good_indentation, text[len(bad_indentation):])

            # If text is empty and data isn't, then we should return text
            if len(text) == 0 and len(data) == 1:
                if return_tuple:
                    return "", 0
                else:
                    return ""

            # Return translated version and it's length
            if return_tuple:
                return data, len(data)
            else:
                return data

        incrementaldecoder = utf8.incrementaldecoder
        if six.PY3:
            def incremental_decode(decoder, *args, **kwargs):
                """Wrapper for decode from IncrementalDecoder"""
                kwargs["return_tuple"] = False
                return decode(*args, **kwargs)
            incrementaldecoder = type("IncrementalDecoder", (utf8.incrementaldecoder, ), {"decode": incremental_decode})

        def search_function(s):
            """Determine if a file is of spec encoding and return special CodecInfo if it is"""
            if s != 'spec': return None
            return codecs.CodecInfo(
                  name='spec'
                , encode=utf8.encode
                , decode=decode
                , streamreader=StreamReader
                , streamwriter=utf8.streamwriter
                , incrementalencoder=utf8.incrementalencoder
                , incrementaldecoder=incrementaldecoder
                )

        # Do the register
        codecs.register(search_function)
279337
public function init()
    {
        parent::init();

        $parser         = new Parser();
        $yaml           = file_get_contents(PHPCI_CONFIG_FILE);
        $this->settings = $parser->parse($yaml);
    }
191253
public function loadConfiguration(): void
	{
		$config = $this->validateConfig($this->defaults, $this->config);

		foreach ($config as $bridge => $enabled) {
			// Don't register sub extension
			if ($enabled === false) {
				continue;
			}

			// Security check
			Validators::assertField($config, $bridge, 'array');

			// Register sub extension a.k.a CompilerPass
			$this->passes[$bridge] = new $this->map[$bridge]();
			$this->passes[$bridge]->setCompiler($this->compiler, $this->prefix($bridge));
			$this->passes[$bridge]->setConfig($this->config[$bridge] ?? []);
			$this->passes[$bridge]->loadConfiguration();
		}
	}
41192
function() {
      // Instantiate the parsers; this will register handlers for known events
      var allTypeInfos = tr.e.importer.linux_perf.
          Parser.getAllRegisteredTypeInfos();
      var parsers = allTypeInfos.map(
          function(typeInfo) {
            return new typeInfo.constructor(this);
          }, this);

      return parsers;
    }
1022040
static void register() {
        Transliterator.registerFactory(_ID, new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new UnicodeNameTransliterator(null);
            }
        });
    }
608170
public <T> void addParser(Class<T> clazz, StringParser<T> parser) {
		parsers.put(clazz, parser);
	}
1197080
def parser():

    """"""

    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--config_paths', default=[], action='append',
                        help='path to a configuration directory')
    return parser
543269
static void register() {
        // Unicode: "U+10FFFF" hex, min=4, max=6
        Transliterator.registerFactory("Any-Hex/Unicode", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/Unicode",
                                                "U+", "", 16, 4, true, null);
            }
        });

        // Java: "\\uFFFF" hex, min=4, max=4
        Transliterator.registerFactory("Any-Hex/Java", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/Java",
                                                "\\u", "", 16, 4, false, null);
            }
        });

        // C: "\\uFFFF" hex, min=4, max=4; \\U0010FFFF hex, min=8, max=8
        Transliterator.registerFactory("Any-Hex/C", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/C",
                                                "\\u", "", 16, 4, true,
                       new EscapeTransliterator("", "\\U", "", 16, 8, true, null));
            }
        });

        // XML: "&#x10FFFF;" hex, min=1, max=6
        Transliterator.registerFactory("Any-Hex/XML", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/XML",
                                                "&#x", ";", 16, 1, true, null);
            }
        });

        // XML10: "&1114111;" dec, min=1, max=7 (not really "Any-Hex")
        Transliterator.registerFactory("Any-Hex/XML10", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/XML10",
                                                "&#", ";", 10, 1, true, null);
            }
        });

        // Perl: "\\x{263A}" hex, min=1, max=6
        Transliterator.registerFactory("Any-Hex/Perl", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/Perl",
                                                "\\x{", "}", 16, 1, true, null);
            }
        });

        // Plain: "FFFF" hex, min=4, max=6
        Transliterator.registerFactory("Any-Hex/Plain", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex/Plain",
                                                "", "", 16, 4, true, null);
            }
        });

        // Generic
        Transliterator.registerFactory("Any-Hex", new Transliterator.Factory() {
            @Override
            public Transliterator getInstance(String ID) {
                return new EscapeTransliterator("Any-Hex",
                                                "\\u", "", 16, 4, false, null);
            }
        });
    }
866947
def parser(key = "default"):
    """"""
    #Make sure we have a parser for that key. If we don't, then set
    #one up if we know what parameters to use; otherwise return the
    #default parser.
    if key not in _parsers:
        if key == "ssh":
            _parsers["ssh"] = CodeParser(True, False)
        else:
            key = "default"

    return _parsers[key]