Inserting our own code into the lexer
In the JFlex specification we can specify code that we want inserted into the lexer. You put your code within %{ … %}
import java.util.*;
%%
%{
-- code --
%}
-- rules --
mylexer.flex
import java.util.*;
class lex {
-- code --
-- scanner created -- using the rules
}
lex.java
Previous slide
Next slide
Back to first slide
View graphic version