Package org.renjin.parser

Examples of org.renjin.parser.RParser$Lexer


    ParseOptions options = ParseOptions.defaults();
    ParseState state = new ParseState();
    Reader reader = console.getIn();
    RLexer lexer = new RLexer(options, state, reader);
    RParser parser = new RParser(options, state, lexer);

    printGreeting();

    while(true) {

      console.getOut().print("> ");

      try {
       
        parser.parse();
       
        SEXP exp = parser.getResult();
        if(exp == null) {
          continue;
        }
       
        // clean up last warnings from any previous run
View Full Code Here


 
  }
 

  private void executeSelection() throws IOException {
    RParser parser = new RParser(new StringReader(textArea.getSelectedText()));
    List<SEXP> expressions = Lists.newArrayList();
    while(parser.parse()) {
      expressions.add(parser.getResult());
    }
   
    ExpressionVector vector = new ExpressionVector(expressions);
    session.evaluate(vector);
   
View Full Code Here

    RLexer lexer = new RLexer(options, parseState, lineReader);
    if(lexer.isEof()) {
      return false;
    }

    RParser parser = new RParser(options, parseState, lexer);
    while(!parser.parse()) {
      if(lexer.errorEncountered()) {
        String errorMessage = "Syntax error at " + lexer.getErrorLocation() + ": " + lexer.getErrorMessage();
        reader.getOutput().append(errorMessage + "\n");
        if(stopOnError) {
          throw new RuntimeException(errorMessage);
        }
      }
    }


    SEXP exp = parser.getResult();
    if(parser.getResultStatus() == StatusResult.EOF) {
      return true;
    } else if(exp == null) {
      return true;
    }
   
View Full Code Here

  private SEXP parse(String source)  {
    try {
      ParseState state = new ParseState();
      ParseOptions options = ParseOptions.defaults();
      RLexer lexer = new RLexer(options, state, new StringReader(source));
      RParser parser = new RParser(options, state, lexer);

      assertThat("parser.parse succeeds", parser.parse(), equalTo(true));
      RParser.StatusResult status = parser.getResultStatus();
      return parser.getResult();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.renjin.parser.RParser$Lexer

Copyright © 2018 www.massapicom. 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.