* @param configuration
* @return
* @throws IOException
*/
protected Result internalParse(String file, Reader content, ParserConfiguration configuration) throws IOException {
RubyParser parser;
if(configuration.getVersion() == CompatVersion.RUBY1_8) {
parser = new Ruby18Parser();
}
else {
parser = new Ruby19Parser();
}
RubyParserWarningsCollector warnings = new RubyParserWarningsCollector();
parser.setWarnings(warnings);
LexerSource lexerSource = LexerSource.getSource(file, content, configuration);
Node parserResult = null;
try {
parserResult = parser.parse(configuration, lexerSource).getAST();
}
catch(SyntaxException e) {
warnings.syntaxError(e);
}