예제 #1
0
 @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) {
   }
 }
예제 #2
0
 @Override
 public String getType() {
   return "text/testlex-" + build.getName();
 }
예제 #3
0
 @Override
 public String getName() {
   return "Test " + build.getName() + " Lexer";
 }