Initialize abbreviations. It reads a file and fulfill the abbreviation map.
@param pFileName The name of input file
@param parse Whether parse the file to extract the abbreviation or use line number as the abbreviated value
972437
protected void initialize(String pFileName, boolean parse) {
    this.fileName = pFileName;
    Path path = null;
    try {
      path = getPath(pFileName);
      List<String> lines = Files.readAllLines(path, Charset.defaultCharset());
      int i = 1;
      for (String line : lines) {
        processLine(line, i, parse);
      }
    } catch (URISyntaxException | IOException | FileSystemNotFoundException ex) {
      LOGGER.severe(String.format("Error with file: %s, path: %s.", pFileName, path));
      LOGGER.severe(ex.getLocalizedMessage());
    }
  }
498263
private void init(Set<String> pCommands, String ... pArgs) {
        quiet = options.containsKey("quiet");
        verbose = options.containsKey("verbose");
        jarFile = lookupJarFile();

        // Special cases first
        extraArgs = checkCommandAndArgs(pCommands, pArgs);
    }
1275776
private void processParseResult(final URI currentFile) {
        // Category non-copyto result and update uplevels accordingly
        for (final Reference file: listFilter.getNonCopytoResult()) {
            categorizeReferenceFile(file);
            updateUplevels(file.filename);
        }
        for (final Map.Entry<URI, URI> e : listFilter.getCopytoMap().entrySet()) {
            final URI source = e.getValue();
            final URI target = e.getKey();
            copyTo.put(target, source);
            updateUplevels(target);

        }
        schemeSet.addAll(listFilter.getSchemeRefSet());

        // collect key definitions
        for (final Map.Entry<String, KeyDef> e: keydefFilter.getKeysDMap().entrySet()) {
            // key and value.keys will differ when keydef is a redirect to another keydef
            final String key = e.getKey();
            final KeyDef value = e.getValue();
            if (schemeSet.contains(currentFile)) {
                schemekeydefMap.put(key, new KeyDef(key, value.href, value.scope, value.format, currentFile, null));
            }
        }

        hrefTargetSet.addAll(listFilter.getHrefTargets());
        conrefTargetSet.addAll(listFilter.getConrefTargets());
        nonConrefCopytoTargetSet.addAll(listFilter.getNonConrefCopytoTargets());
        coderefTargetSet.addAll(listFilter.getCoderefTargets());
        outDitaFilesSet.addAll(listFilter.getOutFilesSet());

        // Generate topic-scheme dictionary
        final Set<URI> schemeSet = listFilter.getSchemeSet();
        if (schemeSet != null && !schemeSet.isEmpty()) {
            Set<URI> children = schemeDictionary.get(currentFile);
            if (children == null) {
                children = new HashSet<>();
            }
            children.addAll(schemeSet);
            schemeDictionary.put(currentFile, children);
            final Set<URI> hrfSet = listFilter.getHrefTargets();
            for (final URI filename: hrfSet) {
                children = schemeDictionary.get(filename);
                if (children == null) {
                    children = new HashSet<>();
                }
                children.addAll(schemeSet);
                schemeDictionary.put(filename, children);
            }
        }
    }
916508
protected void parse() {
        // have we already parsed the input?
        if (_parsed)
            return;
        _parsed = true;

        try {
            // initialize
            _parts = new MultiMap<>();

            // if its not a multipart request, don't parse it
            if (_contentType == null || !_contentType.startsWith("multipart/form-data"))
                return;

            // sort out the location to which to write the files
            if (_config.getLocation() == null)
                _tmpDir = _contextTmpDir;
            else if ("".equals(_config.getLocation()))
                _tmpDir = _contextTmpDir;
            else {
                File f = new File(_config.getLocation());
                if (f.isAbsolute())
                    _tmpDir = f;
                else
                    _tmpDir = new File(_contextTmpDir, _config.getLocation());
            }

            if (!_tmpDir.exists())
                _tmpDir.mkdirs();

            String contentTypeBoundary = "";
            int bstart = _contentType.indexOf("boundary=");
            if (bstart >= 0) {
                int bend = _contentType.indexOf(";", bstart);
                bend = (bend < 0 ? _contentType.length() : bend);
                contentTypeBoundary = QuotedStringTokenizer.unquote(value(_contentType.substring(bstart, bend)).trim());
            }

            Handler handler = new Handler();
            MultiPartParser parser = new MultiPartParser(handler, contentTypeBoundary);

            byte[] data = new byte[_bufferSize];
            int len;
            long total = 0;

            while (true) {

                len = _in.read(data);

                if (len > 0) {
                    // keep running total of size of bytes read from input and throw an exception if exceeds MultipartConfigElement._maxRequestSize
                    total += len;
                    if (_config.getMaxRequestSize() > 0 && total > _config.getMaxRequestSize()) {
                        _err = new IllegalStateException("Request exceeds maxRequestSize (" + _config.getMaxRequestSize() + ")");
                        return;
                    }

                    ByteBuffer buffer = BufferUtils.toBuffer(data);
                    buffer.limit(len);
                    if (parser.parse(buffer, false))
                        break;

                    if (buffer.hasRemaining())
                        throw new IllegalStateException("Buffer did not fully consume");

                } else if (len == -1) {
                    parser.parse(BufferUtils.EMPTY_BUFFER, true);
                    break;
                }

            }

            // check for exceptions
            if (_err != null) {
                return;
            }

            // check we read to the end of the message
            if (parser.getState() != MultiPartParser.State.END) {
                if (parser.getState() == MultiPartParser.State.PREAMBLE)
                    _err = new IOException("Missing initial multi part boundary");
                else
                    _err = new IOException("Incomplete Multipart");
            }

            if (LOG.isDebugEnabled()) {
                LOG.debug("Parsing Complete {} err={}", parser, _err);
            }

        } catch (Throwable e) {
            _err = e;
        }
    }
146
public void parse() {
        Map<String, Disgenet> disgenetMap = new HashMap<>();

        BufferedReader reader;
        try {
            // Disgenet file is usually downloaded as a .tar.gz file
            if (disgenetFilePath.toFile().getName().endsWith("tar.gz")) {
                TarArchiveInputStream tarInput = new TarArchiveInputStream(
                        new GzipCompressorInputStream(new FileInputStream(disgenetFilePath.toFile())));
//                TarArchiveEntry currentEntry = tarInput.getNextTarEntry();
//                BufferedReader br = null;
                reader = new BufferedReader(new InputStreamReader(tarInput)); // Read directly from tarInput
            } else {
                reader = FileUtils.newBufferedReader(disgenetFilePath);
            }
//            if (disgenetFilePath.toFile().getName().endsWith("txt.gz")) {
//                reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(disgenetFilePath.toFile()))));
//            } else {
//                reader = Files.newBufferedReader(disgenetFilePath, Charset.defaultCharset());
//            }

            logger.info("Parsing Disgenet file " + disgenetFilePath + " ...");
            // first line is the header -> ignore it
            reader.readLine();
            long processedDisgenetLines = fillDisgenetMap(disgenetMap, reader);

            logger.info("Serializing parsed variants ...");
            Collection<Disgenet> allDisgenetRecords = disgenetMap.values();
            for (Disgenet disGeNetRecord : allDisgenetRecords) {
                serializer.serialize(disGeNetRecord);
            }
            logger.info("Done");
            this.printSummary(processedDisgenetLines, allDisgenetRecords.size());

        } catch (FileNotFoundException e) {
            logger.error("Disgenet file " + disgenetFilePath + " not found");
        } catch (IOException e) {
            logger.error("Error reading Disgenet file " + disgenetFilePath + ": " + e.getMessage());
        }
    }
266644
public static ProtoFile parse(String name, Reader reader) throws IOException {
    CharArrayWriter writer = new CharArrayWriter();
    char[] buffer = new char[1024];
    int count;
    while ((count = reader.read(buffer)) != -1) {
      writer.write(buffer, 0, count);
    }
    return new ProtoParser(name, writer.toCharArray()).readProtoFile();
  }
1210595
def init_parser():
    """"""

    usage = "Usage: %(prog)s <option(s)> <file(s)>"
    description = " Display information from object <file(s)>.\n"
    description += " At least one of the following switches must be given:"

    #
    # Create an argument parser and an exclusive group.
    #
    parser = ArgumentParser(
        usage=usage, description=description, add_help=False)

    group = parser.add_mutually_exclusive_group()

    #
    # Add objdump parameters.
    #
    group.add_argument("-a", "--archive-headers",
        action=DumpArchieveHeadersAction,
        type=FileType("r"), nargs="+",
        help="Display archive header information")

    group.add_argument("-f", "--file-headers",
        action=DumpFileHeadersAction,
        type=FileType("r"), nargs="+",
        help="Display the contents of the overall file header")

    #group.add_argument("-p", "--private-headers",    action="store", type=FileType("r"), nargs="+", help="Display object format specific file header contents")
    #group.add_argument("-P", "--private=OPT,OPT...", action="store", type=FileType("r"), nargs="+", help="Display object format specific contents")

    group.add_argument("-h", "--section-headers",
        action=DumpSectionHeadersAction,
        type=FileType("r"), nargs="+",
        help="Display the contents of the section headers")

    #group.add_argument("-x", "--all-headers",        action="store", type=FileType("r"), nargs="+", help="Display the contents of all headers")

    group.add_argument("-d", "--disassemble",
        action=DisassembleSectionAction,
        type=FileType("r"), nargs="+",
        help="Display assembler contents of executable sections")


    group.add_argument("-D", "--disassemble-all",
        action=DisassembleSectionsAction,
        type=FileType("r"), nargs="+",
        help="Display assembler contents of executable sections")

    #group.add_argument("-S", "--source",             action="store", type=FileType("r"), nargs="+", help="Intermix source code with disassembly")

    group.add_argument("-s", "--full-contents",
        action=DumpSectionContentAction,
        type=FileType("r"), nargs="+",
        help="Display the full contents of all sections requested")

    #group.add_argument("-g", "--debugging",          action="store", type=FileType("r"), nargs="+", help="Display debug information in object file")
    #group.add_argument("-e", "--debugging-tags",     action="store", type=FileType("r"), nargs="+", help="Display debug information using ctags style")
    #group.add_argument("-G", "--stabs",              action="store", type=FileType("r"), nargs="+", help="Display (in raw form) any STABS info in the file")

    #-W[lLiaprmfFsoRt] or")
    #--dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,")
    #      =frames-interp,=str,=loc,=Ranges,=pubtypes,")
    #      =gdb_index,=trace_info,=trace_abbrev,=trace_aranges]")
    #                       Display DWARF info in the file")

    group.add_argument("-t", "--syms",
        action=DumpFileSymbols,
        type=FileType("r"), nargs="+",
        help="Display the contents of the symbol table(s)")

    #-T, --dynamic-syms       Display the contents of the dynamic symbol table")
    #-r, --reloc              Display the relocation entries in the file")
    #-R, --dynamic-reloc      Display the dynamic relocation entries in the file")

    group.add_argument("-v", "--version", action="version",
        version="%%(prog)s %s (%s)" % (__version__, __description__),
        help="Display this program's version number")

    group.add_argument("-i", "--info",
        action=ListFormatAndArchitecturesInformationAction,
        nargs=REMAINDER,
        help="List object formats and architectures supported")

    group.add_argument("-H", "--help", action="store_true", default=False,
        help="Display this information")

    return parser
567541
protected void parseMemInfo(String[] memInfoFile) throws IOException {
    double memTotalGB = 0;
    Pattern pattern = Pattern.compile("MemTotal:[ \t]+([0-9]+)[ \t]+kB");
    for (String line : memInfoFile) {
      Matcher matcher = pattern.matcher(line);
      if (matcher.find()) {
        memTotalGB = Double.parseDouble(matcher.group(1)) / 1000000d;
        break;
      }
    }
    ttUtilization.setMemTotalGB(memTotalGB);
  }
744822
void parse(Reader reader) throws ParseException {
        if (reader == null) {
            //just log and return default properties
            Log.warn("parsing NULL reader, so fallback on default configuration!");
            return;
        }
        
        BufferedReader br = new BufferedReader(reader);
        String line;
        try {
            while ((line = br.readLine()) != null) {
                int commentMarker = line.indexOf('#');
                if (commentMarker != -1) {
                    if (commentMarker == 0) {
                        //skip its a comment
                        continue;
                    } else {
                        //it's a malformed comment
                        throw new ParseException(line, commentMarker);
                    }
                } else {
                    if (line.isEmpty() || line.matches("^\\s*$")) {
                        //skip it's a black line
                        continue;
                    }
                    
                    //split till the first space
                    int deilimiterIdx = line.indexOf(' ');
                    String key = line.substring(0, deilimiterIdx).trim();
                    String value = line.substring(deilimiterIdx).trim();
                    
                    m_properties.put(key, value);
                }
            }
        } catch (IOException ex) {
            throw new ParseException("Failed to read", 1);
        }
    }
292988
public static Parse parseParse(String parse) {
    StringBuffer text = new StringBuffer();
    int offset = 0;
    Stack stack = new Stack();
    List cons = new LinkedList();
    for (int ci = 0, cl = parse.length(); ci < cl; ci++) {
      char c = parse.charAt(ci);
      if (c == '(') {
        String rest = parse.substring(ci + 1);
        String type = getType(rest);
        if (type == null) {
          System.err.println("null type for: " + rest);
        }
        String token = getToken(rest);
        stack.push(new Object[] { type, new Integer(offset)});
        if (token != null && !type.equals("-NONE-")) {
          cons.add(new Object[] { ParserME.TOK_NODE, new Span(offset, offset + token.length())});
          text.append(token).append(" ");
          offset += token.length() + 1;
        }
      }
      else if (c == ')') {
        Object[] parts = (Object[]) stack.pop();
        String type = (String) parts[0];
        if (!type.equals("-NONE-")) {
          int start = ((Integer) parts[1]).intValue();
          cons.add(new Object[] { parts[0], new Span(start, offset - 1)});
        }
      }
    }
    String txt = text.toString();
    Parse p = new Parse(txt, new Span(0, txt.length()), ParserME.TOP_NODE, 1);
    /*
    for (int ti=0;ti < tokens.size();ti++) {
      Object[] parts = (Object[]) cons.get(ti);
      String type = (String) parts[0];
      if (!type.equals(ParserME.TOP_NODE)) {
        Parse con = new Parse(txt, (Span) parts[1], type, 1);
        System.err.println("insert "+type+" "+con.toString());
        p.insert(con);
      }
    }
    */
    for (int ci=0;ci < cons.size();ci++) {
      Object[] parts = (Object[]) cons.get(ci);
      String type = (String) parts[0];
      if (!type.equals(ParserME.TOP_NODE)) {
        Parse con = new Parse(txt, (Span) parts[1], type, 1);
        //System.err.println("insert["+ci+"] "+type+" "+con.toString()+" "+con.hashCode());
        p.insert(con);
        //codeTree(p);
      }
    }
    return p;
  }
423449
public static String getBasename0(final String pFileName) {
        int index = pFileName.lastIndexOf('.');

        if (index >= 0) {
            return pFileName.substring(0, index);
        }

        // No period found
        return pFileName;
    }
893408
private void parseEnumeration(boolean isNames) throws Exception {
        dataBufferAppend('(');

        // Read the first token.
        skipWhitespace();
        dataBufferAppend(readNmtoken(isNames));
        // Read the remaining tokens.
        skipWhitespace();
        while (!tryRead(')')) {
            require('|');
            dataBufferAppend('|');
            skipWhitespace();
            dataBufferAppend(readNmtoken(isNames));
            skipWhitespace();
        }
        dataBufferAppend(')');
    }
46596
private synchronized void initialize(String fileName, String path) throws ParameterException {
		if(!path.equals(this.path)){
			checkPath(path);
			this.path = path;
		}
		if(!fileName.equals(this.fileName)){
			checkFileName(fileName);
			this.fileName = fileName;
		}
	}
258457
public static void initialize()
    {
        if (!initialized)
        {
            String libraryBaseName = "JCusparse-" + JCuda.getJCudaVersion();
            String libraryName = 
                LibUtils.createPlatformLibraryName(libraryBaseName);
            LibUtils.loadLibrary(libraryName);
            initialized = true;
        }
    }
1350056
public function canRead($pFilename)
	{
		// Check if file exists
		try {
			$this->_openFile($pFilename);
		} catch (Exception $e) {
			return FALSE;
		}

		$readable = $this->_isValidFormat();
		fclose ($this->_fileHandle);
		return $readable;
	}
819498
def pre_parse
      @file_reader.read
      metadata = Metadata.new(MetadataParser.new(@file_reader.first_line).parse)
      if metadata.valid?
        @metadata = metadata
        @alias_registry = AliasRegistry.new(@metadata.their_screen_name)
        @my_aliases.each do |my_alias|
          @alias_registry[my_alias] = @metadata.my_screen_name
        end
      end
    end
511813
public JCTree.JCCompilationUnit parse(JavaFileObject filename) {
        JavaFileObject prev = log.useSource(filename);
        try {
            JCTree.JCCompilationUnit t = parse(filename, readSource(filename));
            if (t.endPositions != null)
                log.setEndPosTable(filename, t.endPositions);
            return t;
        } finally {
            log.useSource(prev);
        }
    }