Reads the file specified and tokenizes the data for parsing.
968790
def read(self, filename):
        

        try:
            with open(filename, 'r') as _file:
                self._filename = filename
                self.readstream(_file)
            return True

        except IOError:
            self._filename = None
            return False
271258
def load_file(self, filename):
        
        self._say("Loading file: " + filename)

        fh    = codecs.open(filename, 'r', 'utf-8')
        lines = fh.readlines()
        fh.close()

        self._say("Parsing " + str(len(lines)) + " lines of code from " + filename)
        self._parse(filename, lines)
765352
public void parse (FileHandle file) {
		try {
			parse(file.reader("UTF-8"));
		} catch (Exception ex) {
			throw new SerializationException("Error parsing file: " + file, ex);
		}
	}
189926
def read(self, file):
        """"""
        content = self._read_content(file)
        self._validate(content)
        self._parse(content)

        return self
736305
def tokenize(self):
        
        def readlines(s):
            while True:
                line = s.readline()
                if line != "":
                    yield line.rstrip()
                else:
                    break

        for self.lineno, line in enumerate(readlines(self.stream), 1):
            for self.column, part in self.split(line):
                if part[0] == "#": # COMMENT
                    break
                yield (self.lineno, self.column, self.tokentype(part))
1248420
def parse( file )
      pattern = PATTERNS[ File.extname( file ) ]

      IO.readlines( file ).take_while do |line|
        line =~ pattern
      end.map { |line| line[ pattern, 1 ] }
    end
337064
def parse_file(parser, file)
      return parser.parse(File.read(file, :encoding => Encoding::UTF_8), file)
    end
1040547
def _parse_from_file(self, filepath, fname,
                         dependencies, recursive, greedy):
        """"""
        #Now that we have the file contents, we can parse them using the parsers
        string = self.tramp.read(filepath)
        pmodules = self.modulep.parse(string, self, filepath=filepath)
        file_mtime = self._get_mod_mtime(filepath)

        for module in pmodules:
            module.change_time = file_mtime
            self.modules[module.name.lower()] = module
            self._modulefiles[fname].append(module.name.lower())

        pprograms = self.modulep.parse(string, self, False)
        for program in pprograms:
            program.change_time = file_mtime
            self.programs[program.name.lower()] = program
            self._programfiles[fname].append(program.name.lower())

        #There may be xml files for the docstrings that also need to be parsed.
        self._parse_docstrings(filepath)
        
        return (pmodules, pprograms)
285017
function(inputIndex) {

            _.each(tokens, function(token, index) {
                // determain whether or not this is a file reference or a string
                if(token.file) {

                    // read the file and reset replacement to what was loaded
                    fs.readFile(token.file, 'utf8', function(e, data) {
                        if(e) {
                            grunt.fail.warn("There was an error processing the replacement '" + token.file + "' file.");
                        }
                        tokens[index].contents = data;
                        processTokenCompleteCallback();
                    });

                } else if(token.string) {
                    // we didn't need to load a file
                    tokens[index].contents = token.string;
                    processTokenCompleteCallback();
                } else {
                    processTokenCompleteCallback();
                }

            }, this);
        }
13377
public void parse() throws NodeFileParserException {
        final ResourceXMLParser resourceXMLParser;
        if(null!=file){
            resourceXMLParser=new ResourceXMLParser(file);
        }else{
            resourceXMLParser = new ResourceXMLParser(input);
        }
        //parse both node and settings
        resourceXMLParser.setReceiver(this);
//        long start = System.currentTimeMillis();
        try {
            resourceXMLParser.parse();
        } catch (ResourceXMLParserException e) {
            throw new NodeFileParserException(e);
        } catch (IOException e) {
            throw new NodeFileParserException(e);
        }
//        System.err.println("parse: " + (System.currentTimeMillis() - start));
    }
664705
def parse_file(self, sourcepath):
        """"""

        # Open input file and read JSON array:
        with open(sourcepath, 'r') as logfile:
            jsonlist = logfile.readlines()

        # Set our attributes for this entry and add it to data.entries:
        data = {}
        data['entries'] = []
        for line in jsonlist:
            entry = self.parse_line(line)
            data['entries'].append(entry)
        if self.tzone:
            for e in data['entries']:
                e['tzone'] = self.tzone

        # Return the parsed data
        return data
434095
function parse(contents, retained, parser) {
    var errors = [], data = [], lines = 0;

    // optional parser
    if (!parser) parser = JSON;

    // process each line of the file
    contents.toString().split('\n').forEach(function(line) {
        if (!line) return;
        lines++;
        try {
            data.push(parser.parse(line));
        } catch (e) {
            e.line = line;
            errors.push(e);
        }
    });

    // if no errors/data, don't return an empty array
    var ret = {};
    if (errors.length) ret.errors = errors;
    if (data.length) ret.data = data;

    // if every line failed, probably not line-delimited
    if (errors.length == lines) ret.errors = retained;

    return ret;
}
603370
def read_file(file, filename='<input>'):
    """"""
    reader = Reader(filename)
    for line in file:
        yield from reader.feed_line(line)
    reader.finish()
373827
def tokenize_block(iterable, token_types):
    
    lines = FileWrapper(iterable)
    parse_buffer = ParseBuffer()
    line = lines.peek()
    while line is not None:
        for token_type in token_types:
            if token_type.start(line):
                result = token_type.read(lines)
                if result is not None:
                    parse_buffer.append((token_type, result))
                    break
        else:  # unmatched newlines
            next(lines)
            parse_buffer.loose = True
        line = lines.peek()
    return parse_buffer
678152
protected static String read(ParsingContext context, File file) throws IOException {
		File filename = file;
		if (context != null && !filename.isAbsolute()) {
			filename = FileSystem.makeAbsolute(filename, context.getCurrentDirectory());
		}
		try (FileReader reader = new FileReader(filename)) {
			return read(reader);
		}
	}
169539
public void parse() {
        // read resource file header.
        ResourceTableHeader resourceTableHeader = (ResourceTableHeader) readChunkHeader();

        // read string pool chunk
        stringPool = ParseUtils.readStringPool(buffer, (StringPoolHeader) readChunkHeader());

        resourceTable = new ResourceTable();
        resourceTable.setStringPool(stringPool);

        PackageHeader packageHeader = (PackageHeader) readChunkHeader();
        for (int i = 0; i < resourceTableHeader.getPackageCount(); i++) {
            Pair<ResourcePackage, PackageHeader> pair = readPackage(packageHeader);
            resourceTable.addPackage(pair.getLeft());
            packageHeader = pair.getRight();
        }
    }
1195821
public void readData(BufferedReader in) throws IOException {
    final String SEEN = "SEEN";
    String line;
    int lineNum = 1;
    // all lines have one tagging with raw count per line
    line = in.readLine();
    Pattern p = Pattern.compile("^smooth\\[([0-9])\\] = (.*)$");
    while (line != null && line.length() > 0) {
      try {
        Matcher m = p.matcher(line);
        if (m.matches()) {
          int i = Integer.parseInt(m.group(1));
          smooth[i] = Double.parseDouble(m.group(2));
        } else {
          // split on spaces, quote with doublequote, and escape with backslash
          String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\');
          // System.out.println("fields:\n" + fields[0] + "\n" + fields[1] +
          // "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4]);
          boolean seen = fields[3].equals(SEEN);
          addTagging(seen, new IntTaggedWord(fields[2], fields[0], wordIndex, tagIndex), Double.parseDouble(fields[4]));
        }
      } catch (RuntimeException e) {
        throw new IOException("Error on line " + lineNum + ": " + line, e);
      }
      lineNum++;
      line = in.readLine();
    }
    initRulesWithWord();
  }