PPT Slide
{StartTag} { String token = yytext();
if (token.equals("<BookCatalogue>")) return new Symbol(sym.BookCatalogue_ST, yytext());
else if (token.equals("<Book>")) return new Symbol(sym.Book_ST, yytext());
else if (token.equals("<Title>")) return new Symbol(sym.Title_ST, yytext());
else if (token.equals("<Author>")) return new Symbol(sym.Author_ST, yytext());
else if (token.equals("<Date>")) return new Symbol(sym.Date_ST, yytext());
else if (token.equals("<ISBN>")) return new Symbol(sym.ISBN_ST, yytext());
else if (token.equals("<Publisher>")) return new Symbol(sym.Publisher_ST, yytext());
else return new Symbol(sym.START_TAG, yytext());
{EndTag} { String token = yytext();
if (token.equals("</BookCatalogue>")) return new Symbol(sym.BookCatalogue_ET, yytext());
else if (token.equals("</Book>")) return new Symbol(sym.Book_ET, yytext());
else if (token.equals("</Title>")) return new Symbol(sym.Title_ET, yytext());
else if (token.equals("</Author>")) return new Symbol(sym.Author_ET, yytext());
else if (token.equals("</Date>")) return new Symbol(sym.Date_ET, yytext());
else if (token.equals("</ISBN>")) return new Symbol(sym.ISBN_ET, yytext());
else if (token.equals("</Publisher>")) return new Symbol(sym.Publisher_ET, yytext());
else return new Symbol(sym.START_TAG, yytext());
mylexer.flex See example21
Note: I use _ST to indicate Start Tag, and
_ET to indicated End Tag.