use of org.eclipse.xtend.core.parser.antlr.internal.FlexerFactory in project xtext-xtend by eclipse.
the class LexerBenchmark method setUp.
@Override
protected void setUp() throws Exception {
contentToParse = loadString();
lexer = new InternalXtendLexer(null);
flexerTokenSource = new FlexerFactory().createTokenSource(null);
bareFlexer = new FlexerFactory().createFlexer(null);
}
use of org.eclipse.xtend.core.parser.antlr.internal.FlexerFactory in project xtext-xtend by eclipse.
the class FlexingTest method assertLexing.
@Override
protected void assertLexing(String input, Pair<String, String>... expectedTokens) {
FlexTokenSource tokenSource = new FlexerFactory().createTokenSource(new StringReader(input));
XtextTokenStream tokenStream = new XtextTokenStream(tokenSource, getTokenDefProvider());
List<?> tokens = tokenStream.getTokens();
assertEquals(input + " / " + tokens, expectedTokens.length, tokens.size());
for (int i = 0; i < tokens.size(); i++) {
Token token = (Token) tokens.get(i);
assertEquals(token.toString(), expectedTokens[i].getFirst(), token.getText());
final String expected = expectedTokens[i].getSecond();
String actual = getTokenDefProvider().getTokenDefMap().get(token.getType());
assertEquals("expected " + expected + " but was " + actual, expected, actual);
}
}
Aggregations