@Override public void analyse(String text, IErrorReporter reporter) { ILexer lexer = new TableBasedLexer( build.getTables(), null, new ITokenFactory() { @Override public IToken newToken(int type, Span span, Object content) { return new DefaultToken( type, span.start(), span.length(), build.getMapping().getToken(type)); } }); lexer.setErrorReporter(reporter); lexer.skipComments(false); lexer.setInput(new StringReader(text)); tokens.clear(); int eof = build.getMapping().getTokenNumber("$EOF$"); try { while (true) { IToken t = lexer.nextToken(); if (t.type() == eof) break; tokens.add(t); } } catch (IOException e) { } }
@Override public String getType() { return "text/testlex-" + build.getName(); }
@Override public String getName() { return "Test " + build.getName() + " Lexer"; }