%% %include Jflex.include %init{ /* code dans le constructeur : action initiale */ System.out.println("Entete mail RFC822 avec Super-etats JFlex"); %init} %eof{ /* code en action final */ System.out.println("Bye!"); %eof} %state CORPS, HEAD ASCII7 = [\x00-\x7F] /* == printable - " "(\x20) - ":"(\x3A) */ HEADCAR = [\x21-\x39\x3B-\x7E] /* titre de header */ HNAME = {HEADCAR}+ /*contenu de header jusqu'a la fin de ligne*/ HLINE = .* /*continuation de header multiligne*/ HCONT = \R[ \t] %% ^{HNAME} { yybegin(HEAD); ECHO("NOM-CHAMPS"); } :{HLINE}({HCONT}{HLINE})* { System.out.println("len="+yylength()); } \R\R { yybegin(CORPS); } \R { yybegin(YYINITIAL); /*next header*/ } {ASCII7}+ { System.out.println("Corps Len="+yylength()); } [^] { WARN("Invalid char '"+yytext()+"'"); }