try {
fri.util.TimeStopper ts = new fri.util.TimeStopper();
SyntaxSeparation separation = new SyntaxSeparation(syntax);
LexerBuilder builder = new LexerBuilder(separation.getLexerSyntax(), separation.getIgnoredSymbols());
Lexer lexer = builder.getLexer();
lexer.setDebug(true);
lexer.setTerminals(separation.getTokenSymbols());
System.err.println("time to build lexer was: "+ts.getInterval());
InputStream in = ExampleLexer.class.getResourceAsStream("ExampleLexer.java"); //Reader in = new FileReader(args[0]);
lexer.setInput(in);
System.err.println("time to build input was: "+ts.getInterval());
Token t;
do {
t = lexer.getNextToken(null);
//System.err.println(ts.getInterval()+" was time to read token "+t.symbol+" -> "+t.text);
if (t.symbol == null) {
lexer.dump(System.err);
throw new LexerException("Uninterpretable input!");
}
System.out.println(t.symbol+" "+">"+t.text+"<");
}
while (Token.isEpsilon(t) == false);