Examples of RubyParser


Examples of org.jruby.parser.RubyParser

    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);
    }
View Full Code Here

Examples of org.jrubyparser.parser.RubyParser

   * @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);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.