FileInputStream input = new FileInputStream(file);
LexerSource source = new InputStreamLexerSource(file.getPath(),
input, lexerCapture, startLine, extraPositionInfo);
// Get a parser
RubyParser parser = RubyParserPool.getInstance().borrowParser(rubyVersion);
// Create a warnings collector to give to the parser
RubyParserWarningsCollector warnings = new RubyParserWarningsCollector(rubyRuntime);
parser.setWarnings(warnings);
RubyParserResult parserResult = null;
try {
parserResult = parser.parse(parserConfiguration, source);
} catch (SyntaxException e) {
warnings.syntaxError(e);
} finally {
RubyParserPool.getInstance().returnParser(parser);
}