PPT Slide
/*
* Parse slash-delimited book data.
*/
%%
%class lex
%standalone
%unicode
%%
[^/\r\n]+ { System.out.print(yytext()); }
"/" { System.out.print("/"); }
\r|\n|\r\n { System.out.println(); }
<<EOF>> { return 0; }
mylexer.flex
yytext() is a standard lex
method that returns the
current token. Thus, this
action says that the lexer
should output the token
that was just consumed.
Previous slide
Next slide
Back to first slide
View graphic version