I started using JUnit to test the lexer. It speeds up things a lot. No need to start the host IDEA each time I want to try something and also when I start developing the lexer “for real” I will be able to move faster because of the safety net. But that’s just standard TDD stuff. I didn’t need to use guice to make this possible yet. I can just instantiate the lexer class directly in the tests. It does not have any dependencies right now except for the token constants.
Two other minor things I’ve been doing is getting the first syntax highlighting to work with my own lexer. it only highlighted two keywords, numbers and durations and the rest as “errors”. But it felt very nice to see those colors. the other thing was I’ve been looking over some of the parsing code for the example projects and from what I can see it would benefit from some DI. Guice to the rescue. Will just have to figure out how to hook things up. But I’ve managed to see that I can use external libraries with my plugins so I don’t see why it should not work.
0 Responses to “Unit tests for faster lexer development”