Debugging JFlex lexer based on idea-flex.skeleton

Hi,

I created a JFlex lexer based on idea-flex.skeleton for a small language. Before creating all the other classes needed to use it inside an IDEA plugin, I wanted to check whether the lexer as I defined it works. So I added the %debug option and run in on a sample file of that language. Unfortunately the only thing I see on the console is "null".
After looking through the generated code, I now think that debugging cannot work. The lexer itself doesn't read the file. The only way the buffer is set is through the two reset methods that aren't called from the created main method.
Does anyone have an IDEA ;) how to make this work? Or is the only way out to temporarily disable the IDEA-specific skeleton, work on the lexer till it produces satisfying results and then to enable the skeleton again?

Cheers,
Robert

2 comments

Oh, well. I guess there is no way to debug an IDEA JFlex lexer.
Anyways, it doesn't matter for me anymore since I replaced the JFlex lexer with a handwritten one.
So I mark this question as answered though it really isn't.

Cheers,
Robert

0

How do you implement a handwritten lexer? What is the entry point? 

I could think of implementing the FlexLexer interface. But how does the control come into these methods? It would be great if you can share your example.

0

Please sign in to leave a comment.