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));
}