Package org.renjin.parser

Examples of org.renjin.parser.RLexer$CTEXT


   
    if(startOffset != text.getBeginIndex()) {
      System.out.println("startOffset = " + startOffset);
    }
   
    RLexer lexer = new RLexer(parseOptions, parseState,
        new CharArrayReader(text.array, text.getBeginIndex(), text.getEndIndex() - text.getBeginIndex()));
   
    Token head = null;
    Token tail = null;
    do {
View Full Code Here


  public void run() {

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

    assertTokenSequence(source, list);
  }

  private void assertTokenSequence(String source, LexExpectation... expects) {
    Reader reader = new StringReader(source);
    RLexer lexer = new RLexer(ParseOptions.defaults(), new ParseState(), reader);

    for (int i = 0; i != expects.length; ++i) {
      assertThat("token " + (i + 1), lexer.yylex(), equalTo(expects[i].expectedToken));
      assertThat(lexer.getLVal(), expects[i].sexpMatcher);
    }
    assertThat("end of input", lexer.yylex(), equalTo(END_OF_INPUT));
  }
View Full Code Here

    ParseState parseState = new ParseState();
    JlineReader lineReader = new JlineReader(reader);
    lineReader.setEcho(echo);
    lineReader.setEchoOut(reader.getOutput());

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

TOP

Related Classes of org.renjin.parser.RLexer$CTEXT

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.